Skip to main content
Glama
cdryampi

MCP Python Server — API Wrapper

by cdryampi

MCP Python Server — API-оболочка

В этом проекте создается MCP-сервер на Python, который предоставляет инструмент для запросов к внешнему API. Совместимо с Claude Desktop или ChatGPT Desktop, которые поддерживают протокол контекста модели (MCP).

✨ Особенности

  • Демонстрация инструмента через MCP

  • HTTP-запрос к внешнему API

  • Прямая интеграция с Claude/Desktop через claude.json


Related MCP server: MCP Starter

🚀 Требования

  • Питон 3.9+

  • mcp[cli] (устанавливается через pip или uv)

  • Claude или ChatGPT Desktop (с поддержкой MCP)


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

.
├── servidores/profile.py          # Servidor MCP con herramientas para interactuar con mi backend del curriculum.
├── server.py                     # Servidor MCP con herramienta "consultar_api".
├── .env                          # Variables opcionales para auth/API.
├── claude.json                   # Config. MCP para integrarlo directamente.
└── README.md                     # Este documento.

⚙️ Установка

С пипом

pip install "mcp[cli]"

С УФ (рекомендуется)

uv init mcp-api-server
cd mcp-api-server
uv add "mcp[cli]"

Установка МКП

mcp install mi_script.py

Установка с .env

mcp install mi_script.py -f .env

Установка зависимостей

pip install -r requirements.txt

Переменные среды

Создайте файл .env в корне проекта для определения необязательных переменных среды:

# .env
API_KEY=mi_api_key
API_URL=https://miapi.com/consulta

👷 Быстрый старт (Quickstart)

Создайте сервер server.py

from mcp.server.fastmcp import FastMCP
import httpx

mcp = FastMCP("API Wrapper")

@mcp.tool(description="Consulta una API externa")
async def consultar_api(param: str) -> str:
    """Consulta una API externa con un parámetro y devuelve la respuesta."""
    async with httpx.AsyncClient() as client:
        r = await client.get(f"https://miapi.com/consulta?param={param}")
        return r.text

Запустить локально в режиме разработки

mcp dev server.py

Запуск в производственном режиме

mcp run server.py

Или с помощью uv:

uv run --with mcp[cli] mcp run server.py

🚀 Интеграция с Claude/Desktop

Найдите claude.json в папке конфигурации Claude/Desktop:

  • В Windows: %APPDATA%\Claude\claude.json

  • В Linux/macOS: ~/.claude/claude.json

Пример:

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/codigo/backend-curso-inkor/proyectos_memes"
      ]
    },
    "Demo": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "mcp[cli]",
        "mcp",
        "run",
        "C:\\codigo\\backend-curso-inkor\\MCP\\server.py"
      ]
    }
  }
}

🤖 Использовать в Claude/Desktop

Вы можете задать вопрос модели:

Используйте инструмент consult_api с параметром «ping»

А модель будет использовать ваш MCP-сервер для совершения HTTP-вызовов в реальном времени.


🎁 Бонус: Расширение инструментов

@mcp.tool()
async def traducir(texto: str, lang: str) -> str:
    return f"Traducido: {texto} → {lang}"

🔍 Ресурсы


✅ Сделано с любовью и httpx 🚀

F
license - not found
-
quality - not tested
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (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

  • A
    license
    -
    quality
    D
    maintenance
    A custom Model Context Protocol server that gives Claude Desktop and other LLMs access to file system operations and command execution capabilities through standardized tool interfaces.
    Last updated
    23
    Apache 2.0
  • A
    license
    D
    quality
    D
    maintenance
    A foundation for building custom local Model Context Protocol (MCP) servers that provide tools accessible to AI assistants like Cursor or Claude Desktop.
    Last updated
    1
    37
    MIT
  • F
    license
    -
    quality
    D
    maintenance
    A Model Context Protocol server that allows integration with Claude Desktop by creating and managing custom tools that can be executed through the MCP framework.
    Last updated
    99
  • F
    license
    -
    quality
    D
    maintenance
    A Model Context Protocol (MCP) server built with the mcp-framework for developing and managing custom tools. It provides a structured foundation for building and integrating modular components like data processors and API clients into Claude Desktop.
    Last updated
    24

View all related MCP servers

Related MCP Connectors

  • A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…

  • A Model Context Protocol server for Wix AI tools

  • Real-time chat hub for AI agents — Claude Code, Cursor, Cline, Codex over MCP or REST.

View all MCP Connectors

Appeared in Searches

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/cdryampi/MCP'

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