1. Conduid
  2. Developer Tools
  3. yapi
MCP server · Developer Tools

yapi

YApi Auto MCP Server - Model Context Protocol server for YApi integration, enables AI tools like Cursor to interact with YApi API documentation

Unclaimed devtools
39Low

Scored 4 months ago · breakdown

About yapi

yapi is an MCP server published by git+leeguooooo in the Developer Tools category: yApi Auto MCP Server - Model Context Protocol server for YApi integration, enables AI tools like Cursor to interact with YApi API documentation. It has been installed 0 times through Conduid.

Install

Install
npx @leeguoo/yapi-mcp
Claude Code
claude mcp add cross-request-master -- npx -y @leeguoo/yapi-mcp
npx
npx -y @leeguoo/yapi-mcp

This server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.

Ask AI

Ask AI about yapi

Powered by Claude · Grounded in docs

I know everything about yapi. Ask me about installation, configuration, usage, or troubleshooting.

Security checks

  • ·README presentNot checked yet.
  • ·License declaredNot checked yet.
  • ·Tests presentNot checked yet.
  • ·Dependencies pinnedNot checked yet.
  • ·No dynamic code executionNot checked yet.
  • !Scoped permissionsDoesn't declare a permission scope. Assume it can do anything its process can.

README

Cross Request Master

GitHub Sponsors Chrome Web Store

面向 API 开发/测试的 Chrome 扩展:绕过 CORS 发请求、自动生成 cURL,并对 YApi「运行」页做增强(内嵌 cURL、路径参数 {param} 引导填写)。

本仓库包含生态内的多个子项目:

  • packages/yapi-mcp — CLI / Skill(发布包名保持为 @leeguoo/yapi-mcp,MCP 配置作为兼容方案保留,不影响扩展打包)
  • plugins/yapi-plugin — Cursor 与 Claude Code 插件(已从原独立仓库 leeguooooo/yapi-plugin 归档并整合回本仓库)

当前推荐安装链路是 npx skills add leeguooooo/cross-request-master -y -g 安装 Skill,再用 yapi config init 初始化 ~/.yapi/config.tomlyapi-mcp 已支持浏览器登录同步 Cookie(yapi login --browser),可用于仅支持 SSO/无法账号密码登录的 YApi 场景。

功能特性

  • 跨域请求(CORS bypass):在页面侧调用 crossRequest,由扩展后台代发
  • 内嵌 cURL:YApi「运行」页 URL 下方展示可复制的 cURL 命令
  • 路径参数引导:URL 含 {param} 时提示填写,避免请求失败
  • 固定 Header:为跨域请求自动追加自定义 Header
  • YApi 工具箱:Skill 一键安装(推荐,支持 npx skills add)/ Cursor 与 Claude Code 插件(plugins/yapi-plugin/)/ MCP 配置(兼容)/ CLI 使用与 docs-sync
  • 复制给 AI:把当前接口信息整理为 Markdown 一键复制
  • 现代请求支持:优先 fetch / Promise 工作流,兼容历史 $.ajax
  • Manifest V3:兼容最新 Chrome 扩展标准

安装

Chrome Web Store(推荐)
https://chrome.google.com/webstore/detail/efgjanhcajpiljllnehiinpmicghbgfm

开发者模式

git clone https://github.com/leeguooooo/cross-request-master.git
cd cross-request-master
./build-extension.sh

然后在 chrome://extensions/ 开启开发者模式 → “加载已解压的扩展程序” → 选择 build/

使用

在 YApi 中

安装后直接在 YApi「运行」页发送请求即可,扩展会自动处理跨域、显示 cURL,并把 JSON 响应解析为对象供脚本使用。

在接口详情页(基本信息区域右上角)额外提供:

  • YApi 工具箱:包含 Skill 一键安装(推荐,支持 Codex/Claude/Cursor 与 npx skills add)、MCP 配置(兼容)、CLI 使用与 docs-sync 说明(自动拼好命令)
  • 复制给 AI:把当前接口信息整理成 Markdown(仅接口相关字段)复制到剪贴板

如果你要在本机直接装好 Skill + CLI,当前最短路径是:

npm install -g @leeguoo/yapi-mcp
npx skills add leeguooooo/cross-request-master -y -g
yapi config init --base-url=https://your-yapi-domain.com --auth-mode=global --email=your_email@example.com
yapi login --base-url=https://your-yapi-domain.com --browser

更完整说明见 packages/yapi-mcp/README.md

