About Examples
Examples is an MCP server published by pingcy in the Search category: 《MCP原理揭秘与开发指南》书籍示例代码 - Model Context Protocol (MCP) 示例代码集合.
The repository has 8 stars and 4 forks, with the last commit a year ago. Six months or more without a commit doesn't mean the server is broken, but check the open issues before depending on it in production.
Install
git clone https://github.com/pingcy/MCP-examplesThis server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.
Ask AI
Ask AI about Examples
Powered by Claude · Grounded in docs
Security checks
Static checks derived from the repository yesterday. Heuristics on the source, not an audit.
- ✓README presentThe repository ships documentation.
- !License declaredNo license file. Legally you have no right to use it in a product.
- ✓Tests presentA test suite exists in the repository.
- ✓Dependencies pinnedA lockfile pins dependency versions.
2 checks have not been run yet.
README
MCP示例代码集合
本仓库包含书籍《MCP原理揭秘与开发指南》中的示例代码,展示了Model Context Protocol (MCP) 的各种实现方式和应用场景。
源代码文件
服务端文件
serverdemo.py- MCP服务器主要实现示例serverdemo_lowlevel.py- Lowlevel SDK MCP服务器实现serverdemo_lowlevel_ws.py- Low level SDK WebSocket版本的MCP服务器sample_server.py- 基础MCP服务器示例mcp_server_raw_sse.py- SSE服务器模拟实现mcp_server_raw_stdio.py- STDIO服务器模拟实现
客户端文件
clientdemo.py- MCP客户端实现示例clientdemo_sse_raw.py- SSE客户端模拟实现clientdemo_stdio_raw.py- STDIO客户端模拟实现sample_sse_client.py- 基础MCP SSE客户端示例sample_stdio_client.py- 基础MCP STDIO客户端示例register_tool_client.py- 动态工具注册客户端
工具文件
cache.py- 服务端工具缓存实现
子目录
1.9.0/- MCP 1.9.0版本演示相关代码app_functioncalling/- MCP工具转函数调用示例app_langgraph/- LangGraph集成示例app_manus/- Agent应用示例app_rag/- RAG(检索增强生成)应用示例myhandlers/- 自定义处理器模块mymcp/- 自定义MCP扩展实现mytools/- 自定义工具集合myutils/- 工具函数集合
配置文件
pyproject.toml- Python项目配置uv.lock- 依赖锁定文件Dockerfile- Docker容器配置.python-version- Python版本配置
使用说明
这些示例代码展示了MCP协议的不同实现方式,包括:
- 基础的MCP服务器/客户端实现、原理模拟
- 不同传输方式(STDIO、SSE、WebSocket)
- MCP高级开发功能
- 与各种AI框架的集成
- 实际应用场景的实现
每个文件都包含了详细的代码注释,可以作为学习MCP协议的参考。
README fetched from the repository yesterday. The original is authoritative.