Skip to content

secondsky/claude-skills / plugins/cloudflare-mcp-server/skills/cloudflare-mcp-server

cloudflare-mcp-server

Verified

Build MCP (Model Context Protocol) servers on Cloudflare Workers with tools, resources, and prompts.

references/transport.md

View on GitHub
# MCP Transport Methods - SSE vs Streamable HTTP

Comparison of the two MCP transport protocols supported by Cloudflare.

---

## Quick Comparison

| Feature | SSE | Streamable HTTP |
|---------|-----|-----------------|
| **Status** | Legacy | Current (2025) |
| **Efficiency** | Lower | Higher |
| **Adoption** | High (all clients) | Low (new clients) |
| **Endpoint** | `/sse` | `/mcp` |
| **Method** | `serveSSE()` | `serve()` |
| **Recommendation** | Support both | Support both |

---

## SSE (Server-Sent Events)

### Overview
- Original MCP transport
- Uses HTTP + Server-Sent Events
- Widely supported by all MCP clients

### Implementation
```typescript
MyMCP.serveSSE("/sse").fetch(request, env, ctx)
```

### Client Configuration
```json
{
  "mcpServers": {
    "my-mcp": {
      "url": "https://my-mcp.workers.dev/sse"
    }
  }
}
```

### Pros
✅ Supported by all MCP clients
✅ Established protocol
✅ Works everywhere

### Cons
❌ Less efficient
❌ Higher latency
❌ More bandwidth

---

## Streamable HTTP

### Overview
- New MCP transport (2025)
- Uses HTTP with streaming
- More efficient, lower latency

### Implementation
```typescript
MyMCP.serve("/mcp").fetch(request, env, ctx)
```

### Client Configuration
```json
{
  "mcpServers": {
    "my-mcp": {
      "url": "https://my-mcp.workers.dev/mcp"
    }
  }
}
```

### Pros
✅ More efficient
✅ Lower latency
✅ Less bandwidth
✅ Better error handling

### Cons
❌ Not all clients support yet
❌ Newer standard

---

## Supporting Both (Recommended)

```typescript
export default {
  fetch(request: Request, env: Env, ctx: ExecutionContext) {
    const { pathname } = new URL(request.url);

    if (pathname.startsWith("/sse")) {
      return MyMCP.serveSSE("/sse").fetch(request, env, ctx);
    }

    if (pathname.startsWith("/mcp")) {
      return MyMCP.serve("/mcp").fetch(request, env, ctx);
    }

    return new Response("Not Found", { status: 404 });
  }
};
```

**Why support both?**
- Maximum client compatibility
- Smooth transition as clients upgrade
- No breaking changes

---

## With OAuth

```typescript
import { OAuthProvider } from "@cloudflare/workers-oauth-provider";

export default new OAuthProvider({
  // ... OAuth config ...

  apiHandlers: {
    "/sse": MyMCP.serveSSE("/sse"),
    "/mcp": MyMCP.serve("/mcp")
  }
});
```

---

## Testing

### Test SSE
```bash
npx @modelcontextprotocol/inspector@latest
# Enter: http://localhost:8788/sse
```

### Test Streamable HTTP
```bash
# Use mcp-remote adapter
npx mcp-remote http://localhost:8788/mcp
```

---

**Recommendation**: **Support both transports** for maximum compatibility.
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall