My First MCP
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@My First MCPsummarize report.txt and compare it to spec.md"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
My First MCP
A learning project to understand the Model Context Protocol (MCP) — tools, resources, and prompts — by building a CLI chatbot that talks to documents.
Project Structure
├── core/
│ ├── __init__.py
│ └── documents.py # Mock document store with Pydantic models
├── mcp_server.py # MCP Server — tools, resources, and prompts
├── mcp_client.py # MCP Client — test all three primitives directly
├── main.py # CLI Chatbot — Claude agent with /commands
├── requirements.txt
├── .env # Your API key (git-ignored, never committed)
├── .gitignore
└── README.mdRelated MCP server: DocumentMCP Server
How the pieces connect
User → main.py (CLI Chatbot) → Claude API
↕ ↕
MCP Client "Use read_doc tool"
↕
MCP Server (mcp_server.py, spawned as subprocess)
↕
core/documents.py (Pydantic models + mock data)Setup
python -m venv .venv
source .venv/bin/activate # macOS/Linux
# .venv\Scripts\activate # Windows
pip install -r requirements.txtAdd your API key to .env:
ANTHROPIC_API_KEY=sk-ant-...Running
1. Test the server with MCP Inspector (no code needed):
mcp dev mcp_server.pyOpens a browser UI where you can browse tools/resources/prompts and call them interactively.
2. Test the client directly (no AI):
python mcp_client.py3. Run the chatbot:
python main.pyStep-by-Step Development Roadmap
Work through these in order. Each step builds on the last.
Phase 1: Understand the Server (mcp_server.py)
Run the server in MCP Inspector (
mcp dev mcp_server.py). Click around the Tools tab. Callread_docwith different document names. Call it with a name that doesn't exist — observe the error format.Add the
list_docstool. You have the function incore/documents.pyalready. Register it with@mcp.tool(). Restart the inspector and verify it appears.Uncomment and test resources in
mcp_client.py. Read thedocs://listresource. Then add individual document resources using a URI template (docs://{doc_name}) on the server. Resources are the "browse" side of MCP vs tools being the "do" side.Uncomment and test prompts in
mcp_client.py. Callget_prompt("summarize_doc", ...)and look at what comes back — it's a message structure, not a raw string. Add acompare_docsprompt that takes two document names.
Phase 2: Understand the Client (mcp_client.py)
Trace the lifecycle. Add print statements at each stage: connection, initialize handshake, list_tools, call_tool. Understand the
ClientSessionobject — it's your handle to everything.Call update_doc then read_doc. Verify state changes persist within a session. Think about why they DON'T persist across sessions (the server restarts).
Try error cases. Call a tool with wrong argument types. Call a non-existent tool. Read a non-existent resource URI. Understand how MCP surfaces errors.
Phase 3: Build the Agent Loop (main.py)
Study
agent_turn(). This is the heart of every AI agent. The loop is: send to Claude → check if it wants a tool → call the tool via MCP → feed result back → repeat. Trace through it with a simple prompt like "what's in report.txt?"Study
handle_slash_command(). See how MCP prompts become/commands. The server defines the templates, the client presents them. Try/summarize_doc spec.mdand watch the prompt get fetched from the server, sent to Claude, which then calls theread_doctool.Add multi-turn awareness. Currently the chatbot maintains history. Try "what's in report.txt?" then "now update it with a new section" — observe how Claude uses context from prior turns.
Phase 4: Extend It (your own features)
Add a
compare_docsprompt on the server that takes two document names. Wire it into the chatbot as/compare_docs. Think about how to parse multiple arguments from one string.Add resource templates for individual documents (
docs://{doc_name}). Then in the chatbot, add a/browsecommand that lists resources and lets you read one.Add a
search_docstool that takes a query string and searches document contents. This is a good exercise in writing tool descriptions that help Claude understand when to use it vsread_doc.Think about what's missing for production: persistent storage, authentication, error handling, rate limiting, logging. You don't need to build these — just note where they'd go.
Phase 5: Ship It
Double-check
.gitignore— make sure.envand.venv/are listed. Rungit statusbefore committing to verify no secrets leak.Init the repo and push:
git init
git add .
git commit -m "Initial commit: MCP learning project"
git remote add origin <your-github-url>
git push -u origin mainThis server cannot be deployed
Maintenance
Related MCP Connectors
Versioned documentation registry and semantic search for AI tools and coding assistants.
Read, edit and improve shared documents and knowledge with people and agents.
Ingest, manage, and retrieve documents for RAG-powered AI applications
One place for every AI agent's pages and docs: versioned links to share, search and update.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceExposes a document store over MCP tools, resources, and prompts for reading, editing, summarizing, and formatting documents in a chat interface.-
- FlicenseNot gradedqualityBmaintenanceEnables LLMs to read and edit mock documents through custom MCP tools, resources, and prompts, allowing natural-language queries and modifications to document contents.-
- FlicenseNot gradedqualityAmaintenanceEnables AI agents to search, read, and update a document workspace's knowledge through tools, prompts, and resources, either hosted or self-hosted.-
- FlicenseNot gradedqualityAmaintenanceEnables AI agents to search, read, update, and batch-manage persistent documents and workspace knowledge through MCP tools, prompts, and resources.-