Skip to main content
Glama
cdryampi

MCP Python Server — API Wrapper

by cdryampi

MCP Python Server – API Wrapper

Dieses Projekt erstellt einen MCP-Server in Python, der ein Tool zum Abfragen einer externen API bereitstellt. Kompatibel mit Claude Desktop oder ChatGPT Desktop, die das Model Context Protocol (MCP) unterstützen.

✨ Funktionen

  • Verfügbarmachen eines Tools über MCP

  • HTTP-Abfrage an eine externe API

  • Direkte Integration mit Claude/Desktop über claude.json


Related MCP server: MCP Starter

🚀 Voraussetzungen

  • Python 3.9+

  • mcp[cli] (installierbar über pip oder uv)

  • Claude oder ChatGPT Desktop (mit MCP-Unterstützung)


📁 Projektstruktur

.
├── 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.

⚙️ Installation

Mit Pip

pip install "mcp[cli]"

Mit UV (empfohlen)

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

Installation des MCP

mcp install mi_script.py

Installation mit .env

mcp install mi_script.py -f .env

Installation von Abhängigkeiten

pip install -r requirements.txt

Umgebungsvariablen

Erstellen Sie eine .env Datei im Projektstamm, um optionale Umgebungsvariablen zu definieren:

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

👷 Schnellstart (Schnellstart)

Erstellen Sie den Server 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

Lokal im Entwicklermodus ausführen

mcp dev server.py

Im Produktionsmodus ausführen

mcp run server.py

Oder mit UV:

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

🚀 Integration mit Claude/Desktop

Suchen Sie claude.json im Konfigurationsordner Claude/Desktop:

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

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

Beispiel:

{
  "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"
      ]
    }
  }
}

🤖 Verwendung innerhalb von Claude/Desktop

Sie können das Modell fragen:

Verwenden Sie das Tool consult_api mit dem Parameter „ping“

Und das Modell verwendet Ihren MCP-Server, um einen HTTP-Aufruf in Echtzeit zu tätigen.


🎁 Bonus: Tools-Erweiterung

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

🔍 Ressourcen


✅ Mit Liebe gemacht und httpx 🚀

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    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.
    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.
    1
    37
    MIT
  • F
    license
    Not graded
    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.
    88
  • F
    license
    Not graded
    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.
    12

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