Get the FREE Ultimate OpenClaw Setup Guide →

create-python

Create a Python MCP server

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio modelcontextprotocol-create-python-server python -m my_server

How to use

This MCP server project is generated by the Create MCP Server tool for Python-based MCP implementations. It scaffolds a minimal MCP server project using the Model Context Protocol Python SDK and provides a ready-to-run structure without manual dependency setup. The resulting project includes a standard package layout under src/, including a package (e.g., my_server) with an init.py, main.py, and server.py, allowing you to run the server with a simple Python invocation. You can start the server after creating a project by running the provided UV commands (uv sync and uv run) from the project directory, which ensures the project dependencies are installed and the server loop is started according to MCP conventions. The server leverages the MCP Python SDK to implement context handling, data exchange, and protocol features defined by MCP.

How to install

Prerequisites:

  • Python 3.8+ and pip installed on your system.
  • UV (optional, recommended for project orchestration and development workflow): https://docs.astral.sh/uv/

Installation steps:

  1. Install the code generator for MCP servers (Choose one):

    • Using pip: pip install create-mcp-server
    • Or using UV (recommended): uvx install create-mcp-server
  2. Create a new MCP server project:

    • Using UV: uvx create-mcp-server
    • Or using pip: create-mcp-server
  3. Change into the newly created project directory (e.g., my-server).

  4. Install dependencies and start development workflow (UV example): uv sync --dev --all-extras uv run my-server

  5. The server will start, using the MCP Python SDK to handle Model Context Protocol interactions. You can customize src/my_server/server.py and related files as needed for your context models and endpoints.

Additional notes

Tips and considerations:

  • The generated project uses the MCP Python SDK; refer to its documentation for available context types and handlers.
  • No manual configuration is required to start; the scaffolding follows standard Python packaging practices and MCP server patterns.
  • If you use UV, you can leverage uv sync to install dependencies and uv run to start the server with development extras.
  • Environment variables are not strictly required by default, but you may add them for configuration (e.g., API keys, endpoints) in a .env file or your runtime environment as needed by your MCP server logic.
  • If you customize the server package name (e.g., my_server), ensure the main.py entry point remains aligned with python -m my_server for running the server.

Related MCP Servers

Sponsor this space

Reach thousands of developers