Skip to main content
Glama
brainupgrade-in

minimal-mcp-http

README.md
# minimal-mcp-http

A minimal [Model Context Protocol](https://modelcontextprotocol.io) server over
**Streamable HTTP** (spec `2025-11-25`) in **one stdlib-only Python file** — no
`pip install`, no framework. Built as a starter for the Amazon AppDev 2026 Alexa+
track, useful anywhere you need a spec-shaped MCP endpoint for demos and judging.

## Run
```bash
python3 minimal_mcp_server.py --port 8000
python3 -m unittest discover -s . -p "test_*.py"
```

## Protocol subset
Single `POST /mcp` endpoint: `initialize` → `MCP-Session-Id` → `tools/list` →
`tools/call` (+ `ping`). `GET` returns `405` (spec-allowed when no SSE stream is
offered). Origin validation (`403` on mismatch) and `MCP-Protocol-Version`
enforcement (`400` on mismatch) included.

## Add your own tool
```python
def _hello(name="world"):
    return {"greeting": f"hello {name}"}

TOOLS["hello"] = (
    {"name": "hello", "description": "...",
     "inputSchema": {"type": "object", "properties": {"name": {"type": "string"}}}},
    _hello,
)
```

## License
MIT — see `LICENSE`.