logoAnt Design

⌘ K
  • 设计
  • 研发
  • 组件
  • 博客
  • 资源
  • 国内镜像
YouMindTRACTIANLobeHubCodeRabbit
6.5.0
  • Ant Design of React
  • 更新日志
    v6.5.0
  • 如何使用
    • 快速上手
    • 在 Vite 中使用
    • 在 Next.js 中使用
      更新
    • 在 Umi 中使用
    • 在 Rsbuild 中使用
    • 在 Farm 中使用
    • 使用 Refine
  • AI
    • For Agents
      新增
    • design.md
      新增
    • LLMs.txt
      新增
    • MCP Server
      新增
    • CLI
      新增
  • 进阶使用
    • 定制主题
    • 样式兼容
    • 服务端渲染
    • 使用自定义日期库
    • 国际化
    • 通用属性
  • 迁移
    • 从 v5 到 v6
  • 其他
    • 社区精选组件
    • 贡献指南
    • 赞助
    • FAQ
什么是 MCP?
官方 MCP Server
工具
提示词
配置
在 AI 工具中的使用
社区 MCP Server
备选方案:使用 LLMs.txt
了解更多

MCP Server

文档
编辑此页LLMs.md
LLMs.txtCLI

相关资源

Ant Design X
Ant Design Charts
Ant Design Pro
Pro Components
Ant Design Mobile
Ant Design Mini
Ant Design Web3
Ant Design Landing-首页模板集
Scaffolds-脚手架市场
Umi-React 应用开发框架
dumi-组件/文档研发工具
qiankun-微前端框架
Ant Motion-设计动效
国内镜像站点 🇨🇳

社区

Awesome Ant Design
Medium
X
yuque logoAnt Design 语雀专栏
Ant Design 知乎专栏
体验科技专栏
seeconf logoSEE Conf-蚂蚁体验科技大会
加入我们

帮助

GitHub
更新日志
常见问题
For Agents
报告 Bug
议题
讨论区
StackOverflow
SegmentFault

Ant XTech logo更多产品

yuque logo语雀-构建你的数字花园
AntV logoAntV-数据可视化解决方案
Egg logoEgg-企业级 Node.js 框架
Kitchen logoKitchen-Sketch 工具集
Galacean logoGalacean-互动图形解决方案
WeaveFox logoWeaveFox-前端智能研发
xtech logo蚂蚁体验科技
主题编辑器
Made with ❤ by
蚂蚁集团和 Ant Design 开源社区
loading

本指南介绍如何通过 Model Context Protocol (MCP) 在 AI 工具中使用 Ant Design。

什么是 MCP?

Model Context Protocol (MCP) 是一个开放协议,使 AI 模型能够与外部工具和数据源进行交互。通过 MCP,AI 助手可以访问实时文档、代码示例和 API 参考资料。

官方 MCP Server

从 @ant-design/cli v6.3.5 起,你可以通过 antd mcp 命令启动官方 MCP 服务器,提供 8 个工具和 2 个提示词,支持 IDE 集成。

工具

工具说明
antd_list列出可用组件
antd_info获取组件属性规格
antd_doc获取完整文档
antd_demo获取可运行的代码示例
antd_token查询 Design Token 值
antd_design_md获取设计语言文档
antd_semantic查看 DOM 结构和样式钩子
antd_changelog分析跨版本 API 变更

提示词

提示词说明
antd-expert将 Agent 定位为 Ant Design 专家
antd-page-generator辅助基于组件的页面创建

配置

将 MCP 服务器添加到 IDE 配置:

json
{
"mcpServers": {
"antd": {
"command": "npx",
"args": ["-y", "@ant-design/cli", "mcp"]
}
}
}

如果你已全局安装 CLI(npm i -g @ant-design/cli),也可以使用:

json
{
"mcpServers": {
"antd": {
"command": "antd",
"args": ["mcp"]
}
}
}

你可以通过额外参数指定 antd 版本:

json
{
"mcpServers": {
"antd": {
"command": "npx",
"args": ["-y", "@ant-design/cli", "mcp", "--version", "5.20.0"]
}
}
}

也可以让 CLI 自动写入支持的项目配置:

bash
antd setup --client claude
antd setup --client cursor --mode both
antd setup --client vscode --write-instructions
antd setup --client codex
antd setup --client claude --dry-run
antd setup --client claude --check

支持的客户端包括 claude、cursor、vscode 和 codex。Setup 模式包括 mcp、skill 和 both。

在 AI 工具中的使用

工具说明配置
Cursor添加到 .cursor/mcp.json 或设置 → 功能 → MCP。文档{ "mcpServers": { "antd": { "command": "npx", "args": ["-y", "@ant-design/cli", "mcp"] } } }
Windsurf添加到 ~/.codeium/windsurf/mcp_config.json。文档{ "mcpServers": { "antd": { "command": "npx", "args": ["-y", "@ant-design/cli", "mcp"] } } }
Claude Code添加到 Claude 设置的 mcpServers。文档{ "mcpServers": { "antd": { "command": "npx", "args": ["-y", "@ant-design/cli", "mcp"] } } }
VS Code添加到 .vscode/mcp.json 或设置 → MCP。文档{ "servers": { "antd": { "command": "npx", "args": ["-y", "@ant-design/cli", "mcp"] } } }
Codex添加到 .codex/mcp.json。文档{ "mcpServers": { "antd": { "command": "npx", "args": ["-y", "@ant-design/cli", "mcp"] } } }
Gemini CLI添加到 MCP 配置。文档{ "mcpServers": { "antd": { "command": "npx", "args": ["-y", "@ant-design/cli", "mcp"] } } }
Trae添加到 MCP 设置。文档{ "mcpServers": { "antd": { "command": "npx", "args": ["-y", "@ant-design/cli", "mcp"] } } }
Qoder添加到 MCP 配置。文档{ "mcpServers": { "antd": { "command": "npx", "args": ["-y", "@ant-design/cli", "mcp"] } } }
Neovate Code在设置中配置 MCP 或使用提示词描述任务。文档{ "mcpServers": { "antd": { "command": "npx", "args": ["-y", "@ant-design/cli", "mcp"] } } }

社区 MCP Server

你也可以使用社区维护的 MCP server:@jzone-mcp/antd-components-mcp

该 MCP server 提供以下功能:

  • list-components - 列出所有可用的 Ant Design 组件
  • get-component-docs - 获取指定组件的详细文档
  • list-component-examples - 获取组件的代码示例
  • get-component-changelog - 获取组件的更新日志

配置:

json
{
"mcpServers": {
"antd-components": {
"command": "npx",
"args": ["-y", "@jzone-mcp/antd-components-mcp"]
}
}
}

备选方案:使用 LLMs.txt

如果您的 AI 工具不支持 MCP,可以使用我们的 LLMs.txt 支持。我们提供:

  • llms.txt - 所有组件的结构化概览
  • llms-full.txt - 包含示例的完整文档

了解更多

  • Model Context Protocol 文档
  • Ant Design CLI
  • @ant-design/cli GitHub 仓库
  • Ant Design LLMs.txt 指南
  • @jzone-mcp/antd-components-mcp npm 地址