The reason to open this is that all three roles — server, client and host — live in one repository as edge functions you can read end to end, which is rare. The hosted endpoint is there to try the flow; the source is there so you can put your own tools behind the same architecture.
A working example rather than a library: a Next.js chat app whose edge functions implement an MCP Streamable HTTP server, an MCP client, and a chat-completions API that acts as the host coordinating the two. The deployed instance serves an MCP endpoint you can connect to directly.
- A remote endpoint at https://mcp-on-edge.edgeone.site/mcp-server for any client that supports Streamable HTTP servers
- The server implementation in functions/mcp-server, the client in functions/mcp-client, and the host in functions/v1/chat/completions
- A chat backend that accepts and returns OpenAI-formatted requests, so existing clients can drive it
- A React front end in app/page.tsx you can run locally and reshape
- A one-click deploy path to EdgeOne Pages from the template
- Streamable HTTP as specified in the 2025-03-26 revision of the protocol
To use the hosted server, only a client that supports Streamable HTTP — add the URL and you are done. To run your own: npm install and npm run dev, which serves on localhost:3000, plus a .env copied from .env.example and filled in with your AI service configuration. Deploying it is the EdgeOne Pages template flow.
One command — npx -y mcp-remote https://mcp-on-edge.edgeone.site/mcp-server
