一个用于使用 TypeScript 构建 Model Context Protocol (MCP) 服务器的生产就绪启动模板。
bun install
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>
下创建一个新的工具目录示例:
bun run scripts/create-tool.ts weather
bun test
bun run format
bun run lint
bun run build
要将您的开发 MCP 服务器添加到 Claude Desktop 中:
bun run build
// 仅当需要向服务器传递参数时才需要该参数
{
"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 login
bun run build
npm publish
请记得在发布新版本之前使用 bun run release
更新版本号。
添加到您的 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"]
}
}
}
