Component Code

Code with live parameters that you can change and see the component update.

我該用這個嗎

品質與安全性

A
說明品質
100%
結構描述完整度
100%
命名品質
80%
汙染風險
100%
權限相符程度
100%
協定合規性
100%

根據工具定義與協定合規性的自動化分析。

上下文成本

~909Token(工具定義)
~4.3 KB典型回應大小
中等的注意力影響(128k 上下文的 0.71%)

這是每次將伺服器的工具載入模型上下文時所消耗的約略 token 數量。數量越高,可用於其他工作的注意力就越少。

安裝

一鍵安裝

將以下內容加入你的 `claude_desktop_config.json` 檔案:

{
  "mcpServers": {
    "component-code": {
      "command": "npx",
      "args": [
        "@fabiocv/component-code-mcp"
      ]
    }
  }
}

可執行的套件

npm@fabiocv/component-code-mcp0.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"
}

社群

為此伺服器評分

證據

近期觀測

已驗證未記錄版本2 個工具