ClawHub Skill 同步

  • ClawHub 地址:leeguooooo/yapi
  • 通过项目脚本同步(已接入 clawhub sync --all):
pnpm run clawhub:sync:dry
pnpm run clawhub:sync

YApi OpenAPI(Yapi-MCP tool 同名方法)

扩展在页面侧额外暴露 window.crossRequest.yapiMcp(也可用 window.crossRequest.yapi),把 YApi OpenAPI 封装成与 Yapi-MCP 一致的 5 个方法,方便直接在浏览器控制台/脚本里操作接口文档:

// 先配置(支持多项目:'28:token1,29:token2')
window.crossRequest.yapiMcp.configure({
  baseUrl: 'https://your-yapi-domain.com',
  token: '28:your_project_token'
});

// 查接口、拉分类、搜索、保存
const api = await window.crossRequest.yapiMcp.yapi_get_api_desc({ projectId: '28', apiId: '66' });

在任意网页中手动调用

window.crossRequest({
  url: 'https://api.example.com/data',
  method: 'GET',
  headers: { Authorization: 'Bearer token' },
  success(res) {
    console.log('Success:', res);
  },
  error(err) {
    console.error('Error:', err);
  }
});

crossRequest 也会返回 Promise:

const resp = await window.crossRequest({ url: '/api/ping' });
console.log(resp.status, resp.data);

兼容模式:jQuery(Legacy)

大多数场景建议直接使用 fetch + window.crossRequest。以下仅用于历史页面仍依赖 $.ajax 时:

  • YApi/目标站点:默认拦截所有 $.ajax。如需关闭:crossRequest: false
  • 其他站点:默认不拦截。需显式开启:crossRequest: true
$.ajax({
  url: 'https://api.example.com/data',
  method: 'GET',
  crossRequest: true
});

文件上传(FormData)

const fd = new FormData();
fd.append('file', fileInput.files[0]);
fd.append('name', 'demo');

await window.crossRequest({
  url: 'https://api.example.com/upload',
  method: 'POST',
  body: fd
});

TypeScript 类型定义

仓库内置 types/cross-request.d.ts,可直接复制到你的项目并在 tsconfig.json 中 include,或在 global.d.ts 引用:

/// <reference path="./types/cross-request.d.ts" />

已知限制 / FAQ

  • 自定义 Header 被放到 Access-Control-Request-Headers:这是浏览器 CORS 预检行为,需要服务端正确返回 Access-Control-Allow-Headers
  • Network 面板看不到请求:请求由扩展后台发出,不会出现在页面 Network;可在扩展 Service Worker 的 Network/Console 查看。

开发与测试(本仓库)

项目结构:

manifest.json        MV3 配置
background.js        Service Worker
content-script.js    注入/通信
index.js             页面侧 API 与适配器
popup.html/popup.js  扩展弹出窗口
src/helpers/         可复用 helper
tests/               Jest 单测
skills/yapi/         YApi Skill(canonical;自动同步到 packages/yapi-mcp/skill-template 与 plugins/yapi-plugin/skills)
packages/yapi-mcp/   CLI(@leeguoo/yapi-mcp)与 MCP skill-template
plugins/yapi-plugin/ Cursor 与 Claude Code 插件
docs/                文档(见 docs/README.md)

常用命令:

pnpm install
pnpm test
pnpm lint
pnpm format
./build-extension.sh

贡献与支持

  • 提交 Issue/PR 前请先看 CONTRIBUTING.md
  • 如果项目对你有帮助,欢迎 Star 或赞助:

赞助开发

如果你觉得这个项目对你有帮助,可以请作者喝杯咖啡:

GitHub Sponsors

GitHub Sponsors

微信 / 支付宝

更新日志

CHANGELOG.md

许可证

MIT License

相关链接

更多文档

  • 文档总览:docs/README.md
  • 测试指南:docs/TESTING.md
  • 技术路线图:docs/ROADMAP.md
  • YApi 插件(Cursor / Claude Code):docs/yapi-plugin/README.md

README mirrored from the source repository 4 months ago. The original is authoritative.

Questions

About yapi

How do I install yapi?

Run npx @leeguoo/yapi-mcp, then add the server to your MCP client's configuration. Conduid has recorded 0 installs, so the command is known to work with current clients.

Is yapi safe to use with an AI agent?

Its trust score is 39 out of 100 (low). It passes 0 of 1 static security checks; the failures are listed above. It has no ConduID identity yet, so agent calls to it are not receipted.

Is yapi still maintained?

Conduid hasn't recorded a commit date for this repository yet. Check the repository directly for recent activity.