Component Code
Code with live parameters that you can change and see the component update.
使うべきか
品質と安全性
ツール定義とプロトコルへの準拠に関する自動分析に基づいています。
コンテキストコスト
これは、サーバーのツールがモデルのコンテキストに読み込まれるたびに消費されるおおよそのトークン数です。数が多いほど、ほかのタスクに使える注意が減ります。
インストール
ワンクリックインストール
これを `claude_desktop_config.json` ファイルに追加してください:
{
"mcpServers": {
"component-code": {
"command": "npx",
"args": [
"@fabiocv/component-code-mcp"
]
}
}
}実行可能なパッケージ
0.6.4stdioリモートエンドポイント
https://mcp.fabio.cv/component-code/mcpstreamable-httpできること
ツール一覧
ツール(2)
🟢component_code_show(source, code, file, controls)
Shows a React component in the chat in Component Code: a live preview beside the code that uses it. Each string, number and boolean in the code becomes a control the reader can change. Use it when someone asks to show a component in Component Code, or to see, preview or try one.
入力スキーマ
{
"type": "object",
"properties": {
"source": {
"type": "string",
"description": "The component's module in TSX. It may import only from 'react'. Its exports, the default one by its function's name, are what `code` can name. For each value the reader can change by using the component, such as `checked`, `open` or `value`, take a matching `onCheckedChange`, `onOpenChange` or `onValueChange` prop and call it with the new value, and give that value `{ change: true }` in `controls`. Component Code passes it then, so the change shows in the code. Keep state of its own only for when the prop is missing."
},
"code": {
"type": "string",
"description": "How the component is used, in JSX: elements, props and text only, with no hooks, calls or conditions. It is shown as code and rendered as the preview. Each string, number and boolean in it becomes a control."
},
"file": {
"description": "The file named in the code's tab, such as `Card.tsx`.",
"type": "string"
},
"controls": {
"description": "How a prop is changed, by its name or by `Element.prop`: a list of options, `{ min, max, step }` for a number, or `false` to keep it as written. `{ change: true }` lets the component change it too, through its `on<Prop>Change`, and takes a list as `options`.",
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"anyOf": [
{
"type": "boolean",
"const": false
},
{
"type": "array",
"items": {
"type": [
"string",
"number"
]
}
},
{
"type": "object",
"properties": {
"min": {
"type": "number"
},
"max": {
"type": "number"
},
"step": {
"type": "number"
},
"options": {
"type": "array",
"items": {
"type": [
"string",
"number"
]
}
},
"change": {
"type": "boolean"
}
}
}
]
}
}
},
"required": [
"source",
"code"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢component_code_show_html(files, controls)
Shows HTML, CSS and JS running in the chat in Component Code: the page beside its code, with a tab for each file. The values named in `controls` become controls the reader can change. Use it when someone asks to show HTML, CSS, JS, a canvas or an SVG in Component Code, or for an experiment without React.
入力スキーマ
{
"type": "object",
"properties": {
"files": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"type": "string"
},
"description": "The files by name, such as `index.html`, `style.css` and `script.js`, each in its own tab. They run together as one page in a sandboxed frame: the HTML is the page's body, with the CSS in a style element and the JS in a script element after it. The page cannot load anything from the network, so draw with canvas, SVG or the DOM."
},
"controls": {
"description": "The values the reader can change, by name: an attribute, as `r` or `circle.r`, a CSS property or custom property, as `--speed`, or a JS `const` set to a number, string or boolean. Each takes `true`, a list of options, or `{ min, max, step }` for a number. CSS changes apply as the reader drags, while HTML and JS run the page again, so a script that reads custom properties each frame follows along.",
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"anyOf": [
{
"type": "boolean",
"const": true
},
{
"type": "array",
"items": {
"type": [
"string",
"number"
]
}
},
{
"type": "object",
"properties": {
"min": {
"type": "number"
},
"max": {
"type": "number"
},
"step": {
"type": "number"
}
}
}
]
}
}
},
"required": [
"files"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}コミュニティ
エビデンス