MCP服务器TypeScript模板

@minimind-org/mcp-server-typescript-template
0 Stars 464 次浏览 minimind-org 更新于 2026-08-23

一个用于创建模型上下文协议服务器的 TypeScript 模板,该服务器使人工智能模型能够利用外部工具,包括示例操作和简单的数字相加功能。

该服务暂未提供标准配置,请参考 README 手动接入

服务介绍

MCP 服务器 TypeScript 模板

这是一个使用 TypeScript 创建 Model Context Protocol (MCP) 服务器的模板。该项目展示了如何实现一个带有自定义工具的简单 MCP 服务器。

概述

此模板实现了一个基本的 MCP 服务器,提供了以下工具:

  • 示例操作:一个简单的演示操作
  • 加法:一个将两个数字相加的工具

该服务器使用 Model Context Protocol SDK 来处理 AI 模型与外部工具之间的通信。

前提条件

  • Node.js(v16 或更高版本)
  • npm 或 yarn

项目结构

项目结构如下:

mcp-server-typescript-template/
├── common/
│   ├── constant.ts     # Project constants
│   ├── errors.ts       # Error handling utilities
│   └── types.ts        # Type definitions
│   └── utils.ts        # Utility functions

├── operations/
│   └── example-operation.ts  # Implementation of example operations
├── index.ts            # Main server implementation
├── package.json
└── tsconfig.json

安装

克隆仓库并安装依赖项:

git clone <repository-url>
cd mcp-server-typescript-template
npm install
npm run test
npm run build
npm run start # this will start the server for testing

配置 MCP 客户端(Claude Desktop)

编辑您的 claude_desktop_config.json 文件以添加以下内容:

{
  "mcpServers": {
    "example": {
      "command": "node",
      "args": [
        "/path/to/mcp-server-typescript-template/dist/index.js"
      ]
    }
  }
}

相关 MCP 服务