@amedia/brick-mcp 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: brick-mcp
3
- version: 0.1.3
3
+ version: 1.0.3
4
4
  selector: N/A
5
5
  category: Utilities
6
- tags: [mcp, model-context-protocol, ai, llm, development-tools, cli, design-system]
7
- use_cases: [ai-assisted-development, component-discovery, design-tokens-access, code-generation]
8
- related: [brick-tokens, brick-template]
6
+ tags: [mcp, model-context-protocol, ai, llm, development-tools, cli, design-system, server]
7
+ use_cases: [ai-assisted-development, component-discovery, design-tokens-access, code-generation, ssr-guidance]
8
+ related: [brick-tokens, brick-template, brick-themes]
9
9
  ---
10
10
 
11
11
  # Brick MCP
@@ -14,106 +14,94 @@ A Model Context Protocol (MCP) server that provides AI assistants with direct ac
14
14
 
15
15
  ## Key Capabilities
16
16
 
17
- - Exposes three MCP tools for AI assistants to query Brick components and design tokens
17
+ - Exposes three MCP tools (`list-components`, `get-component-docs`, `get-design-tokens`) for AI assistants to query the Brick design system
18
18
  - Provides component discovery with filtering by name, category, or tags
19
- - Delivers detailed component documentation including props, examples, and Storybook links
20
- - Gives access to design tokens filtered by category or theme
21
- - Runs in stdio mode (for Claude Code) or HTTP mode (for local development)
22
- - Pre-generates and bundles all data as JSON for fast, standalone operation
23
- - Enables accurate, context-aware AI assistance when implementing Brick components
19
+ - Delivers detailed, LLM-optimized component documentation including props, examples, and CDN paths
20
+ - Gives access to design tokens filtered by category, with compact text output to minimize context window usage
21
+ - Runs in stdio mode (recommended for Claude Code) or HTTP/SSE mode (for local development)
22
+ - Pre-generates and bundles all data as JSON at build time for fast, standalone operation without needing the Brick monorepo at runtime
24
23
 
25
24
  ## MCP Tools
26
25
 
27
- The server provides three tools that AI assistants can call:
26
+ The server registers three tools that AI assistants can call.
28
27
 
29
28
  ### list-components
30
29
 
31
- Lists all available Brick components with optional filtering.
30
+ Lists all available Brick components with optional filtering by name, category, or tag.
32
31
 
33
- **Input Schema:**
34
- ```typescript
35
- {
36
- filter?: string; // Filter by name, category, or tag
37
- }
38
- ```
32
+ | Parameter | Type | Default | Required | Description |
33
+ | --------- | ---- | ------- | -------- | ----------- |
34
+ | filter | string | undefined | No | Filter components by name, category, or tag (case-insensitive substring match) |
35
+
36
+ **Returns:** JSON object with a `components` array. Each entry contains:
39
37
 
40
- **Returns:**
41
38
  ```typescript
42
39
  {
43
40
  components: Array<{
44
41
  name: string; // e.g., "brick-button"
45
- version: string; // e.g., "9.0.0"
42
+ version: string; // e.g., "9.4.20"
46
43
  selector: string; // e.g., "brick-button-v9"
47
44
  description?: string;
48
- category?: string; // Forms, Navigation, Layout, Feedback, Display, Utilities
45
+ category?: string; // Forms, Navigation, Layout, Feedback, Display, or Utilities
49
46
  tags?: string[];
47
+ assetUrl?: string; // CDN base URL, e.g., "https://assets.acdn.no/pkg/@amedia/brick-button"
48
+ mainJsFile?: string; // Main JS filename, e.g., "brick-button.js"
50
49
  }>;
51
50
  }
52
51
  ```
53
52
 
53
+ **Example call:** `{ "filter": "button" }` returns all button-related components.
54
+
54
55
  ### get-component-docs
55
56
 
56
- Retrieves detailed documentation for one or more components.
57
+ Retrieves detailed LLM-optimized documentation for one or more components. First looks for a markdown file in `data/components/{name}.md`, falling back to JSON component data if no markdown exists.
57
58
 
