connect

Docs

connect registers a design system with the coding apps in a project: it saves the project token once, on this computer, and writes each app's MCP settings into the project folder with no token in them. A teammate who pulls the repo runs it once for their own token; everything else is already wired.

How to use it

npx designsource connect [--apps claude,cursor,vscode,codex,gemini] [--yes] [--token <project token>] [--api <origin>]
npx designsource connect --forget [--project <id>]

Run it in your project. It names the project folder first (the nearest folder holding .git, else the current one; in a git worktree the token is saved for its main repository, so every worktree of it finds the token, and the files are written in the worktree), asks which apps to connect with the ones found on this computer ticked, asks for the project token, saves it, and writes the files. Then restart Cursor or VS Code if their file changed; Claude Code asks once to allow the server.

Flag Does
--apps The apps to set up, comma-separated, skipping the question.
--yes The apps found on this computer, no questions (also outside a terminal).
--token The project token, or DS_SYNC_TOKEN; replaces the saved one.
--api Another server. The origin is saved with the token.
--forget Remove this folder's saved token from this computer; settings files are left.
--project With --forget: which project, when several are connected to the folder.
--store file Keep the token in the private credentials file instead of the keychain, moving one already saved for this folder there first. For a coding agent whose sandboxed shell cannot read the keychain.

How it works

App File Entry
Claude Code .mcp.json mcpServers.designsource
Cursor .cursor/mcp.json mcpServers.designsource, type: "stdio"
VS Code (Copilot) .vscode/mcp.json servers.designsource, type: "stdio"
Codex .codex/config.toml [mcp_servers.designsource], startup_timeout_sec = 60, tool_timeout_sec = 300
Gemini CLI .gemini/settings.json mcpServers.designsource

Every entry runs npx -y designsource@latest mcp --project <project id> and carries no env: the server reads the token from this computer's store. Only the designsource entry is added or replaced; your other servers stay. A file with comments, or one that is not plain JSON, is not rewritten: the entry is printed for you to add by hand and the other apps carry on. An entry already naming this project is left alone, so teammates on other systems do not rewrite each other's.

Where the token lives. macOS: the login keychain. Linux: the Secret Service when it works, else the file. Windows: encrypted for your user with DPAPI, in the file. The file is ~/.config/designsource/credentials.json (%APPDATA%\designsource\credentials.json on Windows), readable only by you; it always holds the project names and connected folders, and the token itself only when no OS store works, which connect says. See Tokens and credentials.

Reruns ask nothing: in a connected folder the apps whose files already point at the project are set up again, the saved token is reused, and only a changed file prompts a restart. Connecting a folder takes it, and the folders inside it, from any project it was connected to before, so a folder holds one design system.

A regenerated token. When the server refuses the saved token, connect in a terminal asks for the new one and saves it; outside a terminal it stops and says to pass --token. A running agent's server reads the new token on its next call.

--api is saved with the token when it is not the default, so mcp --project, add, create and integrate in that folder use it without --api; connecting again on the default removes it. A saved token is sent only to the server it was saved for.

What can go wrong

  • No coding apps found. Pass --apps claude,cursor,vscode,codex,gemini. Nothing was detected on this computer; name the apps.
  • A home folder, one of its parents or a filesystem root is refused: those settings files are the apps' user-wide ones.
  • Codex reads it once you trust this project in Codex. and Gemini CLI reads it unless folder trust is on and this folder is not trusted. are printed for those two apps; trust the folder in the app.
  • Claude Code on Windows may need npx through cmd /c; add that in your own local scope (claude mcp add --scope local …) rather than in the committed file.