Skip to main content
Glama
jhj0517

MCP Python Tutorial

by jhj0517

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:

npx -y @smithery/cli install @jhj0517/mcp-python-tutorial --client claude

Manual Installation

  1. Clone this repository

  2. Install dependencies:

pip install -r requirements.txt
  1. Run MCP server as dev mode:

mcp dev localdb_app.py
  1. Default port for MCP server is 5173. Access to http://localhost:5173.

Related MCP server: Basic MCP Server

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 users

  • users://{user_id}/profile - Get a user's profile

  • posts://all - Get all posts

  • posts://{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 user

  • create_post - Create a new post

  • search_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 profile

  • post_feedback - Interactive prompt for post feedback

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.

  1. Claude Desktop uses uv to install MCP server dependencies. First, install uv:

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
  1. Install MCP server dependencies using uv:

# Create virtual environment and activate it
uv venv
.venv\Scripts\activate

uv pip install -r requirements.txt
  1. Download Claude Desktop from:

  1. 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
  1. Add the mcpServers attribute to your claude_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.

  1. Restart Claude Desktop.

F
license - not found
-
quality - not tested
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    C
    quality
    D
    maintenance
    A demonstration server that showcases how to collect user input dynamically using the Model Context Protocol (MCP) elicitation system across tools, resources, and prompts.
    Last updated
    10
    57,880
    Inno Setup
  • A
    license
    -
    quality
    D
    maintenance
    A minimal demonstration server showcasing MCP protocol capabilities including tools, resources, and prompts with basic examples like hello world functionality.
    Last updated
    4
    MIT
  • F
    license
    -
    quality
    D
    maintenance
    A demonstration MCP server showcasing the xmcp framework's structured approach to defining tools, prompts, and resources with automatic discovery from their respective directories.
    Last updated
  • F
    license
    -
    quality
    D
    maintenance
    A Python-based MCP server demonstrating tools for math calculations, time retrieval, and echo messages, along with resources and prompt templates.
    Last updated

View all related MCP servers

Related MCP Connectors

  • MCP server for generating rough-draft project plans from natural-language prompts.

  • A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…

  • Markdown-first MCP server for Notion API with 8 composite tools and 39 actions.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jhj0517/mcp-python-tutorial'

If you have feedback or need assistance with the MCP directory API, please join our Discord server