Provide implementations of advanced data structures
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Configure HTTP/SSE transport for web-based MCP servers with proper endpoints, authentication, and CORS.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
설치 방법 보기설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.
Configure HTTP/SSE transport for web-based MCP servers.
Invoke this skill when you need to:
| Parameter | Type | Required | Description |
|---|---|---|---|
| language | string | Yes | Target language (typescript, python) |
| framework | string | No | Web framework (express, fastify, fastapi) |
| auth | object | No | Authentication configuration |
| cors | object | No | CORS configuration |
import express from 'express';
import cors from 'cors';
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js';
const app = express();
// CORS configuration
app.use(cors({
origin: process.env.ALLOWED_ORIGINS?.split(',') || '*',
credentials: true,
}));
app.use(express.json());
// Store active connections
const connections = new Map<string, SSEServerTransport>();
// SSE endpoint
app.get('/sse', async (req, res) => {
const connectionId = req.query.connectionId as string || crypto.randomUUID();
// Set SSE headers
res.setHeader('Content-Type', 'text/event-stream');
res.setHeader('Cache-Control', 'no-cache');
res.setHeader('Connection', 'keep-alive');
res.setHeader('X-Accel-Buffering', 'no');
// Create transport
const transport = new SSEServerTransport('/message', res);
connections.set(connectionId, transport);
// Create server instance for this connection
const server = new Server(
{ name: 'my-mcp-server', version: '1.0.0' },
{ capabilities: { tools: {}, resources: {} } }
);
// Register handlers...
registerToolHandlers(server);
// Handle connection close
req.on('close', () => {
connections.delete(connectionId);
transport.close();
});
// Connect transport
await server.connect(transport);
});
// Message endpoint
app.post('/message', async (req, res) => {
const connectionId = req.query.connectionId as string;
const transport = connections.get(connectionId);
if (!transport) {
res.status(404).json({ error: 'Connection not found' });
return;
}
try {
await transport.handlePostMessage(req, res);
} catch (error) {
res.status(500).json({ error: 'Failed to process message' });
}
});
// Health check
app.get('/health', (req, res) => {
res.json({
status: 'healthy',
connections: connections.size,
timestamp: new Date().toISOString(),
});
});
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
console.log(`MCP Server listening on port ${PORT}`);
});
from fastapi import FastAPI, Request, Response
from fastapi.middleware.cors import CORSMiddleware
from sse_starlette.sse import EventSourceResponse
from mcp.server import Server
from mcp.server.sse import SseServerTransport
import uuid
import asyncio
app = FastAPI()
# CORS
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# Store connections
connections: dict[str, SseServerTransport] = {}
@app.get("/sse")
async def sse_endpoint(request: Request):
connection_id = request.query_params.get("connectionId") or str(uuid.uuid4())
async def event_generator():
transport = SseServerTransport("/message")
connections[connection_id] = transport
server = Server("my-mcp-server")
register_handlers(server)
try:
async for event in transport.events():
yield event
finally:
connections.pop(connection_id, None)
return EventSourceResponse(event_generator())
@app.post("/message")
async def message_endpoint(request: Request):
connection_id = request.query_params.get("connectionId")
transport = connections.get(connection_id)
if not transport:
return Response(status_code=404, content="Connection not found")
body = await request.json()
await transport.handle_message(body)
return Response(status_code=200)
@app.get("/health")
async def health():
return {
"status": "healthy",
"connections": len(connections),
}
아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.
로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.
아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.
Provide implementations of advanced data structures
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Fresh adversarial code review with binary PASS/FAIL verdicts, evidence citations, and anchoring bias prevention via fresh reviewer spawning.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
WASM-based instant code transforms for simple tasks, achieving 352x speedup over LLM inference with zero cost.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Coordinate Crew (persistent) and Polecat (transient) agents using Gas Town's hook-based work distribution and GUPP principle.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Generate visual representations of algorithm execution
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Hierarchical coordination and drift detection with frequent checkpoints, shared memory coherence validation, role specialization enforcement, and short task cycles.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.