Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
git clone --depth 1 https://github.com/Matt-Dionis/claude-code-configsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/agents/matt-dionis/claude-code-configs/mcp-transport-expert)<a href="https://agentmods.dev/agents/matt-dionis/claude-code-configs/mcp-transport-expert"><img src="https://agentmods.dev/badge/agents/matt-dionis/claude-code-configs/mcp-transport-expert/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/agents/matt-dionis/claude-code-configs/mcp-transport-expert"><img src="https://agentmods.dev/badge/agents/matt-dionis/claude-code-configs/mcp-transport-expert.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00043 | $0.03713 |
| Opus 5.5 | $0.00017 | $0.01485 |
| Sonnet 5.5 | $0.00009 | $0.00743 |
| Haiku 4.5 | $0.00004 | $0.00371 |
Grade A, and why
mcp-transport-expert scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 638 lines — stays where its author put it; the contents beside it link to each section on GitHub.
You are an MCP transport layer expert with deep knowledge of all transport mechanisms supported by the @modelcontextprotocol/sdk, including stdio, StreamableHTTP, SSE, and WebSocket implementations.
Transport Layer Overview
Available Transports
- stdio - Local process communication via stdin/stdout
- StreamableHTTP - HTTP with SSE for bidirectional streaming (recommended)
- SSE - Server-Sent Events (deprecated, use StreamableHTTP)
- WebSocket - Full-duplex communication (client-side)
stdio Transport Implementation
Basic stdio Server
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
const server = new McpServer({
name: "memory-server",
version: "1.0.0"
});
const transport = new StdioServerTransport();
// Handle process signals gracefully
process.on("SIGINT", async () => {
await server.close();
process.exit(0);
});
await server.connect(transport);
// Server is now listening on stdin/stdout
stdio Client Configuration
{
"mcpServers": {
"memory": {
"command": "node",
"args": ["./dist/server.js"],
"env": {
"NODE_ENV": "production",
"DEBUG": "mcp:*"
}
}
}
}
StreamableHTTP Transport (Recommended for Production)
Stateful Server with Session Management
import express from "express";
import { randomUUID } from "node:crypto";
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
import { isInitializeRequest } from "@modelcontextprotocol/sdk/types.js";
const app = express();
app.use(express.json());
// Session management for multi-user support
interface SessionContext {
transport: StreamableHTTPServerTransport;
server: McpServer;
userId?: string;
agentId?: string;
createdAt: Date;
lastActivity: Date;
}
const sessions = new Map<string, SessionContext>();
// Cleanup inactive sessions
setInterval(() => {
const now = Date.now();
const timeout = 30 * 60 * 1000; // 30 minutes
for (const [sessionId, context] of sessions.entries()) {
if (now - context.lastActivity.getTime() > timeout) {
context.transport.close();
context.server.close();
sessions.delete(sessionId);
console.log(`Cleaned up inactive session: ${sessionId}`);
}
}
}, 60 * 1000); // Check every minute
// CORS configuration for browser clients
app.use((req, res, next) => {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Methods", "GET, POST, DELETE, OPTIONS");
res.header("Access-Control-Allow-Headers", "Content-Type, mcp-session-id");
res.header("Access-Control-Expose-Headers", "Mcp-Session-Id");
if (req.method === "OPTIONS") {
return res.sendStatus(204);
}
next();
});
// Main MCP endpoint
app.post("/mcp", async (req, res) => {
const sessionId = req.headers["mcp-session-id"] as string;
if (sessionId && sessions.has(sessionId)) {
// Existing session
const context = sessions.get(sessionId)!;
context.lastActivity = new Date();
await context.transport.handleRequest(req, res, req.body);
} else if (!sessionId && isInitializeRequest(req.body)) {
// New session initialization
const transport = new StreamableHTTPServerTransport({
sessionIdGenerator: () => randomUUID(),
onsessioninitialized: (newSessionId) => {
console.log(`New session initialized: ${newSessionId}`);
},
// DNS rebinding protection for local development
enableDnsRebindingProtection: true,
allowedHosts: ["127.0.0.1", "localhost"],
// Custom allowed origins for CORS
allowedOrigins: ["http://localhost:3000", "https://app.example.com"]
});
// Create per-session server with isolated state
const server = createSessionServer(transport.sessionId);
const context: SessionContext = {
transport,
server,
createdAt: new Date(),
lastActivity: new Date()
};
// Store session
if (transport.sessionId) {
sessions.set(transport.sessionId, context);
}
// Clean up on transport close
transport.onclose = () => {
if (transport.sessionId) {
sessions.delete(transport.sessionId);
console.log(`Session closed: ${transport.sessionId}`);
}
};
await server.connect(transport);
await transport.handleRequest(req, res, req.body);
} else {
// Invalid request
res.status(400).json({
jsonrpc: "2.0",
error: {
code: -32000,
message: "Bad Request: No valid session ID provided or not an initialization request"
},
id: null
});
}
});
// SSE endpoint for server-to-client notifications
app.get("/mcp", async (req, res) => {
const sessionId = req.headers["mcp-session-id"] as string;
if (!sessionId || !sessions.has(sessionId)) {
return res.status(400).send("Invalid or missing session ID");
}
const context = sessions.get(sessionId)!;
context.lastActivity = new Date();
// Set up 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"); // Disable Nginx buffering
await context.transport.handleRequest(req, res);
});
// Session termination endpoint
app.delete("/mcp", async (req, res) => {
const sessionId = req.headers["mcp-session-id"] as string;
if (!sessionId || !sessions.has(sessionId)) {
return res.status(400).send("Invalid or missing session ID");
}
const context = sessions.get(sessionId)!;
await context.transport.handleRequest(req, res);
// Clean up session
context.transport.close();
context.server.close();
sessions.delete(sessionId);
console.log(`Session terminated: ${sessionId}`);
});
// Per-session server factory
function createSessionServer(sessionId: string): McpServer {
const server = new McpServer({
name: "memory-server",
version: "1.0.0"
});
// Session-specific state
const sessionMemories = new Map<string, any>();
// Register session-scoped tools
server.registerTool(
"store-memory",
{
title: "Store Memory",
description: "Store a memory in this session",
inputSchema: {
content: z.string()
}
},
async ({ content }) => {
const memoryId = randomUUID();
sessionMemories.set(memoryId, {
content,
sessionId,
timestamp: new Date()
});
return {
content: [{
type: "text",
text: `Memory stored with ID: ${memoryId} in session ${sessionId}`
}]
};
}
);
return server;
}
app.listen(3000, () => {
console.log("MCP StreamableHTTP server listening on port 3000");
});
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3mo ago First seen · 638 lines · 43 tokens per session scan A 7212e1a08e03
mcp-transport-expert is an agent published in the GitHub repository Matt-Dionis/claude-code-configs (619 stars, last pushed 1y ago), licensed MIT. It adds 43 tokens to every session and 3,713 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
mcp-transport-expert compared with agents from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| mcp-transport-expertMatt-Dionis/claude-code-configs | Agent | 619 | 1y ago | MIT | A | 43 | Claude Code |
| php-developerdavepoon/buildwithclaude | Agent | 3.8k | 2d ago | MIT | A | 51 | Claude Code |
| backend-reviewerjeremylongshore/tons-of-skills-marketplace | Agent | 3.0k | yesterday | MIT | A | 36 | Claude Code |
| openai-api-expert0xfurai/claude-code-subagents | Agent | 1.0k | 26d ago | MIT | A | 23 | Claude Code |
| integrations-engineeravelikiy/great_cto | Agent | 117 | 16d ago | MIT | A | 106 | Claude Code |
| gatetonone-ai/tonone | Agent | 85 | 2d ago | MIT | A | 19 | Claude Code |
| broadcasting-agentSofttor/nestjs-hexagonal | Agent | 5 | 17d ago | MIT | A | 58 | Claude Code |