GovBR-DS MCP
GovBR DS MCP
为**巴西联邦政府设计系统(GovBR-DS)而生的开源模型上下文协议(MCP)**服务器。
govbr-ds-mcp 为人工智能代理提供对 GovBR-DS 文档、其组件、无障碍指南、搜索、资源(Resources)及可复用开发工作流的结构化访问。
其目标是让 Codex、Claude Code、Kiro 及其他兼容 MCP 的客户端能够基于同步的官方文档来理解和使用 GovBR 设计系统,而不是仅仅依赖模型的先验知识。
该包以 govbr-ds-mcp 的名称发布在 npm 上,可直接通过以下命令运行:
npx -y govbr-ds-mcp这是一个社区独立项目。它不是巴西联邦政府的官方项目,也不由 GovBR-DS 负责团队维护。
为什么有这个项目?
人工智能代理能够快速生成前端代码,但并不总是知道:
应该使用哪个 GovBR-DS 组件;
某个组件应该如何表现;
适用哪些无障碍建议;
推荐哪些使用模式;
特定信息位于 GovBR-DS 文档的哪个位置。
govbr-ds-mcp 旨在通过模型上下文协议(Model Context Protocol)提供 GovBR-DS 文档来解决这一问题。
Agente de IA
│
▼
govbr-ds-mcp
│
├── Tools
├── Resources
├── Prompts
└── Busca
│
▼
Dados estruturados locais
▲
│
Sincronização da documentação
▲
│
Repositório oficial GovBR-DSMCP 服务器内部不使用 LLM,在正常运行期间也不会发起外部请求。
Related MCP server: PortOne Global MCP Server
功能特性
文档同步
文档从 GovBR-DS 官方仓库获取,并转换为本地结构化数据。
GitLab GovBR-DS
│
▼
GitLab API
│
▼
Parser Markdown
│
▼
Componentes estruturados
│
▼
components.generated.ts生成的数据存储在本地,使 MCP 服务器在同步后无需互联网连接即可运行。
目前,该项目同步了 GovBR-DS 的 37 个已文档化组件。
MCP 工具(Tools)
list_components
列出本地文档索引中可用的 GovBR-DS 组件。
示例:
{}响应:
[
{
"name": "Button",
"slug": "button",
"description": "..."
},
{
"name": "Input",
"slug": "input",
"description": "..."
}
]get_component
返回指定 GovBR-DS 组件的完整结构化文档。
示例:
{
"name": "button"
}搜索不区分大小写。
以下调用是等效的:
button
Button
BUTTONsearch_docs
在本地同步的 GovBR-DS 文档中进行搜索。
示例:
{
"query": "como usar um botão",
"limit": 5
}搜索机制支持:
不区分大小写的搜索;
不区分重音符号的搜索;
移除葡萄牙语停用词;
组件别名;
词形变化的规范化;
已识别组件的优先排序;
按章节相关性排序;
生成相关摘要片段;
按组件筛选。
示例:
{
"query": "acessibilidade aria",
"component": "button",
"limit": 5
}搜索完全在内存中进行。
不使用:
嵌入(embeddings);
向量数据库;
Elasticsearch;
LLM;
外部搜索服务。
MCP 资源(Resources)
GovBR-DS 文档也通过 MCP 资源(Resources)提供。
组件目录
govbr-ds://catalog提供所有已同步组件的索引。
组件文档
govbr-ds://components/{slug}示例:
govbr-ds://components/button以 Markdown 格式返回组件的完整文档。
无障碍文档
govbr-ds://components/{slug}/accessibility示例:
govbr-ds://components/button/accessibility返回该组件可用的无障碍指南。
并非所有 GovBR-DS 组件都有专门的无障碍文档。
资源(Resources)完全基于本地同步的数据生成。
MCP 提示词(Prompts)
服务器为使用 GovBR-DS 的常见开发工作流提供可复用的提示词(Prompts)。
implement_govbr_component
提供某个组件的已同步官方文档及帮助其实施的说明。
示例:
{
"component": "button",
"requirements": "Preciso de uma ação principal para confirmar o formulário."
}该提示词(Prompt)向模型提供相关组件的文档,使实施以 GovBR-DS 为依据。
review_govbr_component
提供组件文档以及需要审查的代码片段。
示例:
{
"component": "button",
"code": "<button class=\"br-button\">Enviar</button>"
}审查随后可将所提供的实现与同步文档中可用的指南进行比较。
check_govbr_accessibility
提供某个组件的无障碍指南,以协助审查实现。
示例:
{
"component": "button",
"code": "<button class=\"br-button circle\"><i class=\"fas fa-plus\"></i></button>"
}MCP 服务器不会执行或解释收到的代码。
代码仅作为文本处理,并作为上下文提供给所连接的模型。
架构
src/
├── data/
│ ├── components.ts
│ └── components.generated.ts
│
├── ingestion/
│ ├── gitlab-client.ts
│ ├── component-parser.ts
│ └── component-sync.ts
│
├── services/
│ ├── component.service.ts
│ └── search.service.ts
│
├── tools/
│ ├── list-components.ts
│ ├── get-component.ts
│ └── search-docs.ts
│
├── resources/
│ ├── register-resources.ts
│ ├── component.resource.ts
│ └── accessibility.resource.ts
│
├── prompts/
│ ├── register-prompts.ts
│ ├── implement-component.prompt.ts
│ ├── review-component.prompt.ts
│ └── accessibility-review.prompt.ts
│
├── formatters/
│ └── component-markdown.ts
│
├── types/
│
└── index.ts
scripts/
└── sync-components.ts应用程序的主要流程是:
Cliente MCP
│
▼
govbr-ds-mcp
│
┌─────────────┼─────────────┐
│ │ │
Tools Resources Prompts
│ │ │
└─────────────┼─────────────┘
▼
Services locais
│
▼
Dados sincronizados
▲
│
sync:components
▲
│
GovBR-DS oficial快速使用
Node.js 22+
npm
无需克隆或全局安装该包。MCP 客户端可以直接通过 npx 启动已发布的服务器:
npx -y govbr-ds-mcp该服务器使用 MCP stdio 传输方式,并利用包内附带的 GovBR-DS 数据运行,查询期间不会进行 HTTP 调用。
在 MCP 客户端中的配置
Claude Desktop
将服务器添加到 Claude Desktop 的配置文件中:
{
"mcpServers": {
"govbr-ds": {
"command": "npx",
"args": ["-y", "govbr-ds-mcp"]
}
}
}保存文件后,重新启动 Claude Desktop。
另请参阅 Claude 的 MCP 文档。
Claude Code
通过终端注册服务器:
claude mcp add govbr-ds -- npx -y govbr-ds-mcp使用 claude mcp list 确认注册。
Codex
添加到 ~/.codex/config.toml 文件中:
[mcp_servers.govbr-ds]
command = "npx"
args = ["-y", "govbr-ds-mcp"]也可以通过终端注册:
codex mcp add govbr-ds -- npx -y govbr-ds-mcp手动更改配置后,重新启动 Codex。
另请参阅 Codex 的 MCP 文档。
Kiro
在 Kiro 中,打开或创建工作区中的 .kiro/settings/mcp.json。若要全局使用该服务器,请使用 ~/.kiro/settings/mcp.json:
{
"mcpServers": {
"govbr-ds": {
"command": "npx",
"args": ["-y", "govbr-ds-mcp"],
"disabled": false,
"autoApprove": []
}
}
}保存后,打开 Kiro 的 MCP 面板,确认 govbr-ds 已连接。
另请参阅 Kiro 的 MCP 文档。
本地开发
克隆仓库并安装依赖:
git clone https://github.com/FelipeVergaraChico/govbr-ds-mcp.git
cd govbr-ds-mcp
npm install运行 MCP 服务器
以开发模式启动服务器:
npm run dev该服务器使用 MCP stdio 传输方式。
由于 stdout 保留用于 MCP 协议通信,应用程序日志应发送到 stderr。
避免:
console.log("Servidor iniciado");推荐:
console.error("Servidor iniciado");MCP Inspector
可以使用 MCP Inspector 测试该项目。
运行:
npx @modelcontextprotocol/inspector npx -y govbr-ds-mcp在 Inspector 中可以测试可用的功能。
Tools
list_components
get_component
search_docsResources
govbr-ds://catalog
govbr-ds://components/{slug}
govbr-ds://components/{slug}/accessibilityPrompts
implement_govbr_component
review_govbr_component
check_govbr_accessibility同步 GovBR-DS 文档
要更新本地索引:
npx tsx scripts/sync-components.ts同步过程:
通过 GitLab API 访问 GovBR-DS 公共仓库;
识别已文档化的组件;
下载每个组件的 Markdown 文件;
在可用时下载无障碍文档;
解析 Markdown 文件;
规范化数据;
生成 MCP 使用的本地数据集。
生成的数据存储在:
src/data/components.generated.ts该文件是自动生成的,不应手动编辑。
在正常运行期间,MCP 服务器不会查询 GitLab。
这使得即使没有互联网连接,也可以使用工具(Tools)、资源(Resources)、提示词(Prompts)和搜索功能。
运行测试
运行:
npm test测试套件涵盖以下领域:
Markdown 解析;
组件搜索;
不区分大小写的搜索;
重音符号规范化;
别名;
规范化;
搜索排序;
摘要片段生成;
MCP 工具(Tools);
MCP 资源(Resources);
MCP 提示词(Prompts);
文档格式化;
对不存在组件的处理。
单元测试不依赖 GitLab 的可用性。
开发
安装依赖:
npm install运行服务器:
npm run dev运行测试:
npm test更新本地文档:
npx tsx scripts/sync-components.ts打开 MCP Inspector:
npx @modelcontextprotocol/inspector npx tsx src/index.ts数据来源
本项目使用的文档来自 GovBR 设计系统的官方仓库:
当前的摄取过程主要使用:
ds/componentes/组件文档通常具有类似以下的结构:
ds/componentes/button/
├── button.md
├── button-access.md
└── imagens/主文件通常包含以下信息:
描述;
用法;
结构组成;
类型;
行为;
规格说明。
在可用时,*-access.md 文件包含特定的无障碍指南。
并非所有组件都拥有完全相同的文件集。
同步过程旨在处理这些差异,而不会中断数据集的生成。
项目原则
官方文档优先
在可能的情况下,MCP 提供的信息应基于 GovBR-DS 的已同步官方文档。
目标是减少人工智能代理凭空编造设计系统中不存在的规则或行为的情况。
不依赖 LLM
MCP 服务器不依赖:
OpenAI;
Anthropic;
Google;
本地模型;
任何其他人工智能供应商。
模型由所连接的 MCP 客户端负责。
本地运行时
外部请求仅在文档同步期间使用,而非在正常的 MCP 查询期间使用。
npx tsx scripts/sync-components.ts
│
└── Internet necessária
npm run dev
│
└── Documentação local简单搜索优先于复杂基础设施
当前搜索使用确定性的文本排序。
该项目不依赖:
嵌入(embeddings);
向量数据库;
RAG 基础设施;
外部搜索服务。
对于当前数量的文档,结构良好的本地搜索能使项目更简单、可预测且轻量。
小型响应
工具 search_docs 返回相关摘要片段,而不是将整个文档发送给模型。
这有助于减少:
上下文数量;
Token 消耗;
无关信息;
过大的响应。
当需要完整文档时,代理可以使用 get_component 或 MCP 资源(Resources)。
路线图
已完成
支持
stdio传输方式的 MCP 服务器组件列表
单个组件查询
GovBR-DS 文档同步
结构化 Markdown 解析器
自动生成本地数据集
本地文档搜索
相关性排序
葡萄牙语查询规范化
MCP 资源(Resources)
无障碍资源(Resources)
组件目录
MCP 提示词(Prompts)
提示词(Prompts)中的组件自动补全
计划中
官方 HTML 和 CSS 实施示例
与
@govbr-ds/core的集成GovBR Web Components 文档
GovBR React Components 文档
按组件的实施示例
GovBR-DS 代码验证
无障碍验证辅助工具
在 npm 上发布
在 MCP Registry 上发布
HTTP 传输
相关项目
此 MCP 旨在补充 govbr-design-system 技能。
这两个项目具有不同的职责:
govbr-design-system
│
└── Instruções, regras e boas práticas
para orientar agentes de IA
govbr-ds-mcp
│
└── Documentação, busca, Resources,
Tools e Prompts兼容的代理可以将它们一起使用。
从概念上讲:
Agente de IA
│
┌───────────┴───────────┐
│ │
Skill MCP
│ │
Como se comportar O que a documentação diz
Boas práticas Componentes
Regras de uso Acessibilidade
Orientações Busca
Resources如何贡献
欢迎贡献。
一些值得贡献的领域:
改进文档解析器;
改进搜索相关性;
创建新的测试;
支持 GovBR-DS 新的官方来源;
改进与 MCP 客户端的兼容性;
支持官方库;
识别未文档化的组件;
修正被错误解读的数据。
在提交 Pull Request 之前:
npm test同时确认项目仍然通过仓库中使用的 typecheck/构建检查。
声明
govbr-ds-mcp 是一个独立的开源项目。
它不由巴西联邦政府或 GovBR 设计系统负责团队维护、认可或提供官方支持。
项目使用的 GovBR-DS 文档和资源仍受其各自原始项目的许可和条款约束。
许可证
请参阅 LICENSE 文件以了解本项目的许可证信息。
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol implementation that enables AI-powered access to documentation resources, featuring URI-based navigation, template matching, and structured documentation management.9MIT
- AlicenseNot gradedqualityDmaintenanceEnables searching and reading of PortOne documentation, including OpenAPI schemas and product guides, through the Model Context Protocol. It allows AI agents to easily access and integrate payment-related technical specifications into their workflows.11ISC
- AlicenseAqualityDmaintenanceProvides AI assistants with direct access to the complete Godot Engine documentation, including classes, tutorials, and features. It enables developers to retrieve and analyze official documentation through natural language interfaces using the Model Context Protocol.2MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to automate web tasks such as browsing, clicking, typing, and taking screenshots via the Model Context Protocol.1MIT
Related MCP Connectors
Search @imqueue docs and scaffold typed services & clients from your AI coding agent.
Provide your AI coding tools with token-efficient access to up-to-date technical documentation for…
The best web search for your AI Agent
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/FelipeVergaraChico/gov-ds-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server