Get the FREE Ultimate OpenClaw Setup Guide →

py -template

Fork this to create a working server in Python

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio nictuku-py-mcp-server-template uv run --python /ABSOLUTE/PATH/TO/PARENT/FOLDER/YOUR_REPOSITORY_NAME/.venv/bin/python /ABSOLUTE/PATH/TO/PARENT/FOLDER/YOUR_REPOSITORY_NAME/mcp_server.py

How to use

This MCP server template provides a Python-based MCP server built with uv for packaging and virtual environment management. The server is started via uv run, which executes mcp_server.py inside the project’s virtual environment. Once running, the server communicates over stdio in line with MCP protocol expectations, allowing clients such as Claude Desktop or Cursor to connect and issue MCP commands. You can customize the server behavior by editing mcp_server.py and related modules, and you can point your integration’s configuration to the absolute path of your repository to ensure the correct Python interpreter and server script are used.

How to install

Prerequisites:

  • Python installed on your system
  • uv Python packaging tool installed (see uv installation guide)
  • A Git repository for the MCP server (forked from this template)

Setup steps:

  1. Clone your forked repository and navigate into it
git clone https://github.com/YOUR_USERNAME/YOUR_REPOSITORY_NAME.git
cd YOUR_REPOSITORY_NAME
  1. Ensure uv is installed and available in your PATH. If needed, install uv according to the official guide.
  2. Create and activate a Python virtual environment managed by uv
uv venv
# Activate the venv (example for macOS/Linux)
source .venv/bin/activate
# On Windows use: .venv\Scripts\activate
  1. Install project dependencies (the project is configured with pyproject.toml)
uv pip install .
  1. Run the MCP server directly to test
uv run python mcp_server.py
  1. To integrate with tools like Claude Desktop or Cursor, configure the MCP server in your tool using the template's example configuration, replacing absolute paths with your actual repository path and ensuring the virtual environment Python interpreter path is correct.

Additional notes

Tips and common considerations:

  • Ensure the virtual environment path in your integration configuration points to your repository’s .venv (or the equivalent uv-managed environment).
  • If uv is not found in your shell, you may need to specify the full path to the uv executable in the command field.
  • The MCP server listens on stdio by default; verify that your client configuration expects stdio transport.
  • When moving the repository, update the absolute paths in the integration configuration to reflect the new location.
  • If you add new dependencies, run uv pip install . again to update the environment.
  • Keep mcp_server.py and related modules under version control to track changes to MCP behaviors.

Related MCP Servers

Sponsor this space

Reach thousands of developers