Helps choose and implement MCP transports: stdio for local processes, Streamable HTTP for remote servers, SSE for legacy. Covers reconnection, backpressure, and session handling.
Ships in mcp-mastery. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Pick the right transport and the rest of your server design follows.
| Transport | Use when | Pros | Cons |
|---|---|---|---|
| stdio | Local tools, CLI integrations, single-user | Zero network, trusted process, simplest | Only local; one client per server process |
| Streamable HTTP | Remote multi-user servers | Bidirectional, resumable, load-balanceable | More complex; requires session layer |
| SSE (legacy) | Existing deployments | — | Deprecated; migrate to Streamable HTTP |
Server reads from stdin, writes JSON-RPC to stdout, logs to stderr. Client spawns the process.
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
const transport = new StdioServerTransport();
await server.connect(transport);
Critical rule: never write non-JSON to stdout. console.log breaks the protocol. Use console.error for logs.
// BAD
console.log("Server started"); // corrupts protocol stream
// GOOD
console.error("Server started");
Single HTTP endpoint handles all methods. Server pushes messages via SSE on long-lived GET, receives messages via POST, supports resumable sessions via Mcp-Session-Id header.
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
import express from "express";
const app = express();
app.use(express.json());
const transports = new Map<string, StreamableHTTPServerTransport>();
app.all("/mcp", async (req, res) => {
const sessionId = req.headers["mcp-session-id"] as string | undefined;
let transport = sessionId ? transports.get(sessionId) : undefined;
if (!transport) {
transport = new StreamableHTTPServerTransport({
sessionIdGenerator: () => crypto.randomUUID(),
onsessioninitialized: (id) => transports.set(id, transport!),
});
await server.connect(transport);
}
await transport.handleRequest(req, res, req.body);
});
app.listen(3000);
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
const transport = new StreamableHTTPClientTransport(new URL("https://mcp.example.com/mcp"));
await client.connect(transport);
initialize without session headerMcp-Session-Id response headerMcp-Session-Id on every subsequent requestDELETE /mcp + session headerLong-lived SSE stream may drop (proxy timeouts, NAT rebinding). Client reconnects with Last-Event-ID and the server replays missed messages from a per-session buffer:
new StreamableHTTPServerTransport({
sessionIdGenerator: () => crypto.randomUUID(),
enableJsonResponse: false,
eventStore: new RedisEventStore({ ttlSeconds: 3600 }), // custom
});
If you skip the event store, reconnects lose in-flight tool results. Fine for dev, bad for production.
Multi-instance deployments must share session state. Options:
transports map and event storeMcp-Session-Id to a pod)Never round-robin with in-memory session state — clients will randomly land on the wrong pod and see "session not found".
Streamable HTTP lets the server push many messages to the client. If the client is slow:
progress/cancelled notification and drop the requestOld SSE used two endpoints (/sse for events, /messages for POST). The new transport unifies them at one endpoint:
POST /mcp → request
GET /mcp → open SSE stream for server→client
DELETE /mcp → end session
Migration: run both in parallel for a release, redirect SSE clients to the new endpoint, then remove old routes. The MCP SDK's StreamableHTTPClientTransport auto-negotiates.
console.log, print, debug libsres.flush() or use X-Accel-Buffering: noproxy_read_timeout ≥ 60s) for SSEWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/mcp-mastery:mcp-transport-stdio-httpfrom mcp-mastery
npx claudepluginhub latestaiagents/agent-skills --plugin mcp-mastery7 skills in this plugin
/mcp-auth-oauthImplement OAuth 2.1 + PKCE authentication for remote MCP servers, including dynamic client registration, token refresh, and scope design. Covers the 2025 MCP auth spec that Claude Desktop, Claude Code, and ChatGPT use.
Use this skill when building a remote MCP server that needs per-user auth, debugging OAuth flows for MCP, or migrating a bearer-token MCP server to OAuth.
Activate when: MCP OAuth, remote MCP auth, MCP authorization, PKCE, dynamic client registration, MCP 401.
/mcp-client-integrationConnect MCP servers to AI clients — Claude Desktop, Claude Code, Cursor, the Claude Agent SDK, and custom apps — including config file locations, auth, and debugging connection failures.
Use this skill when the user wants to wire an MCP server into a client, troubleshoot "server not connecting" errors, or build a custom MCP client with the SDK.
Activate when: MCP client, mcp.json, claude_desktop_config.json, connect MCP, MCP not working, list MCP tools, programmatic MCP client.
/mcp-resource-patternsUse MCP Resources correctly — the read-only, URI-addressable data primitive — and know when to pick resources, tools, or prompts. Covers templated URIs, subscriptions, and common mistakes.
Use this skill when designing MCP servers that expose data, deciding between tool vs resource, or implementing resource subscriptions for live data.
Activate when: MCP resource, resource template, resource vs tool, subscribe resource, MCP URI schema.
/mcp-security-sandboxingSecure MCP servers against prompt injection, tool abuse, excessive permission, and data exfiltration. Covers per-tool scopes, rate limiting, audit logging, and sandbox patterns for shell-adjacent tools.
Use this skill when deploying an MCP server to production, handling untrusted agents, or reviewing an MCP server for security issues.
Activate when: MCP security, MCP prompt injection, tool sandbox, MCP audit log, MCP rate limit, tool abuse, MCP threat model.
/mcp-server-authoringBuild production-quality MCP (Model Context Protocol) servers that expose tools, resources, and prompts to AI clients like Claude Desktop, Claude Code, Cursor, and the Claude Agent SDK.
Use this skill when the user wants to build an MCP server, expose internal tooling to an AI agent, wrap an API for agents, or publish a reusable MCP server to a registry.
Activate when: MCP server, Model Context Protocol, expose tools to Claude, @modelcontextprotocol/sdk, mcp.json, stdio server, HTTP MCP server.
/mcp-tool-designDesign MCP tool schemas, names, and descriptions that AI agents actually pick correctly and use without hand-holding. Covers the anti-patterns that make agents loop, pick wrong tools, or hallucinate arguments.
Use this skill when designing or reviewing MCP tools, debugging "the agent isn't using my tool", or pruning a bloated tool surface.
Activate when: MCP tool design, tool description, agent picks wrong tool, too many tools, tool schema, tool naming.
2 plugins in one repository ship this exact skill · first indexed Oct 20, 2026
Other plugins' skills for the same job