关于 🤖 Model Context Protocol (MCP) Examples
Model Context Protocol (MCP) Examples 是基于 TypeScript SDK 的模块化 MCP 服务示例集合,面向 MCP 开发者。各模块可独立运行,根入口会动态注册并启动服务,示例包括代码分析和脚手架生成。
主要功能
- 01模块化 MCP 服务示例
- 02动态注册并启动模块
- 03分析本地代码仓库
- 04生成并扩展代码脚手架
适用场景
- 01探索本地代码仓库
- 02生成项目起始代码
- 03通过 MCP Inspector 调试服务
MCP 相关
各模块通过 MCP 注册工具和提示词,并采用 Streamable HTTP 或 STDIO 传输。根入口会动态注册并启动这些 MCP 服务。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
暂未收录安装方式
我们还没有获取到这个服务的安装包或远程地址,请按项目 README 中的说明安装。
工具
还没有获取到工具列表
本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。
详细介绍
🤖 Model Context Protocol(MCP)示例
此仓库包含使用 Model Context Protocol TypeScript SDK 构建的模块化 MCP Agent 服务。
src/ 中的每个子目录都是一个独立的 MCP 服务,包含工具和提示词(例如代码分析、摘要生成等)。
✨ 根目录下的
src/index.ts会动态注册并启动所有独立服务。
📦 结构
src/
├── index.ts # Main launcher to register all MCP servers
├── code-analysis/ # Analyzes local code repositories
│ ├── tools.ts # Tool implementations
│ ├── server.ts # Registers tools & prompts with MCP
│ ├── utils.ts # Helper functions (file reading, structure)
│ ├── prompt.ts # Prompt handler definitions
│ └── README.md # Module-specific usage docs
...
🚀 快速开始
1. 安装依赖
npm install
2. (可选)配置本地 .env
echo "PORT=3000" > .env
3. 启动 MCP 服务
npm run dev
服务将在以下地址运行:
http://localhost:3000/mcp
🧪 调试/手动测试
你可以使用 MCP Inspector 测试服务,它是用于调试基于 MCP 的服务的 UI 工具。
启动 MCP Inspector(在另一个终端中)
npm run debug
然后打开:
👉 http://127.0.0.1:6274
并使用 Streamable HTTP 连接到 http://localhost:3000/mcp。
🧩 支持的 MCP 模块
| 文件夹 | 描述 | 传输方式 |
|---|---|---|
code-analysis | 分析和探索本地代码仓库 | Streamable HTTP |
boilerplate-gen | 生成初始代码库并逐步添加功能 | STDIO |
| (即将推出更多) | ... | ... |
📜 许可证
MIT License Copyright (c) 2025 suresh konakanchi
Permission is hereby granted,
free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice
(including the next paragraph) shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
评论
支持 Markdown
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。