[PR #7307] [MERGED] feat(mcp): add setup_auth tool #24116

Closed
opened 2026-04-15 22:11:02 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7307
Author: @Paola3stefania
Created: 1/12/2026
Status: Merged
Merged: 1/13/2026
Merged by: @himself65

Base: canaryHead: feat/mcp-setup-auth


📝 Commits (10+)

📊 Changes

15 files changed (+1957 additions, -84 deletions)

View changed files

📝 packages/cli/src/commands/mcp.ts (+208 -81)
packages/mcp/package.json (+53 -0)
packages/mcp/src/index.ts (+20 -0)
packages/mcp/src/lib/generator.ts (+467 -0)
packages/mcp/src/lib/parser.ts (+111 -0)
packages/mcp/src/lib/schemas.ts (+61 -0)
packages/mcp/src/lib/templates/database.ts (+140 -0)
packages/mcp/src/lib/templates/features.ts (+224 -0)
packages/mcp/src/lib/templates/frameworks.ts (+274 -0)
packages/mcp/src/lib/types.ts (+167 -0)
packages/mcp/src/tools/index.ts (+1 -0)
packages/mcp/src/tools/setup-auth.ts (+174 -0)
packages/mcp/tsconfig.json (+6 -0)
packages/mcp/tsdown.config.ts (+7 -0)
📝 pnpm-lock.yaml (+44 -3)

📄 Description


Summary by cubic

Add @better-auth/mcp: an MCP stdio server and CLI to scaffold Better Auth. Update the mcp command to install local (setup) and remote (docs) servers in Cursor, Claude Code, Open Code, and manual mcp.json, with --local-only/--remote-only.

  • New Features

    • New package @better-auth/mcp with ESM build via tsdown and TypeScript config.
    • CLI bin better-auth-mcp that starts an MCP server over stdio (name better-auth, version 0.0.1).
    • setup_auth MCP tool that generates or updates auth/client/API files, required env vars, install/migration commands, next steps, and doc links.
    • Config parser and strong types to detect existing database/ORM/features and compute diffs for selective updates.
    • mcp command now adds both local (setup & diagnostics) and remote (docs & search) servers to Cursor, Claude Code, Open Code, and manual mcp.json, plus --local-only and --remote-only.
  • Dependencies

    • Added @modelcontextprotocol/sdk and zod.

Written for commit 345d8578d2. Summary will update on new commits.

Install it via cli mcp:

npx @better-auth/cli mcp --cursor              # Install both
npx @better-auth/cli mcp --cursor --local-only # Local only
npx @better-auth/cli mcp --cursor --remote-only # Remote only


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/7307 **Author:** [@Paola3stefania](https://github.com/Paola3stefania) **Created:** 1/12/2026 **Status:** ✅ Merged **Merged:** 1/13/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `feat/mcp-setup-auth` --- ### 📝 Commits (10+) - [`033a5e6`](https://github.com/better-auth/better-auth/commit/033a5e690ed06f2cf8344d64cdbbfd8b942677e4) feat: mcp package - [`603ceb6`](https://github.com/better-auth/better-auth/commit/603ceb604e2b253cd0829f8375df9cf5bc6cbd43) feat: types - [`5aa1d93`](https://github.com/better-auth/better-auth/commit/5aa1d9397f45143fab86df58e631912716b2c921) feat: templates - [`000194d`](https://github.com/better-auth/better-auth/commit/000194d2d6844af0bb065f5b8bcb6684d4dc63e4) feat: parser + generator - [`7b4bb90`](https://github.com/better-auth/better-auth/commit/7b4bb90a818e889bb0aa4e899ea8e9d2c9f8c1f5) feat: setup tool - [`cebb635`](https://github.com/better-auth/better-auth/commit/cebb635b880be77194b96a88f8516c88eb48c089) feat: mcp cli - [`4f051a8`](https://github.com/better-auth/better-auth/commit/4f051a8e0bd8aca2fc510bd8afb0ec249c79a2b8) feat: add to init - [`8da9c37`](https://github.com/better-auth/better-auth/commit/8da9c37b6b0959cbf91858287afd7f249410fa3a) Merge branch 'canary' into feat/mcp-setup-auth - [`a07e472`](https://github.com/better-auth/better-auth/commit/a07e47210704bad484f57360ff5cfa3560016af7) make lint happy - [`4516158`](https://github.com/better-auth/better-auth/commit/45161588b36cfe93fbdd732a608ce10d3cec5876) feat: add detailed info to be mroe verbose ### 📊 Changes **15 files changed** (+1957 additions, -84 deletions) <details> <summary>View changed files</summary> 📝 `packages/cli/src/commands/mcp.ts` (+208 -81) ➕ `packages/mcp/package.json` (+53 -0) ➕ `packages/mcp/src/index.ts` (+20 -0) ➕ `packages/mcp/src/lib/generator.ts` (+467 -0) ➕ `packages/mcp/src/lib/parser.ts` (+111 -0) ➕ `packages/mcp/src/lib/schemas.ts` (+61 -0) ➕ `packages/mcp/src/lib/templates/database.ts` (+140 -0) ➕ `packages/mcp/src/lib/templates/features.ts` (+224 -0) ➕ `packages/mcp/src/lib/templates/frameworks.ts` (+274 -0) ➕ `packages/mcp/src/lib/types.ts` (+167 -0) ➕ `packages/mcp/src/tools/index.ts` (+1 -0) ➕ `packages/mcp/src/tools/setup-auth.ts` (+174 -0) ➕ `packages/mcp/tsconfig.json` (+6 -0) ➕ `packages/mcp/tsdown.config.ts` (+7 -0) 📝 `pnpm-lock.yaml` (+44 -3) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Add @better-auth/mcp: an MCP stdio server and CLI to scaffold Better Auth. Update the mcp command to install local (setup) and remote (docs) servers in Cursor, Claude Code, Open Code, and manual mcp.json, with --local-only/--remote-only. - **New Features** - New package @better-auth/mcp with ESM build via tsdown and TypeScript config. - CLI bin better-auth-mcp that starts an MCP server over stdio (name better-auth, version 0.0.1). - setup_auth MCP tool that generates or updates auth/client/API files, required env vars, install/migration commands, next steps, and doc links. - Config parser and strong types to detect existing database/ORM/features and compute diffs for selective updates. - mcp command now adds both local (setup & diagnostics) and remote (docs & search) servers to Cursor, Claude Code, Open Code, and manual mcp.json, plus --local-only and --remote-only. - **Dependencies** - Added @modelcontextprotocol/sdk and zod. <sup>Written for commit 345d8578d29dc1ae062e1c8f67613696adfabb8c. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> Install it via cli mcp: ``` npx @better-auth/cli mcp --cursor # Install both npx @better-auth/cli mcp --cursor --local-only # Local only npx @better-auth/cli mcp --cursor --remote-only # Remote only ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-15 22:11:02 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#24116