
MCP Python Tutorial
A demonstration server showing MCP implementation in Python with resource handling, tool operations, and reusable prompts for a simple user/post system with local database.
README
MCP Python Tutorial
Tutorial app for MCP in Python with simple local DB with mocking data
Installation & Run
- Clone this repository
- Install dependencies:
pip install -r requirements.txt
- Run MCP server as dev mode:
mcp dev localdb_app.py
- Default port for MCP server is
5173
. Access tohttp://localhost:5173
.
MCP Features
This tutorial app demonstrates core MCP concepts.<br> You can check annotation-per-role in tutorial_app/mcp_server.py:
@mcp.resource
Basically, this annotation is about the agent "getting" the resource, just like GET
in the RESTAPI.
users://all
- Get all usersusers://{user_id}/profile
- Get a user's profileposts://all
- Get all postsposts://{post_id}
- Get a post by ID
@mcp.tool
This is about the agent "generating" the new resource, just like POST
in the RESTAPI.
create_user
- Create a new usercreate_post
- Create a new postsearch_posts
- Search posts by title or content
@mcp.prompt
This is just a reusable template to interact with LLM conveniently.
user_profile_analysis
- Generate analysis of a user's profilepost_feedback
- Interactive prompt for post feedback
[!NOTE] For more annotations, please read : https://github.com/modelcontextprotocol/python-sdk?tab=readme-ov-file#core-concepts
Connecting to Client
Once you've set up the MCP server, you need an LLM client that will use your MCP server to build your agent. The following guide will help you connect with Claude Desktop as your client.
- Claude Desktop uses
uv
to install MCP server dependencies. First, installuv
:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
- Install MCP server dependencies using
uv
:
# Create virtual environment and activate it
uv venv
.venv\Scripts\activate
uv pip install -r requirements.txt
- Download Claude Desktop from:
- https://claude.ai/download
- Locate or create the
claude_desktop_config.json
file. The location varies by OS:
- Windows:
C:\Users\%USER%\AppData\Roaming\Claude\claude_desktop_config.json
- MacOS/Linux:
~/Library/Application\ Support/Claude/claude_desktop_config.json
- Add the
mcpServers
attribute to yourclaude_desktop_config.json
:
{
"mcpServers": {
"local_db": {
"command": "uv",
"args": [
"--directory",
"/ABSOLUTE/PATH/TO/PARENT/FOLDER/weather",
"run",
"localdb_app.py"
]
}
}
}
Note: You can deploy multiple MCP servers, each with its own dedicated concerns and expertise. <br> This separation of concerns is better than implementing everything in a single MCP server.
- Restart Claude Desktop.
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.