template-mcp-server
by mcpdotdirect·★ 74·综合分 45
使用 FastMCP 构建 MCP 服务器的模板,支持 stdio 和 HTTP 传输方式。
developer-toolsproductivityother
39
Forks
2
活跃 Issue
6 个月前
最近提交
2 天前
收录于
概述
这个仓库为开发者创建自己的 MCP (Model Context Protocol) 服务器提供了结构良好的模板。它支持 stdio 和 HTTP 传输方式,适用于个人开发和团队协作场景。模板使用 FastMCP 构建,提供 TypeScript 支持以确保类型安全,还包含清晰的示例,用于添加自定义工具、资源和提示来扩展服务器功能。
试试问 AI
装完之后,这里有 5 个你可以让 AI 做的事:
你:以最少的设置快速启动新的 MCP 服务器项目
你:使用 HTTP 传输创建团队共享的 MCP 工具
你:使用 stdio 传输开发个人生产力工具
你:支持哪些传输方式?
你:如何以开发模式运行服务器?
什么时候选它
如果你是 TypeScript 开发者,想要快速搭建一个支持 stdio 和 HTTP 传输方式的新 MCP 服务器,应该选择这个模板。
什么时候不要选它
如果你需要服务器端认证,不应该选择这个模板,因为它不包含认证模型。
此 server 暴露的工具
从 README 抽取出 1 个工具(置信度较低)hello_worldname: stringA simple hello world tool that greets a given name
说明:Inferred from example code snippet showing how to add tools to a FastMCP server, not from actual tool documentation
可对比工具
fastmcpmcp-server-templatemcp-template-typescriptcreate-mcp-server
安装
安装
使用 npx 或 npm 创建新的 MCP 服务器项目:
# 使用 npx
npx @mcpdotdirect/create-mcp-server
# 或使用 npm
npm init @mcpdotdirect/mcp-server创建项目后,安装依赖:
npm installClaude Desktop 配置
添加到您的 Claude Desktop config.json:
{
"mcpServers": {
"my-mcp-server": {
"command": "npm",
"args": ["start"]
}
}
}FAQ
- 支持哪些传输方式?
- 该模板支持 stdio (CLI 模式) 和 HTTP (SSE 模式) 传输方式。Stdio 适用于个人开发,而 HTTP 可跨机器共享,便于团队协作。
- 如何以开发模式运行服务器?
- 使用 npm 脚本:`npm run dev` 用于 stdio 传输,或 `npm run dev:http` 用于 HTTP 传输。这两种模式都提供自动重载功能,便于开发。
template-mcp-server 对比
最后更新于 · 由 README + GitHub 公开数据自动生成。