Skip to main content
Glama

JitAPI

PyPI PyPI Downloads License: MIT Python 3.10+

让 Claude 指向任何 API。JitAPI 会自动计算出需要调用哪些端点以及调用的顺序。

JitAPI 是一个 MCP 服务器,允许 Claude 通过 OpenAPI 规范与任何 API 进行交互。JitAPI 不会将数百个端点一股脑塞进上下文,而是使用语义搜索和依赖图来仅呈现所需的内容——然后由 Claude 进行规划并执行调用。

https://github.com/user-attachments/assets/53f72f89-a41a-4a9c-a688-ec876ea05fbd


问题所在

Stripe 有 300 多个端点。GitHub 有 800 多个。将完整的规范加载到 Claude 的上下文中会浪费 Token 并导致幻觉。为每个使用的 API 编写自定义 MCP 服务器无法扩展。

JitAPI 解决了这个问题: 只需注册一次 OpenAPI 规范,然后用自然语言询问你需要什么。它会找到正确的端点,解析它们之间的依赖关系,并让 Claude 执行调用。

Related MCP server: OpenAPI to MCP

快速开始

pip install jitapi

添加到你的 Claude Code 配置 (.mcp.json) 中:

{
  "mcpServers": {
    "jitapi": {
      "command": "uvx",
      "args": ["jitapi"]
    }
  }
}

就是这样。无需 API 密钥——JitAPI 开箱即用,使用本地嵌入。

然后在 Claude 中:

You: Register the GitHub API from https://raw.githubusercontent.com/github/rest-api-description/main/descriptions/api.github.com/api.github.com.json

Claude: ✓ Registered GitHub v3 REST API — 1,107 endpoints indexed

You: List my repos

Claude: [searches for "list repositories for authenticated user" → finds GET /user/repos → executes]
Here are your repositories: ...

多 API 编排

杀手级功能:注册多个 API 并提出跨 API 的问题。JitAPI 会在所有已注册的 API 中进行搜索,Claude 会将调用串联起来。

You: Register the TMDB API and OpenWeatherMap API
Claude: ✓ Registered both APIs

You: Find the top popular movie on TMDB, then get the weather where it was filmed

Claude: [searches TMDB → GET /movie/popular → GET /movie/{id} for production locations
         → searches OpenWeather → GET /data/2.5/weather with the city]

The #1 popular movie is "Inception", filmed in Los Angeles.
Current weather in LA: 72°F, partly cloudy.

工作原理

Register API                          Ask a question
     │                                      │
     ▼                                      ▼
Parse OpenAPI spec               Embed query → vector search
     │                                      │
     ▼                                      ▼
Build dependency graph           Find relevant endpoints
     │                                      │
     ▼                                      ▼
Embed all endpoints              Expand with dependencies
     │                                      │
     ▼                                      ▼
Store in vector DB               Return schemas → Claude executes
  1. 注册 — 解析 OpenAPI 规范,构建依赖图(哪些端点需要来自其他端点的数据),并为所有端点创建可搜索的嵌入。

  2. 搜索 — 当你提出问题时,JitAPI 会对你的查询进行嵌入,并通过余弦相似度找到最相关的端点。

  3. 扩展 — 依赖图会添加任何先决条件端点(例如,“你需要先调用 GET /users 来获取 POST /orders 所需的 user_id”)。

  4. 执行 — Claude 获取端点模式并进行 API 调用,在步骤之间传递数据。

MCP 工具

工具

描述

register_api

从 OpenAPI 规范 URL 注册 API

list_apis

列出所有已注册的 API 及其端点数量

search_endpoints

使用自然语言在端点间进行语义搜索

get_workflow

通过依赖解析和完整模式查找相关端点

get_endpoint_schema

获取特定端点的完整模式

call_api

执行带有认证、路径参数、查询参数和主体的单个 API 调用

set_api_auth

配置认证(API 密钥、Bearer Token、基本认证)

delete_api

删除已注册的 API 及其所有数据

设置

Claude Code

在你的项目目录中创建 .mcp.json(或全局访问使用 ~/.claude.json):

{
  "mcpServers": {
    "jitapi": {
      "command": "uvx",
      "args": ["jitapi"]
    }
  }
}

Claude Desktop

添加到你的 Claude Desktop 配置中:

操作系统

配置文件路径

macOS

~/Library/Application Support/Claude/claude_desktop_config.json

Windows

%APPDATA%\Claude\claude_desktop_config.json

Linux

~/.config/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "jitapi": {
      "command": "uvx",
      "args": ["jitapi"]
    }
  }
}

嵌入提供商

JitAPI 通过本地嵌入 (fastembed) 开箱即用——无需 API 密钥。为了在大型 API 上获得更好的搜索质量,你可以添加云嵌入提供商:

提供商

质量

设置

本地 (默认)

良好

无需操作——立即生效

Voyage AI (推荐)

优秀

pip install jitapi[voyage] + 设置 VOYAGE_API_KEY

OpenAI

优秀

pip install jitapi[openai] + 设置 OPENAI_API_KEY

Cohere

非常好

pip install jitapi[cohere] + 设置 COHERE_API_KEY

在你的 MCP 配置的 env 块中设置 API 密钥:

{
  "mcpServers": {
    "jitapi": {
      "command": "uvx",
      "args": ["jitapi"],
      "env": {
        "VOYAGE_API_KEY": "your-key-here"
      }
    }
  }
}

提供商会根据可用的环境变量自动检测。优先级:Voyage AI > OpenAI > Cohere > 本地。

