Provides functionality for managing user profiles, creating and searching posts, and analyzing user data through a simple Python implementation with a local database.
MCP Python Tutorial
Tutorial app for MCP in Python with simple local DB with mocking data
Installation & Run
Installing via Smithery
To install Python MCP Tutorial Server for Claude Desktop automatically via Smithery:
Manual Installation
- Clone this repository
- Install dependencies:
- Run MCP server as dev mode:
- Default port for MCP server is
5173
. Access tohttp://localhost:5173
.
MCP Features
This tutorial app demonstrates core MCP concepts. 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
:
- Install MCP server dependencies using
uv
:
- Download Claude Desktop from:
- Locate or create the
claude_desktop_config.json
file. The location varies by OS:
- Windows:
- MacOS/Linux:
- Add the
mcpServers
attribute to yourclaude_desktop_config.json
:
Note: You can deploy multiple MCP servers, each with its own dedicated concerns and expertise. This separation of concerns is better than implementing everything in a single MCP server.
- Restart Claude Desktop.
This server cannot be installed
local-only server
The server can only run on the client's local machine because it depends on local resources.
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.
Related MCP Servers
- -securityFlicense-qualityThis is an MCP server that facilitates building tools for interacting with various APIs and workflows, supporting Python-based development with potential for customizable prompts and user configurations.Last updated -Python
- AsecurityAlicenseAqualityA server that provides a persistent Python REPL environment through the MCP protocol, allowing execution of Python code, variable management, and package installation.Last updated -324PythonMIT License
- -securityFlicense-qualityA Python-based server that helps users easily install and configure other MCP servers across different platforms.Last updated -2Python
- -securityAlicense-qualityA template repository for creating custom Model Context Protocol (MCP) servers in Python that can be integrated with applications like Claude Desktop or Cursor.Last updated -5PythonMIT License