本项目建于2025-03-30,是一个MCP Client 与 MCP Server的样例实现(Python版本)
@jayliangdl
About 本项目建于2025-03-30,是一个MCP Client 与 MCP Server的样例实现(Python版本)
MCP Client 与 MCP Server基于SSE方式的样例实现(Python版本)
Basic information
Config
Add this server to your MCP-compatible client using the configuration below.
{
"mcpServers": {
"py-mcp-sse": {
"command": "uv",
"args": [
"venv"
]
}
}
}Tools
No tools detected
We auto-extract tools from the README. The maintainer can list them under a ## Tools heading to populate this section.
Overview
What is jay-py-mcp-sse?
Jay-py-mcp-sse 是一个 MCP(Model Context Protocol)客户端和服务器的样例实现(Python 版本),采用 SSE(Server‑Sent Events)通信模式。它集成了古腾堡计划 API 的图书搜索工具,并使用 OpenRouter.ai 作为 LLM 调用平台(替换了原版的 Anthropic LLM)。该项目面向希望学习或搭建 MCP SSE 模式的开发者。
How to use jay-py-mcp-sse?
使用 uv 或 pip 安装依赖,复制 .env.sample 为 .env 并填入 OpenRouter API 密钥。先运行 mcp_server.py 启动服务器(可选 --host 和 --port 参数),再运行 client.py 并传入服务器的 SSE URL(如 http://localhost:8080/sse)连接并使用工具。
Key features of jay-py-mcp-sse
- 基于 SSE 的 MCP 服务器和客户端样例实现
- 集成古腾堡计划 API 图书搜索工具
- 使用 OpenRouter.ai 进行 LLM 调用
- 支持 Python 3.13+,兼容 uv 或 pip 安装
- 服务器与客户端解耦运行,适合云原生场景
Use cases of jay-py-mcp-sse
- 学习 MCP 协议中 SSE 通信模式的工程实现
- 搭建可远程访问的 MCP 服务器,提供图书搜索功能
- 作为自定义 MCP 服务器和客户端的脚手架参考
FAQ from jay-py-mcp-sse
该项目与官方 MCP 示例(STDIO 版)有何不同?
原版使用 STDIO 通信且依赖 Anthropic LLM;本版本改用 SSE 通信,使服务器和客户端可解耦运行,同时将 LLM 调用切换为 OpenRouter.ai。
运行需要哪些系统要求?
需要 Python 3.13 或更高版本,以及 uv 或 pip 包管理器。还需在 .env 文件中配置有效的 OpenRouter API 密钥。
如何启动服务器和客户端?
先运行 uv run mcp_server.py(可添加 --host 和 --port 指定地址),然后运行 uv run client.py http://<host>:<port>/sse 连接。
项目包含哪些文件?
主要文件:mcp_server.py(SSE 服务器)、client.py(MCP 客户端)、.env.sample(环境变量示例)、pyproject.toml(依赖管理)。
遇到连接问题应检查什么?
确认 Python 版本 ≥ 3.13、环境变量 OPENROUTER_API_KEY 已正确填写、所有依赖已安装、端口未被占用(可用 --port 更换端口)。
More Other MCP servers
Activepieces
activepiecesAI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
Maestro
mobile-dev-incPainless E2E Automation for Mobile and Web
Inbox Zero AI
elie222The world's best AI personal assistant for email. Open source app to help you reach inbox zero fast.
ghidraMCP
LaurieWiredMCP Server for Ghidra
Nginx UI
0xJackyYet another WebUI for Nginx
Comments