Skip to main content
Glama
README.md
# YAPI MCP Server

A Model Context Protocol (MCP) server for YAPI API Platform integration. Enable AI assistants to interact with YAPI seamlessly.

[δΈ­ζ–‡ζ–‡ζ‘£](README_CN.md)

## πŸš€ Quick Start

### Recommended: Use with npx (No installation required)

1. **Get your YAPI Token**: Login to your YAPI platform and get the token from project settings

2. **Configure Claude Desktop**: Add the following to your MCP settings file:

**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`  
**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`

```json
{
  "mcpServers": {
    "yapi": {
      "command": "npx",
      "args": [
        "-y",
        "@criller/yapi-mcp-server",
        "--yapi-base-url=http://your-yapi-server.com",
        "--yapi-token=your-token-here"
      ]
    }
  }
}
```

3. **Start using**: Restart Claude Desktop and you're ready to go!

## ✨ Features

This MCP server provides **11 tools** covering all YAPI Open APIs:

### Project Management (1 tool)
- `yapi_get_project` - Get project information

### Category Management (2 tools)
- `yapi_add_category` - Add interface category
- `yapi_get_category_menu` - Get category menu list

### Interface Management (7 tools)
- `yapi_get_interface` - Get interface details
- `yapi_list_interfaces_by_cat` - List interfaces by category
- `yapi_add_interface` - Add new interface
- `yapi_update_interface` - Update interface
- `yapi_get_interface_list` - Get interface list
- `yapi_update_interface_basic` - Update interface basic info
- `yapi_get_interface_cat_list` - Get interface menu tree

### Data Import (1 tool)
- `yapi_import_data` - Import data (Swagger, HAR, Postman, etc.)

## πŸ“– Usage Examples

Once configured, you can interact with YAPI using natural language:

- "Show me the details of project 123"
- "List all categories in project 456"
- "Get the interface with ID 789"
- "Add a new category called 'User Management' to project 123"
- "Import this Swagger file to project 456"

## πŸ”§ Alternative Configuration Methods

### Method 1: Using Environment Variables

```json
{
  "mcpServers": {
    "yapi": {
      "command": "npx",
      "args": ["-y", "@criller/yapi-mcp-server"],
      "env": {
        "YAPI_BASE_URL": "http://your-yapi-server.com",
        "YAPI_TOKEN": "your-token-here"
      }
    }
  }
}
```

### Method 2: Local Development

For development or debugging:

```bash
git clone https://github.com/criller/yapi-mcp-server.git
cd yapi-mcp-server
npm install
cp .env.example .env
# Edit .env and set your YAPI_BASE_URL and YAPI_TOKEN
npm run dev
```

Then configure Claude Desktop:

```json
{
  "mcpServers": {
    "yapi": {
      "command": "node",
      "args": ["/absolute/path/to/yapi-mcp-server/dist/index.js"],
      "env": {
        "YAPI_BASE_URL": "http://your-yapi-server.com",
        "YAPI_TOKEN": "your-token"
      }
    }
  }
}
```

## πŸ› οΈ Development

### Type Check
```bash
npm run typecheck
```

### Build
```bash
npm run build
```

### Testing with MCP Inspector
```bash
npx @modelcontextprotocol/inspector npx -y @criller/yapi-mcp-server
```

## πŸ“ Project Structure

```
yapi-mcp-server/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ index.ts              # MCP Server entry point
β”‚   β”œβ”€β”€ config.ts             # Configuration management
β”‚   β”œβ”€β”€ types.ts              # TypeScript types
β”‚   β”œβ”€β”€ yapi-client.ts        # YAPI API client
β”‚   └── tools/                # MCP tools
β”‚       β”œβ”€β”€ project-tools.ts  # Project management
β”‚       β”œβ”€β”€ category-tools.ts # Category management
β”‚       β”œβ”€β”€ interface-tools.ts# Interface management
β”‚       └── import-tools.ts   # Data import
β”œβ”€β”€ package.json
β”œβ”€β”€ tsconfig.json
└── README.md
```

## 🀝 Contributing

Contributions are welcome! Please check [CONTRIBUTING.md](CONTRIBUTING.md) for details.

## πŸ“„ License

MIT

TDQS

B3.2/5.0

Scored across 11 tools

Disambiguation3/5

Several tools have overlapping purposes: yapi_get_category_menu, yapi_get_interface_cat_list, and yapi_get_interface_list all retrieve interface lists or menus, causing potential confusion. The update tools are also similar, though descriptions clarify the distinction between basic and full updates.

Naming Consistency5/5

All tool names follow a consistent yapi_verb_noun pattern (e.g., yapi_get_category_menu, yapi_update_interface_basic, yapi_import_data), with clear and predictable naming.

Tool Count5/5

With 11 tools, the set is well-scoped for managing YAPI projects, covering project info, categories, interfaces, and imports without excessive redundancy.

Completeness3/5

The tool surface lacks deletion operations for interfaces and categories, and there is no tool to retrieve a single category or menu item directly. While core CRUD is partially covered, notable gaps exist that could hinder full project management.

Maintenance

ActivityInactive
ResponsivenessNo issues