MCP cover image
See in Github
2025-03-10

1

Github Watches

2

Github Forks

1

Github Stars

SSE + MCP Server + Durable Objects

  1. A SSE Transport layer that works with @modelcontextprotocol/typescript-sdk (/src/sse.ts)
  2. A MCP Server as a Durable Object (/src/mcp-server-do.ts)
  3. Steps to run it end-to-end

Run it

  1. Clone this repo
  2. npm install
  3. npm start to start the DO (at http://localhost:8787)
  4. npx @modelcontextprotocol/inspector to run the MCP inspector
  5. Open the inspector, enter http://localhost:8787/sse

You should see:

Screenshot 2025-03-09 at 5 21 24 PM

Details

I took this example from @modelcontextprotocol/typescript-sdk:

import express from "express";
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js";

const server = new McpServer({
  name: "example-server",
  version: "1.0.0"
});

// ... set up server resources, tools, and prompts ...

const app = express();

app.get("/sse", async (req, res) => {
  const transport = new SSEServerTransport("/messages", res);
  await server.connect(transport);
});

app.post("/messages", async (req, res) => {
  // Note: to support multiple simultaneous connections, these messages will
  // need to be routed to a specific matching transport. (This logic isn't
  // implemented here, for simplicity.)
  await transport.handlePostMessage(req, res);
});

app.listen(3001);

...and implemented the same thing in Durable Objects. But first needed a transport layer that worked on Workers.

Following sse.ts from @modelcontextprotocol/typescript-sdk, I made one, trying to mirror the shape of the existing one. Some pretty fundamental assumptions baked into the SDK around its use of node:http that leak out beyond the SSE transport through its input types — but really the only meaningful interface change is that handlePostMessage takes a request and returns a response. Seems like there's probably a clever way somehow to upstream?

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • apappascs
  • Descubra la colección más completa y actualizada de servidores MCP en el mercado. Este repositorio sirve como un centro centralizado, que ofrece un extenso catálogo de servidores MCP de código abierto y propietarios, completos con características, enlaces de documentación y colaboradores.

  • ShrimpingIt
  • Manipulación basada en Micrypthon I2C del expansor GPIO de la serie MCP, derivada de AdaFruit_MCP230xx

  • OffchainLabs
  • Implementación de la prueba de estaca Ethereum

  • huahuayu
  • Una puerta de enlace de API unificada para integrar múltiples API de explorador de blockchain similar a Esterscan con soporte de protocolo de contexto modelo (MCP) para asistentes de IA.

  • modelcontextprotocol
  • Servidores de protocolo de contexto modelo

    Reviews

    3 (1)
    Avatar
    user_8hUUOhdm
    2025-04-15

    The Trellis MCP Server by FishWoWater is impressive! It offers seamless integration and an intuitive interface, making it a must-have for any MCP application user. Its robust performance and reliable security features ensure smooth operation. Highly recommend giving it a try through their link!