A minimal FastMCP demo with stdio and HTTP transports.
uv syncserver_stdio.py- MCP server (stdio transport), providesaddandsubtracttoolsserver_http.py- MCP server (HTTP transport), providesmultiplytool, supports both SSE (legacy) and Streamable HTTPtest_server.py- Automated tests
| Method | Transport | How it works | Scope | Use case |
|---|---|---|---|---|
| In-memory | Both | Client connects to MCP instance directly in same process | Tool logic | Unit testing, fast CI feedback |
| Subprocess | stdio | Client spawns subprocess, communicates via stdin/stdout | Tool + process + protocol | Integration testing, CI friendly |
| Network | HTTP | Client connects to running server via HTTP | Tool + process + protocol + network | Integration testing, requires running server |
| Claude Code | Both | Real MCP client connects to server | Full integration | End-to-end validation |
# Without HTTP server (in-memory + subprocess)
uv run pytest test_server.py -q -k "not network"
# With Streamable HTTP server (test_http_network)
uv run python server_http.py # in another terminal
uv run pytest test_server.py -q -k "not sse"
# With SSE server (test_sse_network)
uv run python server_http.py --transport sse # in another terminal
uv run pytest test_server.py -qThe project includes .mcp.json (project-level config, only works when Claude Code is launched from this directory) with two server configs:
demo-stdio- Auto-started by Claude Codedemo-http- Requires manually starting the server first
claudeOnce in the session, type /mcp to verify, then test:
Use the add tool to calculate 2 + 3
Start the server first:
# Streamable HTTP (recommended)
uv run python server_http.py
# Or SSE (legacy)
uv run python server_http.py --transport sseThen in Claude Code:
Use the multiply tool to calculate 2 * 3
Codex CLI supports MCP via global config (~/.codex/config.toml). Project-level config is not yet supported (feature request).
codex mcp add demo-stdio -- uv run python server_stdio.py# Start server first
uv run python server_http.py
# Add HTTP server with url parameter
codex mcp add demo-http --url http://localhost:8000/mcpNote: Use --url flag for HTTP servers, not -- with a command. The --url flag tells Codex to connect directly via HTTP.
codex mcp remove demo-stdio
codex mcp remove demo-httpThe project includes .gemini/settings.json (project-level config) with two server configs
Usage is similar to Claude Code and Codex CLI.
| Transport | Endpoint | Claude Code | Codex CLI | Gemini CLI |
|---|---|---|---|---|
| SSE | /sse |
✅ | ❓ | ❓ |
| Streamable HTTP | /mcp |
✅ | ✅ | ✅ |
| Claude Code | Codex CLI | Gemini CLI | |
|---|---|---|---|
| Global config | ~/.claude/settings.json |
~/.codex/config.toml |
~/.gemini/settings.json |
| Project config | .mcp.json |
❌ Not supported | .gemini/settings.json |
| CLI command | claude mcp add |
codex mcp add |
gemini mcp add |
To make MCP servers available to all projects:
claude mcp add demo-stdio -- uv run python server_stdio.pyTo remove:
claude mcp remove demo-stdio