我的MCP服务器
快速开始
npm install
npm run build
npm start添加到克劳德代码
创建 .mcp.json 在项目根目录中:
{
"mcpServers": {
"my-mcp-server": {
"command": "node",
"args": ["path/to/dist/index.js"]
}
}
}工具
| 工具 | 说明 |
|---|---|
reverse_string | 反转字符串 |
word_count | 统计单词和字符 |
server_info | 服务器元数据和运行状况检查 |
发展
npm run dev # Run with tsx (no build needed)
npm run build # Compile TypeScript
npm test # Run tests
npm run test:watch # Watch mode添加新工具
- 在中定义类型
src/types.ts - 在中向服务添加业务逻辑
src/services/ - 在中定义工具
src/tools/使用ToolDefinition接口 - 把它连接起来
src/index.ts - 在中添加测试
tests/
看 浓缩MCP 以完整的生产示例为例。
许可证
麻省理工学院
