MCP-Demo
A minimal Python MCP server that enables Claude Code to call local Ollama models (e.g., gemma3) as a tool, routing low-stakes work off the API and onto a homelab.
README
mcp-demo
A minimal Python MCP server, built in phases so each commit teaches one concept. End state: Claude Code can call local Ollama models (gemma3:4b / 3:12b) as a tool, routing low-stakes work off the API and onto the homelab.
What is MCP, really?
Model Context Protocol is a standardized JSON-RPC 2.0 protocol that lets an LLM client (Claude Code, Claude Desktop, Cursor) discover and invoke tools, fetch resources, and load prompt templates from separate processes called MCP servers. MCP is to LLM tooling what LSP is to IDE language support: one protocol, many interoperable implementations.
The moving pieces
┌───────────────────┐ stdio / HTTP ┌──────────────────┐
│ MCP Client │ ◄──JSON-RPC──► │ MCP Server │
│ (Claude Code) │ │ (this repo) │
└───────────────────┘ └──────────────────┘
│ │
│ spawns as child │ hits
│ process (stdio) │ localhost:11434
▼ ▼
your shell env Ollama / gemma3
- Client — embedded in the LLM app
- Server — any process that speaks MCP
- Transport —
stdio(client spawns server as child, pipes JSON-RPC) orstreamable-http(server is a web service). This repo uses stdio.
Three primitives an MCP server exposes
| Primitive | What it is | This repo's use |
|---|---|---|
| Tools | Functions the LLM can call | echo, ollama_ask, get_weather |
| Resources | Read-only blobs the client can fetch | ollama://models (list pulled models) |
| Prompts | Pre-canned prompt templates | (not used — kept minimal) |
Phase progression
Each phase is one commit — git log shows the evolution.
- ✅ scaffold — pyproject, README, .gitignore.
- ✅ hello-world server — one
echotool + smoke-test client. Proves the full lifecycle: client spawn → handshake → tool discovery → tool call. - ✅ ollama_ask tool — async tool that POSTs to
localhost:11434/api/generateand returns Gemma's reply. - ✅ polish — adds
systemparameter toollama_askand exposes a resource atollama://models(list of pulled models). - ✅ grounding contrast — adds
get_weather(hits NWS api.weather.gov). The point isn't the weather — it's thatollama_askhallucinates current facts whileget_weatherreturns live data. Same MCP primitive (a tool), completely different epistemic status. This is the difference between an LLM guessing and an agent.
Install & run
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
# Phase 2+ only: run the server by hand to smoke-test
python -m mcp_demo.server
The server reads JSON-RPC off stdin and writes to stdout — if you run it directly in a terminal it will just sit there waiting for input. That's expected. The client (Claude Code) is what actually feeds it.
Registering with Claude Code
MCP servers live in ~/.claude.json (not settings.json — that schema rejects
the mcpServers key). The supported path is the claude CLI:
claude mcp add mcp-demo /home/booty/mcp-demo/.venv/bin/python -- -m mcp_demo.server
That writes an entry like this into ~/.claude.json:
"mcp-demo": {
"type": "stdio",
"command": "/home/booty/mcp-demo/.venv/bin/python",
"args": ["-m", "mcp_demo.server"]
}
Restart Claude Code. Tools appear as mcp__mcp-demo__<tool_name> and the
resource as ollama://models.
Further reading
- Spec: https://modelcontextprotocol.io/specification
- Python SDK: https://github.com/modelcontextprotocol/python-sdk
- Inspector (a debug UI for poking at any MCP server):
npx @modelcontextprotocol/inspector
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
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
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.