MCP Python Server — API Wrapper

by cdryampi

Integrations

  • Supports configuration through environment variables for API keys and endpoints, allowing secure storage of authentication credentials

MCP Python サーバー - API ラッパー

このプロジェクトでは、外部 API をクエリするためのツールを公開する Python で MCP サーバーを作成します。モデル コンテキスト プロトコル (MCP) をサポートする Claude Desktop または ChatGPT Desktop と互換性があります。

✨ 特徴

  • MCP経由でツールを公開する
  • 外部 API への HTTP クエリ
  • claude.json 経由で Claude/Desktop と直接統合

🚀 要件

  • Python 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付き(推奨)

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

MCPのインストール

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

👷 クイックスタート(クイックスタート)

サーバーを作成する 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/Desktop 構成フォルダで claude.json を見つけます。

  • 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/デスクトップ内で使用

モデルに次の質問をすることができます:

「ping」パラメータを指定したconsult_apiツールを使用する

そして、モデルは MCP サーバーを使用してリアルタイムの HTTP 呼び出しを行います。


🎁 ボーナス: ツール拡張機能

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

🔍 リソース


✅ 愛と httpx で作りました 🚀

-
security - not tested
F
license - not found
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Claude Desktop および ChatGPT Desktop と互換性のある、外部 API をクエリするためのツールを公開するモデル コンテキスト プロトコルを実装する Python サーバー。

  1. ✨ 特徴
    1. 🚀 要件
      1. 📁 プロジェクト構造
        1. ⚙️ インストール
          1. ピップ付き
          2. UV付き(推奨)
          3. MCPのインストール
          4. .env によるインストール
          5. 依存関係のインストール
          6. 環境変数
        2. 👷 クイックスタート(クイックスタート)
          1. サーバーを作成する server.py
          2. 開発モードでローカルに実行する
          3. 本番環境で実行
        3. 🚀 Claude/Desktop との統合
          1. 🤖 Claude/デスクトップ内で使用
            1. 🎁 ボーナス: ツール拡張機能
              1. 🔍 リソース

                Related MCP Servers

                • -
                  security
                  A
                  license
                  -
                  quality
                  A Python-based server that implements the Model Context Protocol to interface with Claude Desktop as an MCP client, supporting interaction through efficient memory management.
                  Last updated -
                  1
                  Python
                  MIT License
                • -
                  security
                  F
                  license
                  -
                  quality
                  A Model Context Protocol server that allows management and execution of Blender Python scripts, enabling users to create, edit and run scripts in a headless Blender environment through natural language interfaces.
                  Last updated -
                  4
                  Python
                • -
                  security
                  F
                  license
                  -
                  quality
                  A Model Context Protocol server that allows Claude to make API requests on your behalf, providing tools for testing various APIs including HTTP requests and OpenAI integrations without sharing your API keys in the chat.
                  Last updated -
                  Python
                  • Linux
                  • Apple
                • -
                  security
                  F
                  license
                  -
                  quality
                  A Model Context Protocol server that provides a comprehensive interface for interacting with the ConnectWise Manage API, simplifying API discovery, execution, and management for both developers and AI assistants.
                  Last updated -
                  46
                  2
                  Python
                  • Linux
                  • Apple

                View all related MCP servers

                ID: 0zme075ivr