feat: add Claude Code as a supported MCP client#172
Open
GilbertLS wants to merge 1 commit into
Open
Conversation
Add a ClaudeCodeClientManager that configures the Auth0 MCP server for the Claude Code CLI, prompting for user scope (~/.claude.json) or project scope (.mcp.json at a project root). Wire it into the client registry, ClientType union, init command, and CLI help text.
4a47bff to
cdbe70e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Adds Claude Code (the Anthropic CLI) as a sixth supported MCP client for the
initcommand, alongside Claude Desktop, Cursor, Windsurf, VS Code, and Gemini.ClaudeCodeClientManager(src/clients/claude-code.ts) extendingBaseClientManager. It overridesconfigure()to prompt for a configuration scope, then delegates to the base merge logic since both scopes use the standardmcpServerskey:~/.claude.json(available across all projects). Default when prompted..mcp.jsonat a user-specified project folder (shared via version control).src/clients/index.ts): registered under the key'claude-code'— the key must equal theClientTypestring exactly, sinceinitresolves managers viaclients[clientType].src/clients/types.ts): added'claude-code'to theClientTypeunion.src/index.ts,src/commands/init.ts): addedclaude-codeto the--clienthelp text, an example invocation, and JSDoc.README.md): new "Claude Code" section documentinginit --client claude-codeand the user-vs-project scope prompt.Config format written matches what Claude Code expects for a stdio server (verified against the Claude Code MCP docs):
{ "mcpServers": { "auth0": { "command": "npx", "args": ["-y", "@auth0/auth0-mcp-server", "run", "--tools", "*"], "env": { "DEBUG": "auth0-mcp" } } } }Usage
References
Testing
Verified with both automated tests and a manual end-to-end run against a real Auth0 tenant and a live Claude Code install.
Automated:
npm run build,npm run typecheck,npm run lint, andnpm testall pass (388 tests, 35 files). New suitetest/clients/claude-code.test.tscovers: default user-scope path resolution; project-scope path resolution; throw when the project folder does not exist;getConfigPathfallback when no folder is set; the scope prompt (defaultuser); the project-folder prompt; and that themcpServersmerge preserves pre-existing top-level keys in~/.claude.json. Existinginit/registry suites were extended to include the new client.Manual end-to-end (real CLI, real tenant):
node dist/index.js init --client claude-code --scopes 'read:clients', completed the device-auth browser login, chose Project, and entered a project folder. Confirmed<folder>/.mcp.jsonwas written with theauth0entry undermcpServers.auth0entry was merged into~/.claude.jsonundermcpServers, and that all pre-existing servers (asana, atlassian, github, lucid, playwright, slack, zoom) and ~40 other top-level keys (projects,userID, etc.) were preserved untouched.claude mcp listfrom the project directory and confirmedauth0: npx -y @auth0/auth0-mcp-server run --tools * - ✓ Connected, proving Claude Code actually loads and connects to the configured server. (Project-scope.mcp.jsontakes precedence over the user-scope entry in that directory, per Claude Code's documented scope hierarchy.)Checklist