timeless 在 【有偿求助】怎么实现sse模式的mcp转发 中发帖
最近研究MCP,发现remote模式的MCP有2种通信模式,streamableHttp 和 SSE,要对所有的MCP请求做统一转发管理,自己实现了streamableHttp的转发,但是SSE的搞不定,有佬帮忙看看吗,有偿求助
mcp测试工具:npx @modelcontextprotocol/inspector
streamableHttp MCP:npx @modelcontextprotocol/server-everything streamableHttp
sse MCP:npx @modelcontextprotocol/server-everything sse
下面是streamableHttp的转发代码
from fastapi import FastAPI, Request, HTTPException
from fastapi.middleware.cor...