Skip to main content
Glama
Suryakanta26

mcp-server-python-mt9e4j8z

by Suryakanta26

MCP Server Template (Python)

Минимальный шаблон сервера Model Context Protocol для Render. Форкните его, добавьте свои инструменты и разверните.

Что входит

  • Рабочий MCP-сервер на базе MCP Python SDK с транспортом Streamable HTTP

  • Аутентификация по Bearer-токену через MCP_API_TOKEN (автоматически генерируется при развертывании)

  • Один пример инструмента (hello) для демонстрации паттерна

  • Эндпоинт /health для проверок работоспособности Render

  • Blueprint render.yaml для развертывания в один клик

  • Файл AGENTS.md, чтобы ИИ-ассистенты для программирования могли создавать новые инструменты за вас

Примечание: Этот шаблон по умолчанию развертывается на бесплатном тарифе. Бесплатные сервисы отключаются после 15 минут бездействия, что вызывает холодный старт на 30-60 секунд при следующем запросе. MCP-клиенты могут выйти из-за тайм-аута во время этой задержки. Для надежного использования перейдите на платный тариф в Render Dashboard — тариф Starter обеспечивает непрерывную работу вашего сервиса.

Related MCP server: mcp-server-python

Начало работы локально

git clone https://github.com/render-examples/mcp-server-python.git
cd mcp-server-python
pip install -r requirements.txt
python server.py

Сервер запускается на http://localhost:10000. MCP-эндпоинт находится по адресу /mcp.

Запуск тестов

pip install -r requirements.txt
pytest

Аутентификация

Сервер аутентифицирует запросы с помощью Bearer-токена. Blueprint Render автоматически генерирует случайный MCP_API_TOKEN при первом развертывании.

Чтобы найти свой токен после развертывания, перейдите в Render Dashboard > ваш сервис > Environment и скопируйте значение MCP_API_TOKEN.

Клиенты должны включать токен в заголовок Authorization:

Authorization: Bearer YOUR_TOKEN

Когда MCP_API_TOKEN не задан (например, при локальной разработке), аутентификация отключена, и все запросы пропускаются.

Управление токеном

После первоначального развертывания токен находится в вашем управлении:

  • Ротируйте его, обновив MCP_API_TOKEN в Render Dashboard в разделе Environment. Сервис автоматически перезапустится с новым значением.

  • Сгенерируйте новый токен любым из этих способов:

    • openssl rand -base64 32

    • python3 -c "import secrets; print(secrets.token_urlsafe(32))"

    • Генератор менеджера паролей (1Password, Bitwarden и т. д.)

  • Не коммитьте токены в систему контроля версий. Используйте переменные окружения или файлы .env (они находятся в .gitignore).

  • Для многопользовательских или продакшн-сред рассмотрите возможность перехода на OAuth 2.1.

Подключение к вашему MCP-серверу

После развертывания на Render ваш MCP-эндпоинт доступен по адресу:

https://your-service-name.onrender.com/mcp

Cursor

Добавьте в .cursor/mcp.json вашего проекта:

{
  "mcpServers": {
    "my-mcp-server": {
      "url": "https://your-service-name.onrender.com/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_TOKEN"
      }
    }
  }
}

Claude Desktop

Добавьте в конфигурацию Claude Desktop:

{
  "mcpServers": {
    "my-mcp-server": {
      "type": "streamable-http",
      "url": "https://your-service-name.onrender.com/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_TOKEN"
      }
    }
  }
}

Codex

codex mcp add --transport streamable-http \
  --url https://your-service-name.onrender.com/mcp \
  --header "Authorization: Bearer YOUR_TOKEN" \
  my-mcp-server

Или добавьте в .codex/config.toml:

[mcp_servers.my-mcp-server]
url = "https://your-service-name.onrender.com/mcp"
http_headers = { Authorization = "Bearer YOUR_TOKEN" }

Добавление инструментов

Добавляйте инструменты в server.py, декорируя функцию с помощью @mcp.tool():

@mcp.tool()
def fetch_weather(city: str, units: str = "celsius") -> str:
    """Get the current weather for a city."""
    # your implementation here
    return f"Weather for {city}"

Docstring становится описанием инструмента, которое MCP-клиенты показывают LLM. Всегда пишите понятное описание.

В этом репозитории есть файл AGENTS.md. Если вы используете ИИ-ассистента для программирования (Cursor, Copilot, Codex, Windsurf и т. д.), вы можете попросить его «добавить новый инструмент», и он автоматически будет следовать соглашениям из AGENTS.md.

Структура проекта

server.py              MCP server with example tool and health check
requirements.txt       Python dependencies
render.yaml            Render Blueprint for deployment
.env.example           Environment variable reference
tests/test_server.py   Test suite (auth, health, tool calls)
pyproject.toml         pytest configuration
AGENTS.md              Instructions for AI coding assistants
CLAUDE.md              Pointer to AGENTS.md for Claude Code

Узнать больше

F
license - not found
Not graded
quality - not tested
C
maintenance

Maintenance

UpdatingMaintainers
UpdatingResponse time
Release cycle
0Releases (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

  • F
    license
    Not graded
    quality
    C
    maintenance
    A minimal template for deploying Model Context Protocol servers on Render with Streamable HTTP transport, bearer token authentication, and an example hello tool.
  • F
    license
    Not graded
    quality
    C
    maintenance
    A minimal MCP server template for Python with Streamable HTTP transport, bearer token authentication, and a hello tool, designed for deployment on Render.
  • F
    license
    Not graded
    quality
    C
    maintenance
    A minimal MCP server template for Render with Streamable HTTP transport, bearer token authentication, and an example 'hello' tool. Enables developers to quickly scaffold and deploy their own MCP servers.
  • F
    license
    Not graded
    quality
    C
    maintenance
    A minimal MCP server template for Render with Streamable HTTP transport, bearer token authentication, and an example 'hello' tool.

View all related MCP servers

Related MCP Connectors

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/Suryakanta26/mcp-server-python-mt9e4j8z'

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