JM

jnanasrota/mcpgen

API development

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

21 stars 2 forks 品質 75 トレンド 4MIT

OpenAPI の仕様または Postman のコレクションを 30 秒で独自の Python MCP サーバーに変える

概要

OpenAPI 仕様または Postman コレクションで mcpgen をポイントします。 mcpgen、プロキシなし、ロックインなしのランタイム依存性を戻す。 お問い合わせ 変更する。 それを出荷して下さい。 です。 mcpgen は仕様を読み、Python MCP サーバーをディスクに書きます。 あなたが所有するソースコードを持つ自在ディレクトリ: 黒い箱無し。 実行時に依存関係はありません。 ちょうどPython。 mcpgen は、 claude desktop config.json に貼り付ける config のスニペットを正確に出力します。 - macOS: ~/ Library/Application Support/Claude/claude desktop config.json - Windows: %APPDATA%\Claude\claude desktop config.json ほとんどの API-to-MCP ツールは、Claude と API 間で永続的に座っているため、実行中に滞在するに依存します。 mcpgen は生成します。 出力は単なるPythonファイルです。 できます:

概要(AI 翻訳)

30秒でMCPサーバーに任意のAPIを実行します。

お問い合わせ

ポイントmcpgen:OpenAPIの仕様またはポストマンのコレクションで。 mcpgen、プロキシなし、ロックインなしのランタイム依存関係なし*complete Python MCPサーバーを取り戻してください。 お問い合わせ 変更する。 それを出荷して下さい。

お問い合わせ

インストール

クイックスタート

です。 [mcpgen] のスペックを読み、Python MCP サーバーをディスクに書きます。

お問い合わせ

取得する

あなたが所有するソースコードを持つ自在ディレクトリ:

すぐに実行:

生成された[server.pyはこのように見えます:

黒い箱無し。 実行時に依存関係はありません。 ちょうどPython。

お問い合わせ

Claudeデスクトップに追加

[[mcpgen]] は、コンフィグスニペットを [claude_desktop_config.json に貼り付けます。

ファイル場所の設定:

  • macOS: [~/Library/Application Support/Claude/claude_desktop_config.json]
  • Windows: [%APPDATA%\Claude\claude_desktop_config.json

お問い合わせ

プロキシの代わりにソースコードをソースする理由は?

ほとんどの API-to-MCP ツールは、runtime proxies です。Claude と API forever の間にあるため、実行中の滞在に依存します。

[mcpgen は、所有する ** ソースコードを生成します。** 出力は単なるPythonファイルです。 できます:

  • 何が起こっているかのすべてのラインを読んで下さい

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。

README

以下は原文 README の抜粋です。原文を見る。


Point mcpgen at an OpenAPI spec or Postman collection. Get back a complete Python MCP server you own — no runtime dependency on mcpgen, no proxy, no lock-in. Read it. Modify it. Ship it.


Install

pip install mcpgen-cli

Quickstart

# From a URL
mcpgen https://petstore3.swagger.io/api/v3/openapi.json

# From a local OpenAPI file (JSON or YAML)
mcpgen stripe.yaml

# From a Postman collection
mcpgen postman_collection.json

# Preview without writing anything
mcpgen openapi.json --dry-run

# Custom output directory and server name
mcpgen openapi.json --output ~/my-mcp-servers --name "My API"

That’s it. mcpgen reads your spec and writes a Python MCP server to disk.


What you get

A self-contained directory with source code you own:

stripe_api_mcp/
├── server.py          ← the MCP server (read it, edit it, it's yours)
└── requirements.txt   ← httpx, mcp

Run it immediately:

cd stripe_api_mcp
pip install -r requirements.txt
export STRIPE_API_TOKEN="sk_live_..."
python server.py

The generated server.py looks like this:

#!/usr/bin/env python3
"""
Stripe API MCP Server
Generated by mcpgen — https://github.com/JnanaSrota/mcpgen
This file is yours. Modify it freely.
"""
import os, asyncio, httpx
from mcp.server import Server
from mcp.server.stdio import stdio_server
from mcp import types

BASE_URL = "https://api.stripe.com"
AUTH_TOKEN = os.environ.get("STRIPE_API_TOKEN", "")

app = Server("stripe-api")

@app.call_tool()
async def _handle_get_customers(name: str, arguments: dict):
    if name != "get_customers":
        raise ValueError(f"Unknown tool: {name}")
    url = BASE_URL + "/v1/customers"
    query_params = {}
    if "limit" in arguments:
        query_params["limit"] = arguments["limit"]
    async with httpx.AsyncClient(timeout=30.0) as client:
        response = await client.get(url, params=query_params,
            headers={"Authorization": f"Bearer {AUTH_TOKEN}"})
GitHub で README 全文を見る

インストール

This server does not publish a one-line install command.

Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →

設定

{ "mcpServers": { "stripe-api-mcp": { "command": "python", "args": ["/path/to/stripe_api_mcp/server.py"], "env": { "STRIPE_API_TOKEN": "your-key-here" } } } }