This post is about creating a simple local setup to understand MCP hands-on
The Flow
The LLM is the brain, the agent is the worker, MCP is a standard adapter, and the queried system is the actual tool being plugged in — but the brain never talks to MCP directly, only through the worker.
Breaking it down:
- LLM = the brain that reasons and decides what needs to happen
- Agent = the worker that carries out actions using that brain's decisions
- MCP server = a universal adapter/socket that lets the worker plug into any tool without custom wiring for each one
- The queried thing (database, calendar, GitHub, etc.) = the actual appliance behind that socket
Don't talk, show
Lets build the entire system on local system
1. Run the model locally
ollama start
ollama run llama3.2:1b
ollama show llama3.2:1b
Model
architecture llama
parameters 1.2B
context length 131072
embedding length 2048
quantization Q8_0
Capabilities
completion
tools
License
LLAMA 3.2 COMMUNITY LICENSE AGREEMENT
Llama 3.2 Version Release Date: September 25, 2024
curl http://localhost:11434/api/ps
{"models":[{"name":"llama3.2:1b","model":"llama3.2:1b","size":1510389841,"digest":"baf6a787fdffd633537aa2eb51cfd54cb93ff08e28040095462bb63daf552878","details":{"parent_model":"","format":"gguf","family":"llama","families":["llama"],"parameter_size":"1.2B","quantization_level":"Q8_0"},"expires_at":"2026-07-30T13:26:33.201017+05:30","size_vram":1510389841,"context_length":4096}]}
2. Setting up an agent
2.1 Creating a python env
pyenv local 3.12.0
python3 --version
Python 3.12.0
2.2 Creating python venv for installing agent
python -m venv venv
source venv/bin/activate
3. Running a MCP server with help of docker which helps to expose our simple notes. This is the location where MCP comes to know about our stuff
docker build -t mcp-notes-server .
docker run -d \
--name mcp-notes \
-p 8765:8765 \
-v $(pwd)/notes.txt:/data/notes.txt \
mcp-notes-server
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9d5c24e619ad mcp-notes-server "python mcp_server.py" 28 seconds ago Up 27 seconds 0.0.0.0:8765->8765/tcp, [::]:8765->8765/tcp mcp-notes
4 Running a basic python agent - (Important)
python agent.py
4.1 Agent is up and running waiting for input
Agent with MCP (Docker) tool access. Type 'exit' to quit.
[MCP] Connected to container. Available tools: ['read_notes']
You:
The Verdict
Here we prompt the model asking about our notes using the tool exposed by the MCP server
Agent with MCP (Docker) tool access. Type 'exit' to quit.
[MCP] Connected to container. Available tools: ['read_notes']
You: Can you check whats in my notes using the tools read_notes
Agent:
[AGENT] Sending request to Ollama at 22:47:54.174
TOOL_CALL: read_notes
[MCP] Model requested tool call: read_notes
[MCP] Tool result:
Meeting with Sarah at 3pm.
Buy groceries: eggs, milk, bread.
Finish the agent project this week.
Added few more comments to test notes
Agent:
[AGENT] Sending request to Ollama at 22:47:54.360
You need help organizing your tasks and reminders in your local notes.txt file?
You:
Key Point
The python agent created above talks to ollama which is hosted locally. The ollama becomes aware about mcp because the config is saved in agent.py
Key Point - OLLAMA_URL = "http://localhost:11434/api/chat" (agents.py)

Top comments (0)