58
- **Input Schema:**
59
- ```typescript
60
- {
61
- components: string[]; // e.g., ["brick-button", "brick-modal"]
62
- }
63
- ```
59
+ | Parameter | Type | Default | Required | Description |
60
+ | --------- | ---- | ------- | -------- | ----------- |
61
+ | components | string[] | - | Yes | Array of component names (e.g., `["brick-button", "brick-card"]`) |
64
62
 
65
- **Returns:**
66
- ```typescript
67
- {
68
- docs: Array<{
69
- name: string;
70
- version: string;
71
- selector: string;
72
- description?: string;
73
- examples: {
74
- webComponent?: string;
75
- storybook?: string; // Link to Chromatic Storybook
76
- };
77
- cdnPath?: string; // Eik CDN URL
78
- }>;
79
- }
80
- ```
63
+ **Returns:** JSON object with a `docs` array of strings. Each string is either the full markdown documentation content for that component or a JSON-serialized component data object as fallback.
64
+
65
+ **Example call:** `{ "components": ["brick-button", "brick-teaser"] }`
81
66
 
82
67
  ### get-design-tokens
83
68
 
84
- Accesses design tokens from brick-tokens with filtering options.
69
+ Accesses design tokens from brick-tokens. Behavior differs based on whether a category is provided.
70
+
71
+ | Parameter | Type | Default | Required | Description |
72
+ | --------- | ---- | ------- | -------- | ----------- |
73
+ | category | `"colors"` \| `"spacing"` \| `"typography"` \| `"shadows"` \| `"borders"` | undefined | No | Filter tokens by category |
74
+
75
+ **Without category:** Returns a compact summary listing available categories with token counts and example paths. This avoids dumping all tokens into the context window.
85
76
 
86
- **Input Schema:**
87
- ```typescript
88
- {
89
- category?: 'colors' | 'spacing' | 'typography' | 'shadows' | 'borders';
90
- theme?: string; // e.g., "bergen", "alfa", "bt"
91
- }
77
+ ```
78
+ Available token categories:
79
+ - colors: 142 tokens (color.background.default, color.text.default, color.primary, ...)
80
+ - spacing: 24 tokens (spacing.1, spacing.2, spacing.3, ...)
81
+ - typography: 38 tokens (typography.heading.1, typography.body.default, ...)
82
+ - shadows: 6 tokens (box-shadow.small, box-shadow.medium, ...)
83
+ - borders: 12 tokens (border-width.thin, border-radius.small, ...)
84
+
85
+ Call with a specific category to see tokens.
92
86
  ```
93
87
 
94
- **Returns:**
95
- ```typescript
96
- {
97
- tokens: Array<{
98
- name: string;
99
- value: string;
100
- type: string;
101
- description?: string;
102
- category?: string;
103
- theme?: string;
104
- }>;
105
- themes: string[];
106
- documentation: {
107
- anOverview?: string;
108
- formats?: string;
109
- naming?: string;
110
- themes?: string;
111
- usage?: string;
112
- };
113
- }
88
+ **With category:** Returns a compact text listing where each line is `cssVariable: value -- description`.
89
+
114
90
  ```
91
+ --brick-color-background-default: #ffffff -- Default background color
92
+ --brick-color-text-default: #1a1a1a -- Default text color
93
+ ```
94
+
95
+ Note: Values shown are examples from one theme. Actual values vary across themes. Use the CSS variable for theme-aware styling.
115
96
 
116
- ## Examples
97
+ **Category-to-path-prefix mapping:**
98
+ - `colors` matches tokens with path starting with `color.`
99
+ - `spacing` matches `spacing.`
100
+ - `typography` matches `typography.`
101
+ - `shadows` matches `box-shadow.`
102
+ - `borders` matches `border-width.`, `border-radius.`, `border.`
103
+
104
+ ## Usage
117
105
 
118
106
  ### Installation via npx (Recommended)
119
107
 
@@ -139,6 +127,9 @@ npm install
139
127
  npm run build
140
128
 
