MCP Python Server — API Wrapper
MCP Python サーバー - API ラッパー
このプロジェクトでは、外部 API をクエリするためのツールを公開する Python で MCP サーバーを作成します。モデル コンテキスト プロトコル (MCP) をサポートする Claude Desktop または ChatGPT Desktop と互換性があります。
✨ 特徴
MCP経由でツールを公開する
外部 API への HTTP クエリ
claude.json 経由で Claude/Desktop と直接統合
Related MCP server: MCP Starter
🚀 要件
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}"🔍 リソース
公式 MCP ドキュメント: https://docs.mcp.run/
Python SDK リポジトリ: https://github.com/modelcontextprotocol/mcp
✅ 愛と httpx で作りました 🚀
This server cannot be installed
Maintenance
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
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Model Context Protocol server for the Apideck Unified API. Connect any MCP-compatible agent framework to 100+ accounting systems, HRIS platforms, file storage providers, and more through one integration. More information https://www.apideck.com/mcp-server
A Model Context Protocol server for Wix AI tools
MCP server unifying ERPs, CRMs, APIs and knowledge base for Claude, ChatGPT and Gemini.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA 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.23Apache 2.0
- AlicenseDqualityDmaintenanceA foundation for building custom local Model Context Protocol (MCP) servers that provide tools accessible to AI assistants like Cursor or Claude Desktop.137MIT
- FlicenseNot gradedqualityDmaintenanceA 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
- FlicenseNot gradedqualityDmaintenanceA 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
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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