gcordova17

Example MCP Server (Streamable HTTP)

Community gcordova17
Updated

MCP server HTTP instal in docker with compose

Example MCP Server (Streamable HTTP)

A minimal MCP server built on the official Python SDK (mcp==2.0.0), runningover Streamable HTTP so it can live in a container and be reached over thenetwork.

It ships with two demo tools (echo, add) and one resource (time://now)so you have something to test against immediately — replace them with yourown.

Run it

docker compose up -d --build
docker compose logs -f mcp-server

The server listens on http://localhost:8000/mcp.

Test it without a client

curl -i -X POST http://localhost:8000/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"test","version":"0.1"}}}'

The response headers include mcp-session-id — reuse it in anMcp-Session-Id header on subsequent calls (tools/list, tools/call,resources/read, etc.) once you've sent a notifications/initializedmessage.

Point a client at it

Any MCP client that supports Streamable HTTP just needs the URL:http://localhost:8000/mcp (or your host's address/port if not runninglocally).

Add your own tools

@mcp.tool()
def my_tool(arg: str) -> str:
    """This docstring becomes the tool description the model sees."""
    return do_something(arg)

Resources (@mcp.resource("scheme://path")) and prompts (@mcp.prompt())follow the same pattern. Restart the container after changes:

docker compose up -d --build

Notes

  • MCP_HOST / MCP_PORT env vars control what the server binds to insidethe container — leave MCP_HOST=0.0.0.0 or it won't be reachable fromoutside the container.
  • This has no authentication. Fine for local/dev use behindlocalhost:8000; if you expose it beyond your machine, put it behind areverse proxy or gateway that handles auth (or use the SDK's built-inOAuth support via token_verifier/auth_server_provider).
  • The old from mcp.server.fastmcp import FastMCP import path sometutorials still show is gone as of mcp==2.0.0 — it's nowfrom mcp.server import MCPServer.

MCP Server · Populars

MCP Server · New

    DROOdotFOO

    Raxol

    Write one app, render it to a terminal, a browser, or as agent tools. The terminal for your Gundam.

    Community DROOdotFOO
    morluto

    REA: Reverse Engineer Anything

    Reverse engineer anything with agents, from app behavior down to native binaries.

    Community morluto
    nedlir

    MCPwner

    Model Context Protocol server for autonomous vulnerability discovery

    Community nedlir
    codegraph-ai

    CodeGraph

    CodeGraph builds a semantic graph of your codebase — functions, classes, imports, call chains — and exposes it through 42 MCP tools, 38 languages, a VS Code extension, and a persistent memory layer. AI agents get structured code understanding instead of grepping through files.

    Community codegraph-ai
    getArbor-dev

    Arbor

    Graph-native code intelligence that replaces embedding-based RAG with deterministic program understanding.

    Community getArbor-dev