@fabiocv/component-code-mcp 0.0.0-stage → 0.1.1
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 +21 -0
- package/README.md +81 -2
- package/dist/stdio.js +92 -0
- package/package.json +59 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Fabio Azevedo
|
|
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
CHANGED
|
@@ -1,3 +1,82 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @fabiocv/component-code-mcp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
An MCP App that shows a React component in the chat in Component Code: a live
|
|
4
|
+
preview beside the code that uses it, where every value is a control.
|
|
5
|
+
|
|
6
|
+
It is one of the [`mcp-ui-tools`](../mcp-ui-tools), and installs on its own or
|
|
7
|
+
with the others.
|
|
8
|
+
|
|
9
|
+
Ask your agent for a component and say "show it in Component Code".
|
|
10
|
+
|
|
11
|
+
## Add it
|
|
12
|
+
|
|
13
|
+
Claude Code:
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
claude mcp add component-code -- npx -y @fabiocv/component-code-mcp
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Claude Desktop, in `claude_desktop_config.json`:
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"mcpServers": {
|
|
24
|
+
"component-code": {
|
|
25
|
+
"command": "npx",
|
|
26
|
+
"args": ["-y", "@fabiocv/component-code-mcp"]
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
VS Code:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
code --add-mcp '{"name":"component-code","command":"npx","args":["-y","@fabiocv/component-code-mcp"]}'
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Claude.ai, ChatGPT and other hosts that take a remote connector:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
https://mcp-ui-tools.fabio.cv/component-code/mcp
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## The tool
|
|
45
|
+
|
|
46
|
+
`show_in_component_code`, titled Show in Component Code, takes:
|
|
47
|
+
|
|
48
|
+
| Input | What it is |
|
|
49
|
+
| ---------- | ---------------------------------------------------------------------------------------- |
|
|
50
|
+
| `source` | The component's module in TSX. It may import only from `react`. |
|
|
51
|
+
| `code` | How it is used, in JSX: elements, props and text, with no hooks, calls or conditions. |
|
|
52
|
+
| `file` | The file named in the code's tab. |
|
|
53
|
+
| `controls` | How a prop is changed: a list of options, `{ min, max, step }` for a number, or `false`. |
|
|
54
|
+
|
|
55
|
+
The exports of `source` are what `code` can name, and a default export goes in
|
|
56
|
+
under its function's name. A component keeps any state inside itself, so `code`
|
|
57
|
+
stays plain JSX.
|
|
58
|
+
|
|
59
|
+
`show_html_in_component_code`, titled Show HTML in Component Code, takes:
|
|
60
|
+
|
|
61
|
+
| Input | What it is |
|
|
62
|
+
| ---------- | ------------------------------------------------------------------------------------------------------------------------------- |
|
|
63
|
+
| `files` | The files by name, such as `index.html`, `style.css` and `script.js`, each in its own tab. They run together as one page. |
|
|
64
|
+
| `controls` | The values the reader can change: an attribute, a CSS property or custom property, or a JS `const`. `true`, options or a range. |
|
|
65
|
+
|
|
66
|
+
## How it runs
|
|
67
|
+
|
|
68
|
+
- The preview is one HTML file with React, Component Code and Sucrase. The host
|
|
69
|
+
shows it in a sandboxed frame.
|
|
70
|
+
- Hosts allow inline scripts but not `eval`, so the preview compiles `source`
|
|
71
|
+
with Sucrase and runs it as a script element.
|
|
72
|
+
- It loads Geist from jsDelivr, which the resource declares. Everything else is
|
|
73
|
+
in the file.
|
|
74
|
+
- It follows the host's light or dark theme.
|
|
75
|
+
- A module that fails to compile, imports anything but `react` or throws shows
|
|
76
|
+
why in place of the preview.
|
|
77
|
+
- A page runs in a sandboxed frame inside the preview, under the host's rules,
|
|
78
|
+
so it cannot load anything from the network.
|
|
79
|
+
|
|
80
|
+
## Licence
|
|
81
|
+
|
|
82
|
+
MIT
|