Ant Design MCP Server (Python)
This Model Context Protocol (MCP) server fetches and structures Ant Design v4 (Chinese) component documentation into JSON so AI agents can perform analysis.
Features
- Fetch overview page and individual component pages.
- Extract component metadata: name, description, examples.
- Classify API tables automatically (props / events / methods / other).
- Cache fetched HTML locally.
- Export all components into a single JSON file.
- MCP tools exposed over JSON-RPC stdio.
Tools
- list_components(force?)
- get_component(name, force?)
- search_components(query)
- export_all(force?, filepath?)
Environment Setup
Choose one method:
venv (built-in)
python -m venv .venv
source .venv/bin/activate
pip install -r src/antd_mcp/requirements.txt
pyenv + venv
brew install pyenv
pyenv install 3.11.8
pyenv local 3.11.8
python -m venv .venv
source .venv/bin/activate
pip install -r src/antd_mcp/requirements.txt
Conda
conda create -n antd-mcp python=3.11 -y
conda activate antd-mcp
pip install -r src/antd_mcp/requirements.txt
Run Server
python -m antd_mcp
# or
python src/antd_mcp/server.py
JSON-RPC Examples
# List tools
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | python -m antd_mcp
# List components
echo '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"list_components","arguments":{}}}' | python -m antd_mcp
# Get one component
echo '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"get_component","arguments":{"name":"Button"}}}' | python -m antd_mcp
# Search components
echo '{"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"search_components","arguments":{"query":"form"}}}' | python -m antd_mcp
# Export all component data
echo '{"jsonrpc":"2.0","id":5,"method":"tools/call","params":{"name":"export_all","arguments":{}}}' | python -m antd_mcp
Export Output
Default file: src/antd_mcp/exports/antd_components_all.json
Structure:
{
"generated_at": <timestamp>,
"count": <number_of_components>,
"components": [
{
"name": "Button",
"title": "Button 按钮",
"intro": [...],
"props": [...],
"events": [...],
"methods": [...],
"other_tables": [...],
"table_summary": {"props":1,"events":0,...},
"examples": [...],
"source_url": "https://4x.ant.design/..."
}
]
}
TODO / Roadmap
- More precise table classification rules (column semantics).
- Parallel fetching & retry with backoff.
- Version / language (en vs cn) selection.
- CLI wrapper.
- Optional rate limiting.
License
MIT (add if needed)
安装 (发布后)
pip install antd-mcp-server
安装后命令行入口:
antd-mcp --once '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
本地构建与发布
# 构建
python -m build
# 上传到 PyPI
python -m twine upload dist/*
供 AI 工具使用的 mcp.json 示例
{
"version": 1,
"servers": {
"antd_mcp": {
"command": "antd-mcp",
"args": [],
"timeoutSeconds": 60
}
}
}
环境变量
ANTD_MCP_CACHE_DIR自定义缓存目录。MCP_PRETTY/MCP_COLOR控制输出格式。
版本
当前版本: 0.1.0
Metadata
Release files for antd-mcp-server 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| antd_mcp_server-0.1.0.tar.gz | 4.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| antd_mcp_server-0.1.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 8.7 kB
Release files / antd_mcp_server-0.1.0.tar.gz
| Download URL | antd_mcp_server-0.1.0.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
09f00c2774c93c6773e7704f4af4f0a136a08a559d8870b75a77d4997aff6790
|
|
BLAKE2b-256 checksum How to use checksums |
c372f51d9161df917e6faff3e3a919cc94d69efe73b4f20e644937927e1df7a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / antd_mcp_server-0.1.0-py2.py3-none-any.whl
| Download URL | antd_mcp_server-0.1.0-py2.py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
bcedda53f856783add31b12fef512fb55511307133f8c410ddeec97976f4a4d4
|
|
BLAKE2b-256 checksum How to use checksums |
aec20b876359333f66eafb9e99ff32c9db42788a145228a5fbf0e53207c86d98
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Security for antd-mcp-server 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.