金丝雀
支持OAuth、LLM和Docker的生产就绪MCP服务器
这是一个 生产就绪的MCP服务器 您可以根据自己的用例进行自定义。它包括示例工具,向您展示模式——用您自己的业务逻辑替换它们。
包含内容
- ✅ 工作MCP服务器 -STDIO和HTTP模式就绪
- ✅ 示例工具 -基本和LLM驱动工具的模式(根据需要删除/替换)
- ✅ 生产部署 -Docker和Vercel配置就绪
- ✅ 测试与验证 -全面的测试套件和CI/CD管道
- 🔐 缺省安全 -加密密钥、OAuth、会话管理
快速入门:将此服务器设为您的
1.获取依赖关系
npm install2.配置环境(可选)
cp .env.example .env
# Edit .env to add API keys (all optional - server works without them)3.开始建设
# Start development server
npm run dev:stdio
# In another terminal, test your tools
npm run test:mcp4.根据您的用例进行定制
用您自己的工具替换示例工具:
- 学习
src/tools/hello.ts和src/tools/echo.ts模式 - 删除不需要的示例工具
- 在中创建新工具
src/tools/遵循相同的模式 - 跑
npm run validate确保一切正常
看 CLAUDE.md 获取详细的工具创建指南。
示例工具(替换这些!)
此服务器包括演示模式的工作示例:
基本工具 (不需要API密钥):
hello,echo,current-time-简单的同步工具
下一步: 按照相同的模式,用自己的工具替换这些工具。
构建自己的工具
添加新工具
- 创建工具文件:
src/tools/my-tool.ts
import { ToolDefinition } from '@mcp-typescript-simple/tools';
export const myTool: ToolDefinition = {
name: 'my-tool',
description: 'What your tool does',
inputSchema: {
type: 'object',
properties: {
// your parameters
},
required: []
},
execute: async (input) => {
// your logic here
const result = 'your result';
return {
content: [{ type: 'text', text: result }]
};
}
};- 注册工具: 添加到
src/tools/index.ts
export { myTool } from './my-tool.js';- 测试:
npm run validate
- 部署:
docker-compose up或vercel
工具样式
- 基本工具: 看
src/tools/echo.ts用于同步操作 - 异步操作: 所有工具都支持async/await
- 错误处理: 遵循示例工具中的模式
综合指南: 看 CLAUDE.md 获取分步说明。
发展
可用脚本
npm run dev:stdio # STDIO mode
npm run dev:http # HTTP mode (no auth)
npm run build # Build project
npm test # Run tests
npm run validate # Full validation (required before commit)
npm run typecheck # TypeScript type checking
npm run lint # Code linting部署服务器
本地开发
npm run dev:stdio # STDIO mode (MCP Inspector)
npm run dev:http # HTTP mode (no auth)生产部署
Docker(建议用于自托管):
docker-compose up
# Access: http://localhost:8200
# Grafana observability: http://localhost:3220部署前:
- 用您自己的示例工具替换
- 跑
npm run validate确保测试通过 - 更新生产环境变量
- 审查安全配置
看 CLAUDE.md 用于生产部署检查表。
项目结构
canary/
├── src/
│ ├── index.ts # Main entry point (customize as needed)
│ ├── config.ts # Configuration (add your settings here)
│ └── tools/ # ⭐ START HERE: Replace example tools
│ ├── index.ts # Tool registry (add your tools here)
│ └── hello.ts # Example tool (replace or delete)
├── test/
│ └── tools/ # Add tests for your custom tools
│ └── hello.test.ts
├── docker/ # Production Docker deployment
│ ├── docker-compose.yml
│ ├── nginx.conf
│ └── Dockerfile
├── .env.example # Copy to .env and add your keys
├── CLAUDE.md # ⭐ READ THIS FIRST
├── package.json
├── tsconfig.json
└── vibe-validate.config.yaml # Validation pipeline要自定义的关键文件:
src/tools/-你的业务逻辑在这里src/config.ts-添加配置选项.env-您的API密钥和秘密
后续步骤
1.首先阅读CLAUDE.md(强烈推荐)
综合指南涵盖:
- 添加和自定义工具
- 测试和验证工作流程
- 生产部署最佳实践
- 安全和身份验证配置
2.自定义此服务器
- 用您的业务逻辑替换示例工具
- 为您的用例配置身份验证
- 设置生产部署(Docker或Vercel)
3.寻求帮助
- 框架文件: mcp typescript简单文档
- 报告问题:
- 提问:
安全
- ✅ 独特
TOKEN_ENCRYPTION_KEY为此服务器生成 - ✅
.env文件在.gitignore(从未承诺) - ✅ 加密Redis会话存储
永不承诺 .env 文件到git!
许可证
默认情况下,此项目未获得许可。为您的用例选择合适的许可证。
对于开源项目,请考虑:
- MIT-许可,广泛使用
- Apache 2.0-允许专利保护
- GPL-Copyleft,要求衍生品是开源的
对于专有项目,添加版权声明或保留为“未许可”。
支持
______________________________________________________________________
由...驱动 @mcp-typescript-simple -TypeScript的生产就绪MCP服务器框架
