# YApi MCP server

> Fetches YApi JSON API documentation from project URLs to help AI agents understand and integrate with client projects.

- Repository: https://github.com/ContextDong/Yapi-Mcp
- Page: https://hostedmcp.org/servers/contextdong/yapi-mcp
- Transport: stdio
- Stars: 0
- License: MIT
- Latest version: 0.1.0

## Install

### Claude Code

```sh
claude mcp add --env 'YAPI_TOKEN=<YOUR_YAPI_TOKEN>' yapi-mcp -- uvx contextdong-yapi-mcp
```

### Cursor (`~/.cursor/mcp.json`)

```json
{
  "mcpServers": {
    "yapi-mcp": {
      "command": "uvx",
      "args": [
        "contextdong-yapi-mcp"
      ],
      "env": {
        "YAPI_TOKEN": "<YOUR_YAPI_TOKEN>"
      }
    }
  }
}
```

### VS Code (`.vscode/mcp.json`)

```json
{
  "servers": {
    "yapi-mcp": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "contextdong-yapi-mcp"
      ],
      "env": {
        "YAPI_TOKEN": "<YOUR_YAPI_TOKEN>"
      }
    }
  }
}
```

### VS Code CLI

```sh
code --add-mcp '{"name":"yapi-mcp","type":"stdio","command":"uvx","args":["contextdong-yapi-mcp"],"env":{"YAPI_TOKEN":"<YOUR_YAPI_TOKEN>"}}'
```

### Claude Desktop (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "yapi-mcp": {
      "command": "uvx",
      "args": [
        "contextdong-yapi-mcp"
      ],
      "env": {
        "YAPI_TOKEN": "<YOUR_YAPI_TOKEN>"
      }
    }
  }
}
```

### Codex

```sh
codex mcp add yapi-mcp --env 'YAPI_TOKEN=<YOUR_YAPI_TOKEN>' -- uvx contextdong-yapi-mcp
```

### Codex config.toml (`~/.codex/config.toml`)

```toml
[mcp_servers.yapi-mcp]
command = "uvx"
args = ["contextdong-yapi-mcp"]

[mcp_servers.yapi-mcp.env]
YAPI_TOKEN = "<YOUR_YAPI_TOKEN>"
```

### Gemini CLI

```sh
gemini mcp add -s user -e 'YAPI_TOKEN=<YOUR_YAPI_TOKEN>' yapi-mcp uvx -- contextdong-yapi-mcp
```

### Gemini settings.json (`~/.gemini/settings.json`)

```json
{
  "mcpServers": {
    "yapi-mcp": {
      "command": "uvx",
      "args": [
        "contextdong-yapi-mcp"
      ],
      "env": {
        "YAPI_TOKEN": "<YOUR_YAPI_TOKEN>"
      }
    }
  }
}
```

## Environment variables

| Name | Required | Secret | Description |
|---|---|---|---|
| `YAPI_TOKEN` | yes | yes | Login JWT or project open token |
| `YAPI_BASE_URL` | no | no | YApi host URL, e.g. https://yapi.example.com |
| `YAPI_UID` | no | no | Optional uid for login JWT cookie auth |

## FAQ

### How can I authenticate with YApi?

You can authenticate using a login JWT (via Cookie _yapi_token and _yapi_uid) or a project open token.

### Can the server parse YApi URLs directly?

Yes, the server includes a tool to parse YApi page URLs into base URL, project ID, and interface ID.
