# MCP server template - Python

Deploy the MCP Server Python template on Render with one click. Includes FastMCP, auth, and health checks ready to go.

- Repository: https://github.com/render-examples/mcp-server-python
- Stack: python
- Tags: ai, mcp
- URL: https://render.com/templates/mcp-server-python

## Why deploy an MCP server (Python) on Render?

MCP Server Python is a template for building [Model Context Protocol](https://modelcontextprotocol.io/) servers in Python using the official MCP Python SDK. It provides a ready-to-deploy structure with authentication, health checks, and example tooling so developers can quickly expose custom tools to AI agents and LLM-powered applications via a standardized protocol.

This template gives you a production-ready MCP server with bearer token authentication already configured—Render auto-generates a secure `MCP_API_TOKEN` on deploy, so you skip the setup of secrets management entirely. Instead of manually wiring up Streamable HTTP transport, health checks, and auth middleware, you get a working server with one click that's ready to extend with your own tools. The included `AGENTS.md` file means AI coding assistants can scaffold new MCP tools for you directly, and Render's environment variable management makes token rotation as simple as editing a value in the dashboard.

## Architecture

```mermaid
flowchart LR
    classDef default fill:#1a1a2e,stroke:#a78bfa,color:#fff

    User([User/MCP Client]) -->|API calls| Server[my-mcp-server]
    Server -->|/health| Health([Health Check])
```

## What you can build

After deploying, you'll have a live MCP server endpoint that AI coding tools like Cursor, Claude Desktop, or Codex can connect to immediately. The server comes with token-based auth (auto-generated on deploy) and a sample tool you can replace with your own. It's a starting point for giving LLMs access to custom tools you define in Python.

## Key features

- *Streamable HTTP transport*: Uses the MCP Python SDK with Streamable HTTP transport for building MCP-compliant servers that work with Cursor, Claude Desktop, and Codex.
- *Bearer token auth*: Auto-generates `MCP_API_TOKEN` on deploy and validates Authorization headers, with auth disabled when unset for local development.
- *Decorator-based tools*: Add new tools with `@mcp.tool()` decorators where docstrings automatically become tool descriptions exposed to LLMs.
- *Render Blueprint deploy*: Includes `render.yaml` for one-click deployment with pre-configured health checks and environment variables.
- *AI assistant scaffolding*: Ships with `AGENTS.md` so Cursor, Copilot, and Codex can automatically generate new tools following project conventions.

## Use cases

- Solo dev deploys a private API tool for Claude Desktop
- Team lead prototypes custom MCP tools before production rollout
- Freelancer gives clients AI access to project-specific utilities
- Hobbyist learns MCP patterns with a deployable starter template

## What's included

| Service | Type | Purpose |
|---------|------|---------|
| my-mcp-server | Web Service | MCP server application |

## Next steps

1. Open the Render Dashboard, navigate to your service's Environment tab, and copy the `MCP_API_TOKEN` value — you should see a randomly generated token string that was auto-created during deployment.
2. Configure your MCP client (Cursor, Claude Desktop, or Codex) with your service URL and token using the examples in the README — when you restart the client, it should connect without authentication errors and list `hello` as an available tool.
3. Test the `hello` tool by asking your MCP client to run it with a name parameter — you should receive a greeting response like "Hello, [name]!" confirming the server is processing tool calls correctly.

## Resources

- [MCP Python SDK](https://github.com/modelcontextprotocol/python-sdk)
- [MCP specification](https://spec.modelcontextprotocol.io/)
- [Render Blueprints](https://render.com/docs/infrastructure-as-code)
