PoE代理MCP服务器
一个 FastMCP 服务器,用于代理 Poe.com API,提供查询 Poe 模型和共享文件的工具。该服务器经过专门设计,以确保与 Claude 3.7 Sonnet 以及 Poe 提供的其他模型兼容。
特征
多模型支持:查询 Poe 上可用的各种模型,包括 GPT-4o、Claude 3 Opus、Claude 3 Sonnet、Gemini Pro 等
Claude 3.7 Sonnet 兼容性:针对 Claude 思考协议的特殊处理
文件共享:与支持它的模型共享文件
会话管理:在多个查询中维护对话上下文
流响应:从模型获取实时流响应
Web 客户端支持:通过 SSE 传输将服务器与 Web 客户端一起使用
Related MCP server: MCP Server for Replicate
安装
先决条件
Python 3.8 或更高版本
Poe API 密钥(从Poe.com获取)
快速安装
使用提供的安装脚本:
git clone https://github.com/Anansitrading/poe-proxy-mcp.git
cd poe-proxy-mcp
chmod +x install.sh
./install.sh该脚本将:
创建虚拟环境
安装所有依赖项
如果不存在则创建一个
.env文件为 STDIO 和 SSE 传输设置服务器
手动设置
如果您希望手动设置:
克隆此存储库:
git clone https://github.com/Anansitrading/poe-proxy-mcp.git cd poe-proxy-mcp创建虚拟环境并安装依赖项:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -r requirements.txt使用您的 Poe API 密钥创建一个
.env文件:cp .env.example .env # Edit .env with your API key
作为包安装
您还可以将服务器安装为 Python 包:
pip install -e .这将使poe-mcp和poe-mcp-sse命令在您的环境中可用。
配置
可以使用环境变量来配置服务器:
多变的 | 描述 | 默认 |
| 您的 Poe API 密钥(必需) | 没有任何 |
| 启用详细日志记录 |
|
| 启用 Claude 兼容模式 |
|
| 上传的最大文件大小 |
|
| 会话有效期(分钟) |
|
用法
运行服务器
标准模式(STDIO)
这是默认模式,适合命令行使用:
# If installed as a package:
poe-mcp
# Or directly:
python poe_server.pyWeb 模式 (SSE)
此模式使服务器可以与 Web 客户端一起使用:
# If installed as a package:
poe-mcp-sse [port]
# Or directly:
python run_sse_server.py [port]服务器默认在端口 8000 上启动,或者您可以指定其他端口。
可用工具
该服务器公开以下工具:
ask_poe
向 Poe 机器人提问。
response = await mcp.call("ask_poe", {
"bot": "claude", # or "o3", "gemini", "perplexity", "gpt"
"prompt": "What is the capital of France?",
"session_id": "optional-session-id", # Optional
"thinking": { # Optional, for Claude models
"thinking_enabled": True,
"thinking_depth": 2
}
})ask_with_attachment
向带有文件附件的 Poe 机器人提问。
response = await mcp.call("ask_with_attachment", {
"bot": "claude",
"prompt": "Analyze this code",
"attachment_path": "/path/to/file.py",
"session_id": "optional-session-id", # Optional
"thinking": { # Optional, for Claude models
"thinking_enabled": True
}
})clear_session
清除会话的对话历史记录。
response = await mcp.call("clear_session", {
"session_id": "your-session-id"
})list_available_models
列出可用的 Poe 模型及其功能。
response = await mcp.call("list_available_models", {})get_server_info
获取有关服务器配置的信息。
response = await mcp.call("get_server_info", {})Web 客户端
examples目录中包含一个简单的 Web 客户端。使用方法如下:
以 SSE 模式启动服务器:
python run_sse_server.py在浏览器中打开
examples/web_client.html。输入服务器 URL(默认值:
http://localhost:8000)并点击“获取可用模型”。选择一个模型,输入您的提示,然后单击“提交”。
示例
简单查询
# examples/simple_query.py
import asyncio
from fastmcp import MCPClient
async def main():
client = MCPClient("http://localhost:8000")
response = await client.call("ask_poe", {
"bot": "claude",
"prompt": "Explain quantum computing in simple terms"
})
print(f"Session ID: {response['session_id']}")
print(f"Response: {response['text']}")
if __name__ == "__main__":
asyncio.run(main())文件附件
# examples/file_attachment.py
import asyncio
from fastmcp import MCPClient
async def main():
client = MCPClient("http://localhost:8000")
response = await client.call("ask_with_attachment", {
"bot": "claude",
"prompt": "Analyze this code and suggest improvements",
"attachment_path": "examples/simple_query.py"
})
print(f"Session ID: {response['session_id']}")
print(f"Response: {response['text']}")
if __name__ == "__main__":
asyncio.run(main())克劳德兼容性
此服务器包含针对 Claude 模型(尤其是 Claude 3.7 Sonnet)的特殊处理,该模型需要针对思考协议进行特定的格式化。使用 Claude 模型时:
服务器自动检测 Claude 模型并应用适当的格式。
您可以通过提供
thinking参数来启用思考协议:"thinking": { "thinking_enabled": True, "thinking_depth": 2, # Optional, default is 1 "thinking_style": "detailed" # Optional }如果思考协议失败,服务器会自动重试。
测试
运行测试套件:
python run_tests.py对于详细输出:
python run_tests.py --verbose故障排除
常见问题
身份验证错误:请确保
.env文件中的 Poe API 密钥正确。连接错误:检查您是否可以从网络访问 Poe.com。
文件上传错误:确保文件存在且在大小限制之内。
Claude 思考协议问题:如果您遇到 Claude 思考协议的错误,请尝试通过在
.env文件中设置CLAUDE_COMPATIBLE=false来禁用它。
调试
通过在.env文件中设置DEBUG_MODE=true来启用调试模式,以获取更详细的日志。
执照
该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅LICENSE文件。
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.