Design System MCP Server
Provides resources, tools, and prompts for a Design System via MCP protocol, enabling component search, reading, and related component discovery.
README
MCP Server (HTTP) para Design System
Microsserviço HTTP em NodeJS (Express) que implementa o protocolo MCP via JSON‑RPC para expor recursos de um Design System. A fonte de dados é Markdown (mock local) ou S3.
Stack
- NodeJS + Express
@modelcontextprotocol/sdk+zod@aws-sdk/client-s3gray-matter
Configuração
Copie .env.example para .env e ajuste:
PORT=3000
MOCK_S3=true
AWS_REGION=us-east-1
AWS_ACCESS_KEY_ID=changeme
AWS_SECRET_ACCESS_KEY=changeme
S3_BUCKET=meu-bucket-design-system
S3_PREFIX=components/
MOCK_S3=trueusamock-data/components/*.md.- Para S3 real:
MOCK_S3=false+ credenciais e bucket.
Execução
- Dev:
npm run dev - Prod/local:
npm start - Base:
http://localhost:3000
Endpoints
GET /health→{ status, service, mock }POST /mcp→ JSON‑RPC 2.0 (MCP via SDK)GET /mcp→ abre SSE (servidor→cliente) para uma sessãoDELETE /mcp→ encerra a sessão atual
Observação: As rotas REST de componentes (/components, /components/:id) foram removidas. O acesso aos componentes acontece exclusivamente via MCP.
MCP (SDK oficial)
- Servidor:
McpServercomStreamableHTTPServerTransport. - Recursos:
ResourceTemplate('component://{id}')com listagem dinâmica e leitura de markdown. - Ferramentas (schemas
zod):search_components,related_components. - Prompt:
component_usage.
Requisitos de chamada HTTP
- Header
Acceptdeve incluirapplication/jsonetext/event-stream. initializedeve ser enviado comprotocolVersion(ex.:2025-03-26).- Após
initialize, incluaMcp-Session-IdeMcp-Protocol-Versionem todas as chamadas subsequentes.
CURLs (SDK)
- Initialize (captura sessão)
curl -s -i -X POST http://localhost:3000/mcp \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-d '{
"jsonrpc":"2.0",
"id":"init",
"method":"initialize",
"params":{
"clientInfo":{"name":"cli","version":"1.0.0"},
"capabilities":{"jsonResponse":true},
"protocolVersion":"2025-03-26"
}
}'
# Observe o header mcp-session-id na resposta e exporte:
# SID=... (valor do header)
- Listar recursos (reutiliza sessão)
curl -s -i -X POST http://localhost:3000/mcp \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-H "Mcp-Session-Id: $SID" \
-H 'Mcp-Protocol-Version: 2025-03-26' \
-d '{"jsonrpc":"2.0","id":"lr","method":"resources/list","params":{}}'
- Ler recurso (por URI)
curl -s -i -X POST http://localhost:3000/mcp \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-H "Mcp-Session-Id: $SID" \
-H 'Mcp-Protocol-Version: 2025-03-26' \
-d '{"jsonrpc":"2.0","id":"rr","method":"resources/read","params":{"uri":"component://button"}}'
- Listar ferramentas
curl -s -i -X POST http://localhost:3000/mcp \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-H "Mcp-Session-Id: $SID" \
-H 'Mcp-Protocol-Version: 2025-03-26' \
-d '{"jsonrpc":"2.0","id":"lt","method":"tools/list","params":{}}'
- Executar ferramenta
search_components
curl -s -i -X POST http://localhost:3000/mcp \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-H "Mcp-Session-Id: $SID" \
-H 'Mcp-Protocol-Version: 2025-03-26' \
-d '{"jsonrpc":"2.0","id":"ct1","method":"tools/call","params":{"name":"search_components","arguments":{"query":"input"}}}'
- Executar ferramenta
related_components
curl -s -i -X POST http://localhost:3000/mcp \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-H "Mcp-Session-Id: $SID" \
-H 'Mcp-Protocol-Version: 2025-03-26' \
-d '{"jsonrpc":"2.0","id":"ct2","method":"tools/call","params":{"name":"related_components","arguments":{"id":"button"}}}'
- SSE dedicado (opcional)
curl -s -N -X GET http://localhost:3000/mcp \
-H 'Accept: text/event-stream' \
-H "Mcp-Session-Id: $SID" \
-H 'Mcp-Protocol-Version: 2025-03-26'
- Encerrar sessão
curl -s -X DELETE http://localhost:3000/mcp \
-H "Mcp-Session-Id: $SID" \
-H 'Mcp-Protocol-Version: 2025-03-26' -i
Estrutura
src/
index.js # Express + transporte MCP
mcp-setup.js # Registro de recursos, ferramentas e prompt via SDK
datasource.js # S3 + mock
mock-data/
components/
.env.example
README.md
Debug com MCP Inspector
- Instale e conecte:
npx @modelcontextprotocol/inspector
- Na UI, conecte usando a URL:
http://localhost:3000/mcp.
Conexão com clientes MCP
- Claude Code:
claude mcp add --transport http design-system http://localhost:3000/mcp
- VS Code (exemplo JSON):
code --add-mcp '{"name":"design-system","type":"http","url":"http://localhost:3000/mcp"}'
Coleção Insomnia
- Importação:
- Abra o Insomnia → Application → Import Data → From File.
- Selecione o arquivo
insomnia_mcp_collection.jsonna raiz do projeto.
- Ambiente:
- A coleção já define
base_url(http://localhost:3000) eprotocol_version(2025-03-26).
- A coleção já define
- Encadeamento de sessão:
- A requisição
Initialize (capture session)captura o headermcp-session-id. - As demais requisições usam esse valor automaticamente com o template
{% response 'req_init', 'header', 'mcp-session-id' %}.
- A requisição
- Ordem sugerida:
Health→Initialize (capture session)→resources/list→resources/read (button)→tools/list→tools/call search_components→tools/call related_components→prompts/list→prompts/get component_usage (id=button)→GET SSE /mcp(opcional) →DELETE /mcp.
- Observações:
- Certifique-se de que o servidor esteja rodando (
PORT=3000 MOCK_S3=true node src/index.js). - O SSE é contínuo; interrompa manualmente quando terminar.
- Certifique-se de que o servidor esteja rodando (
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.