@c2n/mcp 0.0.7

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Nguyen Thai Vinh
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # @c2n/mcp
2
+
3
+ [Model Context Protocol](https://modelcontextprotocol.io) server that exposes the c2n web components to AI agents: component APIs (attributes, slots, events, native CSS parts, CSS variables with their theme tokens), usage and gallery examples, curated presets, the `@c2n/theme` tokens, variant code generation and the application workflow guides. Everything is bundled in `data/registry.json`, so it works offline in any project.
4
+
5
+ ## Use
6
+
7
+ The server uses stdio and can be launched by any MCP host:
8
+
9
+ ```bash
10
+ npx -y @c2n/mcp
11
+ ```
12
+
13
+ Claude Code project `.mcp.json`:
14
+
15
+ ```json
16
+ { "mcpServers": { "c2n": { "type": "stdio", "command": "npx", "args": ["-y", "@c2n/mcp"] } } }
17
+ ```
18
+
19
+ Codex project `.codex/config.toml`:
20
+
21
+ ```toml
22
+ [mcp_servers.c2n]
23
+ command = "npx"
24
+ args = ["-y", "@c2n/mcp"]
25
+ ```
26
+
27
+ Google Antigravity project `.agents/mcp_config.json` uses the same `mcpServers` command/args structure as the Claude example. The `@c2n/skill` package can install the skill and merge these configurations automatically.
28
+
29
+ Run the server from a project directory: it reports which `@c2n/*` packages are installed and serves the bundled API when the installed version differs. The registry is packaged locally, so tool calls do not require network access after installation.
30
+
31
+ Use `c2n-mcp --version` to inspect the installed server version and `c2n-mcp --help` for CLI usage.
32
+
33
+ The MCP server supplies structured component facts; it does not install component packages or edit an application by itself. Pair it with `@c2n/skill` when you also want the agent to follow c2n's application, theming and variant conventions. See the [AI tools guide](https://code2nguyen.github.io/web-components/guides/ai-tools) for the complete setup and example prompts.
34
+
35
+ ## Verify the connection
36
+
37
+ Restart the agent after adding its MCP configuration, then ask it to use the c2n MCP server to list components or inspect `c2-button`. A connected client should expose the tools below and report `@c2n/*` packages installed in the current project. If the server cannot start, run `npx -y @c2n/mcp --version` in that project to distinguish an npm/runtime problem from an MCP client configuration problem.
38
+
39
+ ## Tools
40
+
41
+ | Tool | Purpose |
42
+ | -------------------- | --------------------------------------------------------------------------------------- |
43
+ | `list_components` | Every component with tag, package, category, description, installed version |
44
+ | `search_components` | Free-text search across names, descriptions, attributes, slots, events, examples, icons |
45
+ | `get_component` | Full API of one component, CSS variables grouped by part/state with their theme token |
46
+ | `get_examples` | Searchable usage/gallery markup, CSS, intent and accessibility notes, paginated |
47
+ | `get_presets` | Curated presets as CSS variable values |
48
+ | `get_theme` | The `--c2-theme--*` tokens, install/mapping snippets; per-component mapping with `tag` |
49
+ | `generate_variant` | CSS class / HTML + style / Lit subclass / JSON from variable + attribute overrides |
50
+ | `get_workflow_guide` | `workflow`, `theming`, `variant-components`, `frameworks` |
51
+
52
+ Resources: `c2n://components`, `c2n://components/{tag}`, `c2n://theme`, `c2n://guide/{topic}`.
53
+
54
+ ## Development
55
+
56
+ - `data/registry.json` is an ignored build artifact. `npm run build:tools` (repo root) regenerates it from the component manifests, docs content, presets and theme, then compiles `dist/` and refreshes the committed skill fallback.
57
+ - `dev`, `inspect`, `smoke` and `npm pack` automatically build the registry when needed.
58
+ - `npm run smoke -w packages/tools/mcp` spawns the server over stdio and checks every tool.
59
+ - `npm run inspect -w packages/tools/mcp` opens the MCP Inspector against the source entry (`node src/cli.ts`, Node 24 type stripping).