MCP服务器启动器
用于使用TypeScript构建模型上下文协议(MCP)服务器的生产就绪启动模板。
🚀 快速开始
- 克隆存储库
- 安装依赖项:```bash
bun install
## ✨ 主要特点
- Bun用于快速测试和开发
- 植绒和格式化的生物特征
- 标准版本的自动化版本管理
- 干净、可维护的项目结构
## 📂 项目结构```
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工具:```bash
bun run scripts/create-tool.ts
这将:
1. 在下创建新的工具目录 `src/tools/`
1. 生成基本工具结构,包括:
- index.ts(主要实现)
- schema.ts(用于工具参数的JSON模式)
- test.ts(测试文件)
1. 更新工具索引文件以导出新工具
例子:```bash
bun run scripts/create-tool.ts weather
🛠️ 发展
- 运行测试:
bun test - 格式代码:
bun run format - Lint代码:
bun run lint - 生成项目:
bun run build
要将您的开发MCP服务器添加到Claude Desktop,请执行以下操作:
- 构建项目:```bash
bun run build
1. 添加到您的Claude Desktop配置中:```json
// You only need the argument if you need to pass arguments to your server
{
"mcpServers": {
"your-server-name": {
"command": "node",
"args": ["/path/to/your/project/dist/main.js", "some_argument"]
}
}
}
📜 版本管理
此项目使用 标准版本 用于自动化版本管理。跑 bun run release 创建新版本。
提交消息格式
feat:新功能(凸起次要版本)fix:Bug修复(凸起补丁版本)BREAKING CHANGE:突破性变化(颠簸主要版本)
📦 发布到npm
- 请确保您已登录到npm:```bash
npm login
1. 构建项目:```bash
bun run build
- 发布包:```bash
npm publish
请记住使用以下命令更新版本号 `bun run release` 在发布新版本之前。
## 从npm安装(发布后)
添加到您的Claude Desktop配置中:```json
// 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"]
}
}
}
