MCP Zenon 服务器模板
一个用于使用 TypeScript 构建模型上下文协议服务器的生产就绪模板,提供通过 Bun 快速开发、Biome 代码检查以及自动版本管理的功能。
可用工具 (1 个)
该服务在 MCP 协议中暴露的工具,AI 可按需调用
hello_tool 1 个参数 需填 1 项
Hello tool
必填参数:name
服务介绍
MCP 服务器启动器
一个用于构建 Model Context Protocol (MCP) 服务器的生产就绪启动模板,使用 TypeScript。
🚀 快速开始
- 克隆仓库
- 安装依赖项:
bun install
✨ 主要特性
- 使用 Bun 进行快速测试和开发
- 使用 Biome 进行代码检查和格式化
- 使用 standard-version 自动管理版本
- 清晰、可维护的项目结构
📂 项目结构
mcp-starter/
├── src/
│ ├── tools/ # MCP tools implementation
│ ├── utils/ # Shared utilities
│ ├── main.ts # Server entry point
│ └── types.ts # Shared type definitions
├── tests/ # Test files
├── biome.json # Linting configuration
├── tsconfig.json # TypeScript configuration
└── package.json # Project dependencies
⚙️ 配置
创建新工具
项目中包含一个脚本,帮助创建新的 MCP 工具:
bun run scripts/create-tool.ts <tool-name>
这将:
- 在
src/tools/<tool-name>下创建一个新的工具目录 - 生成基本的工具结构,包括:
- index.ts(主要实现)
- schema.ts(工具参数的 JSON 模式)
- test.ts(测试文件)
- 更新工具索引文件以导出新工具
示例:
bun run scripts/create-tool.ts weather
🛠️ 开发
- 运行测试:
bun test - 格式化代码:
bun run format - 代码检查:
bun run lint - 构建项目:
bun run build
要将您的开发中的 MCP 服务器添加到 Claude Desktop 中:
- 构建项目:
bun run build - 添加到您的 Claude Desktop 配置中:
// 如果您需要向服务器传递参数,则只需该参数 { "mcpServers": { "your-server-name": { "command": "node", "args": ["/path/to/your/project/dist/main.js", "some_argument"] } } }
📜 版本管理
此项目使用 standard-version 进行自动版本管理。运行 bun run release 以创建新版本。
提交信息格式
feat: 新功能(增加次要版本号)fix: 错误修复(增加补丁版本号)BREAKING CHANGE: 破坏性变更(增加主版本号)
📦 发布到 npm
- 确保您已登录 npm:
npm login - 构建项目:
bun run build - 发布包:
npm publish
记得在发布新版本之前使用 bun run release 更新版本号。
从 npm 安装(发布后)
添加到您的 Claude Desktop 配置中:
// You only need the argument if you need to pass arguments to your server
{
"mcpServers": {
"your-server-name": {
"command": "npx",
"args": ["-y", "your-package-name", "some_argument"]
}
}
}