141
129
  # Start HTTP server (default: http://localhost:3000)
130
+ npm run start:http
131
+
132
+ # Or with watch mode for development
142
133
  npm run dev:http
143
134
 
144
135
  # Add to Claude Code
@@ -147,14 +138,20 @@ claude mcp add Brick-http --transport sse --scope user -- http://0.0.0.0:3000/ss
147
138
 
148
139
  ### Environment Variables
149
140
 
150
- ```bash
151
- PORT=3000 # Server port (default: 3000)
152
- HOST=0.0.0.0 # Server host (default: 0.0.0.0)
153
- ```
141
+ | Variable | Default | Description |
142
+ | -------- | ------- | ----------- |
143
+ | PORT | 3000 | Server port (HTTP mode only) |
144
+ | HOST | localhost | Server host (HTTP mode only) |
145
+
146
+ ### HTTP Endpoints (HTTP Mode Only)
154
147
 
155
- ## Usage Workflow
148
+ | Endpoint | Method | Description |
149
+ | -------- | ------ | ----------- |
150
+ | `/health` | GET | Health check, returns `{ "status": "ok" }` |
151
+ | `/sse` | GET | SSE endpoint for MCP protocol communication |
152
+ | `/message?sessionId=X` | POST | Message endpoint for client-to-server communication |
156
153
 
157
- Once configured, AI assistants can use the MCP tools:
154
+ ### Workflow Example
158
155
 
159
156
  ```
160
157
  User: "I need to add a button to my app using Brick"
@@ -162,98 +159,44 @@ User: "I need to add a button to my app using Brick"
162
159
  AI Assistant:
163
160
  1. Calls list-components with filter: "button"
164
161
  2. Calls get-component-docs with components: ["brick-button"]
165
- 3. Provides implementation guidance with examples and CDN links
166
- ```
167
-
168
- ## HTTP Endpoints (HTTP Mode Only)
169
-
170
- When running in HTTP mode, the server exposes:
171
-
172
- - `http://localhost:3000/health` - Health check endpoint
173
- - `http://localhost:3000/sse` - SSE endpoint for MCP protocol communication
174
- - `http://localhost:3000/message` - Message endpoint for client-to-server communication
175
-
176
- ## Programmatic Usage
177
-
178
- ### Extending with Custom Tools
179
-
180
- To add a new MCP tool:
181
-
182
- 1. Create a new file in `src/tools/yourTool.ts`
183
- 2. Implement the tool function with input/output types using Zod
184
- 3. Register the tool in `src/server.ts` using `server.registerTool()`
185
-
186
- Example tool structure:
187
-
188
- ```typescript
189
- import { z } from 'zod';
190
-
191
- const InputSchema = z.object({
192
- parameter: z.string().optional(),
193
- });
194
-
195
- const OutputSchema = z.object({
196
- result: z.string(),
197
- });
198
-
199
- export const yourTool = {
200
- name: 'your-tool',
201
- description: 'Description of what your tool does',
202
- inputSchema: InputSchema,
203
- handler: async (input: z.infer<typeof InputSchema>) => {
204
- // Tool implementation
205
- return { result: 'output' };
206
- },
207
- };
162
+ 3. Provides implementation guidance with correct selector, CDN URL, and examples
208
163
  ```
209
164
 
210
- ## Data Sources
211
-
212
- The MCP server aggregates data from multiple sources during build:
213
-
214
- - **Component Metadata**: `data/components-metadata.json` (auto-generated)
215
- - **Component Documentation**: `data/components/*.md` (LLM-optimized docs)
216
- - **Design Tokens**: `brick-tokens/publications/publication/*.json`
217
- - **Token Documentation**: `data/tokens-documentation.json`
218
- - **Package Information**: Each component's `package.json`
219
-
220
165
  ## Technical Details
221
166
 
