Skip to main content

Yapi-Mcp

MCP server that fetches YApi project API docs (JSON request / JSON response) so coding agents can integrate client projects from a pasted YApi URL.

Features

  • Parse YApi page URLs → base_url / project_id / interface_id
  • List / search interfaces, export catalogs
  • Fetch normalized request & response JSON (JSON Schema / examples)
  • Auth: login JWT (Cookie _yapi_token + _yapi_uid) or project open token
  • Dynamic credentials: env, .env, .yapi-mcp.json, runtime yapi_configure, or per-tool args

Quick install (consumers)

Cursor / Claude Desktop MCP

{
  "mcpServers": {
    "yapi": {
      "command": "uvx",
      "args": ["--from", "contextdong-yapi-mcp", "yapi-mcp"],
      "env": {
        "YAPI_BASE_URL": "https://yapi.example.com",
        "YAPI_TOKEN": "YOUR_LOGIN_JWT_OR_PROJECT_OPEN_TOKEN"
      }
    }
  }
}

From Git (before / without PyPI):

{
  "mcpServers": {
    "yapi": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/ContextDong/Yapi-Mcp",
        "yapi-mcp"
      ],
      "env": {
        "YAPI_BASE_URL": "https://yapi.example.com",
        "YAPI_TOKEN": "YOUR_TOKEN"
      }
    }
  }
}

Or pip:

pip install contextdong-yapi-mcp
# or: pip install git+https://github.com/ContextDong/Yapi-Mcp

Configure credentials (no secrets in repo)

Priority (high → low):

  1. Tool arguments (token, base_url)
  2. Runtime yapi_configure (in-memory for the MCP process)
  3. Environment / .env (YAPI_BASE_URL, YAPI_TOKEN, YAPI_UID, YAPI_COOKIE)
  4. Config file .yapi-mcp.json or path in YAPI_MCP_CONFIG

Copy examples:

cp .env.example .env
cp .yapi-mcp.example.json .yapi-mcp.json
Variable Description
YAPI_BASE_URL YApi host, e.g. https://yapi.example.com
YAPI_TOKEN Login JWT or project open token
YAPI_UID Optional; login JWT usually auto-parses uid
YAPI_COOKIE Optional raw Cookie header override
YAPI_MCP_CONFIG Optional path to JSON config file

Never commit .env, .yapi-mcp.json, or real tokens.

Tools

Tool Purpose
yapi_configure / yapi_get_config Dynamic non-durable / inspect settings
yapi_parse_url Extract host + ids from a page URL
yapi_get_project Project metadata
yapi_list_interfaces Searchable interface index
yapi_get_interface Full JSON req/res for codegen
yapi_export_catalog Catalog (+ optional details)

Agent usage

Paste a project URL in chat:

Integrate APIs from https://yapi.example.com/project/123/interface/api/

The agent should configure credentials (if needed), list interfaces, pull details, then implement the client against your codebase conventions.

Project skill (optional): .cursor/skills/yapi-api-client/SKILL.md

Local development

python -m pip install -e ".[dev]"
python -m pytest
python -m yapi_mcp.server

MCP Registry

Official registry name: io.github.ContextDong/yapi-mcp
Package: PyPI contextdong-yapi-mcp (stdio via uvx / yapi-mcp)
Note: the shorter name yapi-mcp is already taken on PyPI by another project.

License

MIT

Metadata

Release files for contextdong-yapi-mcp 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for contextdong-yapi-mcp 0.1.0
File Size Uploaded Provenance Actions
contextdong_yapi_mcp-0.1.0.tar.gz 12.6 kB Without provenance Details for contextdong_yapi_mcp-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for contextdong-yapi-mcp 0.1.0
File Interpreter ABI Platform Actions
contextdong_yapi_mcp-0.1.0-py3-none-any.whl Python 3 none any Details for contextdong_yapi_mcp-0.1.0-py3-none-any.whl

Total release size: 25.9 kB

Release files / contextdong_yapi_mcp-0.1.0.tar.gz

Download URL contextdong_yapi_mcp-0.1.0.tar.gz
Size 12.6 kB
Tags Source
SHA-256 checksum
How to use checksums
255ef6a6dec883bd0594d084d23fab4d846792f01b53671df73947670b92f832
BLAKE2b-256 checksum
How to use checksums
be0572f748917a36a0eeb5b8e06d25ca33aa8757377b89070fe3b2be996d53f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / contextdong_yapi_mcp-0.1.0-py3-none-any.whl

Download URL contextdong_yapi_mcp-0.1.0-py3-none-any.whl
Size 13.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
783a80eb60f52ecef7a56dd8ee42d3c303f459c5f272f79d5bcdb7d9734521b8
BLAKE2b-256 checksum
How to use checksums
a31b4f09c39832d3786133b39c7e7d14d6802c2887340c6c3197b1b4f5a84c4e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Security for contextdong-yapi-mcp 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page