Related MCP Server Resources

Explore more AI models, providers, and integration options:

  • Explore AI Models
  • Explore AI Providers
  • Explore MCP Servers
  • LangDB Pricing
  • Documentation
  • AI Industry Blog
  • Xano MCP Server for Smithery
  • GitHub MCP Server
  • Deriv API MCP Server
  • Phrases MCP Server
  • Image Processor MCP Server
Back to MCP Servers
Python MCP Server Template

Python MCP Server Template

Public
nictuku/py-mcp-server-template

A Python-based Model Context Protocol (MCP) server template enabling seamless integration with applications like Claude Desktop and Cursor, featuring easy setup with uv for virtual environment management and stdio communication.

python
0 tools
May 30, 2025
Updated Jun 4, 2025

Supercharge Your AI with Python MCP Server Template

MCP Server

Unlock the full potential of Python MCP Server Template through LangDB's AI Gateway. Get enterprise-grade security, analytics, and seamless integration with zero configuration.

Unified API Access
Complete Tracing
Instant Setup
Get Started Now

Free tier available • No credit card required

Instant Setup
99.9% Uptime
10,000+Monthly Requests

py-mcp-server-template

This repository is a template to help you create your own MCP (Model Context Protocol) servers in Python. Fork this repository to get started.

Setup with uv

This project uses uv for Python packaging and virtual environment management. If you don't have uv installed, please refer to the official uv installation guide.

  1. Clone your forked repository:

    git clone https://github.com/YOUR_USERNAME/YOUR_REPOSITORY_NAME.git cd YOUR_REPOSITORY_NAME
  2. Create and activate the virtual environment: uv typically creates a .venv directory in your project root.

    uv venv source .venv/bin/activate # On macOS/Linux # .venv\Scripts\activate # On Windows
  3. Install dependencies: This project uses pyproject.toml to manage dependencies.

    uv pip install .

    If you add new dependencies, define them in your pyproject.toml file and run this command again. If you are using a requirements.txt file for some reason, you can install it with uv pip install -r requirements.txt.

Running the Server

The mcp_server.py script starts the MCP server.

To run the server directly:

uv run python mcp_server.py

Integrating with Claude Desktop or Cursor

To use this MCP server with an application like Claude Desktop or Cursor, you'll need to configure it in the application's settings. The configuration will typically involve specifying the command to run your server.

Here's an example configuration snippet. You'll need to replace /ABSOLUTE/PATH/TO/PARENT/FOLDER/YOUR_REPOSITORY_NAME with the actual absolute path to your project directory on your system.

{ "mcpServers": { "my-custom-python-server": { "command": "uv", "args": [ "run", "--python", "/ABSOLUTE/PATH/TO/PARENT/FOLDER/YOUR_REPOSITORY_NAME/.venv/bin/python", "/ABSOLUTE/PATH/TO/PARENT/FOLDER/YOUR_REPOSITORY_NAME/mcp_server.py" ], "workingDirectory": "/ABSOLUTE/PATH/TO/PARENT/FOLDER/YOUR_REPOSITORY_NAME" } } }

Explanation of the configuration:

  • "my-custom-python-server": This is a name you give to your server configuration.
  • "command": "uv": Specifies uv as the command to execute.
  • "args": A list of arguments for the uv command:
    • "run": Tells uv to execute a command within its managed environment.
    • "--python": Specifies the Python interpreter to use. It's important to point this to the Python interpreter inside your uv virtual environment (.venv/bin/python).
    • "/ABSOLUTE/PATH/TO/PARENT/FOLDER/YOUR_REPOSITORY_NAME/mcp_server.py": The absolute path to your server script.
  • "workingDirectory": Specifies the working directory for the server process, which should be your project's root directory.

Important:

  • Ensure the paths in the args and workingDirectory are correct for your system.
  • If the application cannot locate uv, you might need to specify its full path in the "command" field. You can typically find this path by running which uv in your terminal on macOS or Linux, or where uv on Windows.
  • The server listens on stdio by default as configured in mcp_server.py (mcp.run(transport='stdio')), which is typically what applications like Cursor expect.

After configuring, the application should be able to communicate with your Python MCP server.

Publicly Shared Threads0

Discover shared experiences

Shared threads will appear here, showcasing real-world applications and insights from the community. Check back soon for updates!

Share your threads to help others
Related MCPs5
  • Xano MCP Server for Smithery
    Xano MCP Server for Smithery

    Model Context Protocol server enabling seamless integration between Claude AI and Xano databases wit...

    Added May 30, 2025
  • GitHub MCP Server
    GitHub MCP Server

    Enhance Claude Desktop with seamless GitHub integration via Model Context Protocol, enabling natural...

    Added May 30, 2025
  • Deriv API MCP Server
    Deriv API MCP Server

    Model Context Protocol server enabling seamless interaction with the Deriv API to retrieve active tr...

    2 tools
    Added May 30, 2025
  • Phrases MCP Server
    Phrases MCP Server

    Efficient MCP (Model Context Protocol) server for managing inspirational phrases with full CRUD capa...

    6 tools
    Added May 30, 2025
  • Image Processor MCP Server
    Image Processor MCP Server

    A TypeScript-based Model Context Protocol server enabling creation, access, and summarization of tex...

    2 tools
    Added May 30, 2025