222
- - **Runtime**: Node.js
223
- - **Protocol**: Model Context Protocol (MCP) 1.25.2+
224
- - **Transport Modes**: stdio (recommended for Claude Code) or HTTP/SSE
167
+ - **Package version**: 1.0.3
168
+ - **Runtime**: Node.js (target: node22)
169
+ - **Protocol**: Model Context Protocol (MCP) via `@modelcontextprotocol/sdk` 1.27.1
170
+ - **Transport modes**: stdio (recommended for Claude Code) or HTTP/SSE (via Fastify 5.8.5)
225
171
  - **Dependencies**:
226
- - @modelcontextprotocol/sdk (MCP implementation)
227
- - fastify (HTTP server)
228
- - zod (schema validation)
229
- - **Build System**: Custom build script that pre-generates all JSON data
230
- - **Distribution**: Published to npm as `@amedia/brick-mcp`
172
+ - `@modelcontextprotocol/sdk` 1.27.1 (MCP implementation)
173
+ - `fastify` 5.8.5 (HTTP server)
174
+ - `@fastify/cors` 11.1.0 (CORS support for HTTP mode)
175
+ - `zod` 3.25.76 (schema validation)
176
+ - `zod-to-json-schema` 3.24.6 (JSON schema generation)
177
+ - **Build system**: esbuild (ESM bundle, platform: node)
178
+ - **Distribution**: Published to npm as `@amedia/brick-mcp`; executable via `npx @amedia/brick-mcp`
179
+ - **Binary**: `brick-mcp` (CLI entry point at `dist/index.js` with shebang)
231
180
 
232
- ## Publishing
181
+ ## Data Sources
233
182
 
234
- ### Standard Release
183
+ All data is pre-generated at build time by `scripts/generate-data.js` and bundled into the `data/` directory:
235
184
 
236
- ```bash
237
- # From Brick monorepo root
238
- npx changeset # Create a changeset
239
- # Create PR merge "Version Packages" PR created automatically
240
- # Merge "Version Packages" PR to publish to npm
241
- ```
185
+ - **`data/components-metadata.json`**: Lightweight metadata for all Brick components (auto-generated from each package's `package.json`)
186
+ - **`data/components/*.md`**: LLM-optimized markdown documentation per component
187
+ - **`data/components/*.json`**: Structured component data (fallback when no `.md` exists)
188
+ - **`data/tokens.json`**: Design tokens sourced from `brick-tokens/tokens-viewer/tokens-viewer.json`
189
+ - **`data/tokens-documentation.json`**: Token system documentation extracted from Storybook MDX files
242
190
 
243
- ### Snapshot Release (Testing)
244
-
245
- 1. Create a changeset
246
- 2. Run the [snapshot GitHub action](https://github.com/amedia/brick/actions/workflows/snapshotRelease.yml) for your branch and this package
191
+ Build also runs `scripts/check-docs-versions.js` which compares documentation versions against current package versions and warns about stale docs.
247
192
 
248
193
  ## Important Notes
249
194
 
250
- - The MCP server is designed to be run as a standalone npm package via npx
251
- - All data is pre-generated during build time for optimal performance
252
- - The server does not require access to the Brick monorepo at runtime
253
- - stdio mode is recommended for Claude Code integration
254
- - HTTP mode is useful for local development and testing
255
- - The server provides read-only access to Brick design system information
256
-
257
- ## Version
258
-
259
- Current version: 0.1.3
195
+ - **Version 1.0.0 breaking change**: The package was made public on npm. No API changes, but the package is now accessible to all consumers via `npx @amedia/brick-mcp`.
196
+ - The `get-design-tokens` tool no longer accepts a `theme` parameter (removed in 0.1.8). It returns compact text instead of structured JSON objects to minimize context window usage.
197
+ - Without a `category` argument, `get-design-tokens` returns only a summary of available categories rather than all tokens.
198
+ - The server does not require access to the Brick monorepo at runtime; all data is bundled at build time.
199
+ - stdio mode is recommended for Claude Code integration. HTTP mode is intended for local development and testing only.
200
+ - The server provides read-only access to Brick design system information.
201
+ - Excluded from metadata generation: `brick-actions`, `brick-icons`, `brick-template`, and `brick-mcp` itself.
202
+ - Component categories are inferred from the component name using keyword matching, not manually assigned.