MCP服务器模板

提供基于Model Context Protocol的最小化服务器模板,支持Python和TypeScript的传输设置和工具注册。

  • by SarathChandraBellam
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 SarathChandraBellam/mcp-server-templates

使用说明

MCP服务器模板

最小,运输优先 模型上下文协议 服务器模板遵循 2025-11-25 规范。

这个仓库现在专注于最小的有用MCP示例:

  • add(a, b)
  • sub(a, b)

布局

传输 Python TypeScript 注释
stdio stdio/python 标准输入/打字 stdin/stdout上的本地子进程服务器
http-remote http远程/python http远程/类型脚本 远程流式HTTP服务器 /mcp

范围

这些模板有意展示:

  • 传输设置
  • 工具注册
  • 键入工具输入
  • 最小请求/响应流

这些模板目前不包括:

  • 资源
  • 提示
  • OAuth示例
  • 持久性或示例数据文件

先决条件

python

TypeScript

  • Node.js 18+
  • npm

快速开始

Python标准

cd stdio/python
uv sync
uv run server.py

TypeScript标准

cd stdio/typescript
npm install
npm run build
npm start

Python http远程

cd http-remote/python
uv sync
uv run server.py

TypeScript http远程

cd http-remote/typescript
npm install
npm run build
npm start

远程HTTP模板侦听 http://127.0.0.1:8000/mcp.

项目结构

mcp-server-templates/
├── README.md
├── docs/
│   ├── mcp-oauth-guide.md
│   └── mcp-primitives-guide.md
├── stdio/
│   ├── python/
│   └── typescript/
└── http-remote/
    ├── python/
    └── typescript/

许可证

麻省理工学院