Demo-MCP
A minimal Model Context Protocol server exposing arithmetic, time, and note-taking tools over streamable HTTP, with in-memory state and Docker support.
README
Demo-MCP
A minimal Model Context Protocol server in Python, served over streamable HTTP from a Docker container.
What it exposes
| Kind | Name | Purpose |
|---|---|---|
| tool | add(a, b) |
adds two numbers |
| tool | server_time() |
UTC time from inside the container |
| tool | save_note(title, body) |
writes to an in-memory store |
| tool | list_notes() |
lists saved note titles |
| resource | note://{title} |
reads a saved note |
| prompt | summarize_note(title) |
prompt template over a note |
State lives in process memory, so it resets whenever the container restarts.
Setup
The server requires a shared bearer token. Generate one and put it in .env:
make token # prints a random token
cp .env.example .env
# paste the token as MCP_AUTH_TOKEN in .env
docker compose reads .env automatically, so make up picks it up with no extra flags.
Run it
docker compose up --build
The endpoint is http://localhost:8000/mcp.
While iterating on server.py, this reloads the container on save:
docker compose watch
Connect from another Claude Code session
claude mcp add --transport http demo-mcp http://localhost:8000/mcp \
--header "Authorization: Bearer $MCP_AUTH_TOKEN"
Then in that session, /mcp lists the connection and the tools show up as mcp__demo-mcp__add, etc.
To remove it later:
claude mcp remove demo-mcp
Adding a tool
Add a decorated function in server.py — the type hints become the input schema and the docstring becomes the tool description, so both matter to the calling model:
@mcp.tool()
def word_count(text: str) -> int:
"""Count whitespace-separated words in the given text."""
return len(text.split())
Async functions work too, and adding a ctx: Context parameter gives you await ctx.info(...) for logging back to the client and await ctx.report_progress(...) for long operations. The parameter is injected by the SDK and is not part of the tool's schema.
Makefile
Wraps the commands above. Run make (or make help) to list targets.
| Target | Does |
|---|---|
help |
List targets (default) |
build |
docker compose build |
up |
Build and start the container in the background |
down |
Stop and remove the container |
restart |
down then up |
logs |
Follow container logs |
ps |
Show container status |
watch |
docker compose watch — live reload on server.py edits |
shell |
Shell into the running container |
health |
Smoke-check /mcp responds, with the bearer token attached |
health-unauth |
Same, without a token — expect 401 |
token |
Generate a random value for MCP_AUTH_TOKEN |
env |
Create .env with a generated MCP_AUTH_TOKEN if one doesn't exist yet (used by CI) |
register |
claude mcp add --transport http demo-mcp http://localhost:8000/mcp --header "Authorization: Bearer $MCP_AUTH_TOKEN" |
unregister |
claude mcp remove demo-mcp |
clean |
docker compose down -v --rmi local |
Releasing
Commits follow Conventional Commits: feat: bumps the minor version, fix:/perf: bumps patch, and a ! or BREAKING CHANGE: footer bumps major (minor, while the project is still 0.x). Merging to main runs python-semantic-release automatically — it computes the next version from commit history, updates pyproject.toml and __version__ in server.py, tags the commit, generates CHANGELOG.md, and publishes a GitHub Release. PRs are squash-merged, so the PR title is what gets parsed — it must itself be a valid Conventional Commit, and CI lints it.
Notes
- The server binds
0.0.0.0inside the container so Docker can publish the port; only8000on the host is exposed. - Auth is a single shared static bearer token (
MCP_AUTH_TOKEN), not OAuth. There's no rotation and no per-client identity — everyone holding the token isdemo-client. Theissuer_urlset inserver.pyis a placeholder; no authorization server actually runs. This is appropriate for a localhost demo only — keep the published port off any untrusted network, and note there's no TLS, so the token is exposed to anything on the network path. server.pyimportsMCPServerwith a fallback toFastMCP, the SDK's older name for the same class, so it builds against either release line.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.