认证

注册后配置 API 认证。推荐的方法是使用环境变量,这样密钥永远不会写入磁盘:

{
  "mcpServers": {
    "jitapi": {
      "command": "uvx",
      "args": ["jitapi"],
      "env": {
        "GITHUB_TOKEN": "ghp_...",
        "OPENWEATHER_API_KEY": "your-key-here"
      }
    }
  }
}

然后告诉 Claude 使用该环境变量:

You: Set bearer auth for GitHub using env var GITHUB_TOKEN
Claude: [calls set_api_auth with auth_type="bearer", env_var="GITHUB_TOKEN"]
✓ Auth configured for github (from env var $GITHUB_TOKEN)

使用 env_var 时,JitAPI 会在请求时从环境中读取密钥——只会持久化环境变量的名称,绝不会持久化凭据本身。

你也可以直接传递凭据(它们将以 0600 权限存储在 ~/.jitapi/auth.json 中):

You: Set API key auth for OpenWeather with param name "appid"
Claude: [calls set_api_auth with auth_type="api_key_query", credential="...", param_name="appid"]
✓ Auth configured for openweather

支持的认证类型:bearer、api_key_header、api_key_query、basic。

安全提示: 使用 env_var 时,凭据在运行时解析,绝不会触及文件系统。直接传递 credential 时,密钥会以明文 JSON 形式存储在 ~/.jitapi/auth.json 中(文件权限 0600,目录 0700)。在生产环境中使用时,请优先选择 env_var 方法。

环境变量

变量

必需

描述

VOYAGE_API_KEY

否

Voyage AI API 密钥(推荐的云提供商)

OPENAI_API_KEY

否

OpenAI API 密钥(替代云提供商)

COHERE_API_KEY

否

Cohere API 密钥(替代云提供商)

JITAPI_STORAGE_DIR

否

数据目录(默认:~/.jitapi)

JITAPI_LOG_LEVEL

否

DEBUG, INFO, WARNING, ERROR(默认:INFO)

开发

git clone https://github.com/nk3750/jitapi.git
cd jitapi
pip install -e ".[dev]"
pytest
ruff check src/

许可证

MIT

Available Tools

8 tools
call_apiB

Execute an API call. Make sure authentication is configured first.

Inputs: api_id (required), endpoint_id (required), path_params, query_params, +1 more.

delete_apiA

Delete a registered API and all its data including endpoints, embeddings, dependency graph, and authentication credentials.

Inputs: api_id (required).

get_endpoint_schemaB

Get the full schema for a specific endpoint. Use this to get detailed parameter and response information.

Inputs: api_id (required), endpoint_id (required).

get_workflowA

Get relevant endpoints with dependency resolution and full schemas for accomplishing a task. Returns search results expanded with their dependencies so you can plan and execute the right API calls in the right order. After reviewing the results, use call_api to execute each step.

Inputs: query (required), api_id (required), max_steps.

list_apisB

List all registered APIs with their basic information.

Inputs: no named parameters.

register_apiA

Register a new API by ingesting its OpenAPI specification. This parses the spec, builds a dependency graph, and creates searchable embeddings.

Inputs: api_id (required), spec_url (required).

search_endpointsA

Search for API endpoints using natural language. Returns semantically similar endpoints based on the query.

Inputs: query (required), api_id, top_k.

set_api_authA

Configure authentication for an API. Supports API key (header or query param) and bearer token auth. Use env_var to reference a secret from an environment variable — the credential is then resolved at request time and never stored on disk.

Inputs: api_id (required), auth_type (required), credential, env_var, +2 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 8 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: register/delete/list for API lifecycle management, search_endpoints for discovery, get_endpoint_schema for detailed inspection, get_workflow for task planning with dependencies, set_api_auth for configuration, and call_api for execution. No overlapping functionality.

    Naming Consistency5/5

    Consistent snake_case throughout with verb_noun pattern (call_api, delete_api, list_apis, register_api, search_endpoints, get_workflow, get_endpoint_schema, set_api_auth). All use standard CRUD-style verbs (get, list, search, call, set, register, delete).

    Tool Count5/5

    8 tools is well-scoped for an API management server covering the full lifecycle: registration, listing, deletion, authentication, discovery (search), inspection (schema), planning (workflow), and execution. Each tool earns its place without redundancy.

    Completeness4/5

    Covers the core API lifecycle well (register, list, delete, auth, search, call) with helpful additions like workflow planning. Minor gaps: no get_api for specific API details (only list_apis), no update_api for refreshing specs without full deletion, and no way to remove auth without deleting the entire API.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      A standalone proxy that transforms any OpenAPI or Swagger-described REST API into an MCP server by mapping API operations to executable MCP tools. It enables AI clients to interact with existing web services through automated HTTP requests based on their official documentation.
      16
      MIT
    • F
      license
      Not graded
      quality
      Not graded
      maintenance
      Universal AI API Orchestrator. 850 tools across 53 services under a single MCP interface. Connect Claude, GPT, or Gemini to Stripe, Slack, GitHub, LinkedIn, Cloudflare, Shopify, Twilio, and 46 more via natural language. $0.10/execution, no subscription. Patent Pending.
      274 npm
      5
      -
    • A
      license
      A
      quality
      C
      maintenance
      Turn any OpenAPI spec into MCP tools for Claude — instantly. Point mcp-openapi at any OpenAPI 3.x spec and Claude can call every endpoint through natural language. No custom integration code. No manual tool definitions. One line of config.
      2
      40 npm
      1
      MIT