mcp

Docs

mcp serves a design system to a coding agent over MCP on stdin and stdout: the tokens, every component's source, the blocks, your mockup page, an integration guide, and tools that add the UI kit or create a design system. It is not a command for a terminal: connect and login put it in your app's config, and the agent starts it.

How to use it

npx designsource mcp [--project <id>] [--token <project token>] [--api <origin>]
Flag Does
--project The saved project whose token to use; what connect writes.
--token A project token, or DS_SYNC_TOKEN; wins over a saved one.
--api Another server. A token is sent only to the default server, a server on this computer, or the one connect saved.

Three ways in, by what the entry carries:

  • --project <id>, written by connect: the token comes from this computer's store.
  • Nothing at all, written by login: the account sign-in, in the folders you ran login in.
  • --token or DS_SYNC_TOKEN, for a client connect does not cover: the Connect an agent dialog's Other apps fold holds the three config shapes, with a placeholder where the token goes.

Then ask the agent. In Claude Code, /mcp__designsource__integrate-design-system runs the guide; elsewhere, "integrate the design system using the designsource MCP". Headless claude -p needs the tools allowed, --allowedTools "mcp__designsource__*".

How it works

The server is plain stdio MCP: every client takes the same command, only the config file's shape differs. It starts without touching the network; the first tool call fetches the project (a snapshot of tokens, exports, kit sources, blocks and the guide), cached for 60 seconds, so a Save in the workbench shows on the next call. A bad token is a tool error, never a client startup failure.

React only for now. The initialize answer's instructions tell the agent the order:

DS source design systems, React apps only for now. Order: if this folder has no design system, create_design_system (or use_design_system); then add_ui_kit; then restyle the app with the components it added, and call check_design_system to see what still bypasses the kit. Never copy tokens, CSS variables or component source into the app by hand. Call get_integration_guide for the full steps.

get_tokens, get_css_variables, get_shadcn_theme and get_component_source still answer, and add one line after a blank line, chosen from the folder add_ui_kit would write into:

Folder Line
A React app without the kit This app does not have the UI kit yet. Do not apply these values by hand: call add_ui_kit, then use its components.
A package.json that is not React DS source supports React apps only for now. Tell the user this app is not supported yet; do not apply these values by hand.
No package.json, React apps without the kit below The first line, then Pass the app's folder to add_ui_kit.
A React app with the kit, or no app Nothing.

The tools are listed on MCP tools and prompts. Twelve read the design system, list_screens and get_screen_source among them. add_ui_kit adds the kit to the React app in the project folder with the same setup as add: with --project, the folder connect saved for it; with --token alone, the folder the client started in. When the app is elsewhere the agent passes folder: a path inside the project, or a repository of its own you ran login in, whose linked design system it then uses (see a workspace of repositories). A full run writes the /design-system section with its blocks unless no_blocks is true, and blocks: true adds the blocks to a section written without them, as add --blocks does. Naming screens (names from list_screens, or ["all"]; ["site"] writes the marketing pages' menu and footer) writes those screens with the parts and components they import, and a call that names neither components nor screens refreshes the screens already in the app; a screen you edited is kept, and the agent is never told to force a replacement. It never overwrites a component you edited, and your client asks before it runs. With login, four more act on your account: list_design_systems, create_design_system, use_design_system and generate_screen. check_design_system runs check with no token.

list_screens answers one line per screen or page, name — title (kind), and get_screen_source returns one screen's two files and the parts it imports; to use one, the agent calls add_ui_kit with screens. generate_screen makes a screen or marketing page from a sentence of up to 500 characters, or changes the one named in screen; an optional data_model (3 records of 12 fields at most) matches the sample data to your app's records. It works only with login, spends credits or your own AI key, can take a few minutes, and writes no files; the agent then calls add_ui_kit with screens.

On the account path the server uses the account only when the folder it was started in is exactly a trusted one, or a git worktree of one (add_ui_kit then writes into the worktree), and reads the folder's linked design system; a revoked sign-in stops every tool on the next call. Nothing but MCP messages goes to stdout, and no tool result carries a token.

Like every export, the tools that read the design system or write its kit (add_ui_kit included) need the project's account on Pro; on the free plan each answers with one line saying so. Account tools that only manage design systems, and generate_screen, work on any plan.

What can go wrong

Not connected? The server runs on this computer over stdio, started by your app as npx -y designsource@latest mcp; there is no web address to connect to instead. The user runs npx designsource login (or npx designsource connect with a project token) in a terminal in the project folder, commits the settings file it writes, and restarts the app. An app that opens each session in a fresh git worktree, and every teammate, gets the server only from a committed copy.

Each refusal names the command to run and who runs it; CLI errors quotes every one. The ones an agent meets first:

  • No token or sign-in here: the user runs login in the project folder, then restarts the app.
  • No design system is linked to this folder yet. The agent calls list_design_systems and use_design_system, or create_design_system.
  • Not sure which project folder to change: run npx designsource connect in it first. from add_ui_kit.
  • Against an older server, list_blocks and get_block_source answer that the server sent no blocks.