Reference Servers · MODEL CONTEXT PROTOCOL
jhj0517 mcp python tutorial
Tutorial App For MCP
连接能力
jhj0517 mcp python tutorial 为 AI Agent 提供什么
来源目录未提供结构化功能列表,请在使用前阅读源仓库文档。
安全
MCP 收录不等于安全审核
MCP 服务器可能获得模型上下文、凭据、本地文件或调用外部系统的权限。连接 Agent 前,请检查代码、环境变量、网络行为、软件包来源与维护状态。
README
仓库文档
Tutorial app for MCP in Python with simple local DB with mocking data
To install Python MCP Tutorial Server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @jhj0517/mcp-python-tutorial --client claude- 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.
This tutorial app demonstrates core MCP concepts.
You can check annotation-per-role in tutorial_app/mcp_server.py:
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
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
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
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
uvto 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:
- Locate or create the
claude_desktop_config.jsonfile. 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
mcpServersattribute 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.
This separation of concerns is better than implementing everything in a single MCP server.
- Restart Claude Desktop.
社区