Keyset MCP
Configures and verifies GitHub OAuth App credentials in existing Next.js projects, including calculating homepage and callback URLs, importing client ID and secret, and updating Better Auth/Auth.js configuration.
Configures and verifies Google OAuth in existing Next.js projects, including creating or importing Google Web OAuth client credentials, calculating authorized JavaScript origins and redirect URIs, and updating Better Auth/Auth.js configuration.
Automates Google Cloud Console to create and configure Google Web OAuth clients, including Google Auth Platform application information, audience, contact information, and OAuth client credentials for use in Next.js projects.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Keyset MCPset up Google OAuth in my Next.js project and verify the redirect"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Keyset
Keyset configures and verifies OAuth providers in existing Next.js projects. It detects the project and authentication library, calculates the correct callback URLs, stores credentials in an ignored local environment file, updates the auth configuration idempotently, and checks the real authorization redirect.
It is intended for developers and coding agents that want a repeatable OAuth setup workflow without copying client secrets through chat, logs, or source files.
What Keyset does
For a supported project, Keyset can:
detect Next.js, Better Auth or Auth.js, the package manager, development port, auth route, environment files, and existing provider configuration;
calculate authorized JavaScript origins and OAuth redirect URIs;
create a Google Web OAuth client through a visible Chrome session with
--auto;import existing Google Web credentials or GitHub OAuth App credentials;
write credentials to
.env.localwithout printing their values;add Google or GitHub to an existing Better Auth/Auth.js configuration while preserving other providers;
avoid duplicate source changes and duplicate Google clients on repeated runs;
roll local changes back if post-setup verification fails;
run static, semantic, and optional runtime verification; and
expose the same project-aware operations to agents through a local MCP server.
Keyset does not replace Better Auth or Auth.js. It configures their OAuth provider integration and verifies the resulting flow.
Related MCP server: GitHub Integration Hub
Supported surface
Area | Supported |
Framework | Next.js 14-compatible project shapes |
Auth libraries | Better Auth, Auth.js / NextAuth.js |
Providers | Google OAuth, GitHub OAuth |
Automated cloud provisioning | Google Web OAuth client through visible Chrome |
Interfaces | CLI, local MCP server, Provider SDK, Codex and Claude Code instructions |
Runtime | Node.js 20 or newer |
Package managers detected | npm, pnpm, yarn, Bun |
See Compatibility for the exact tested matrix and known limits.
Installation
Install from this repository
The packages have not yet been published to the npm registry. Until the first registry release, install and link the CLI from source:
git clone https://github.com/fatih-developer/keyset.git
cd keyset
npm install
npm run build
npm link --workspace=@key-set/cli
keyset --versionThe link exposes both keyset and its bundled keyset mcp commands. Uninstall
the global source link later with:
npm unlink --global @key-set/cliInstall from npm after the registry release
Once @key-set/cli is published, the normal installation will be:
npm install --global @key-set/cli
keyset --versionThe npm scope is public, but publishing requires maintainer access to the
@key-set scope. Registry credentials must never be placed in this repository.
Prerequisites
Node.js 20 or newer;
an existing Next.js project using Better Auth or Auth.js;
Google Chrome for
keyset setup google --auto;access to the Google Cloud project when using automatic Google setup; and
an ignored
.env.localfile or a.gitignorerule that covers it.
Set KEYSET_CHROME_PATH when Chrome is installed in a non-standard location.
Quick start: automatic Google OAuth
Run Keyset from the application directory:
cd path/to/your-nextjs-app
keyset inspect
keyset setup google --auto
keyset verify google --runtimeOr target a project explicitly:
keyset setup google --auto --project H:\Project\my-appThe automatic flow works as follows:
Keyset inspects the application without executing project code.
It opens a normal, isolated Chrome profile at Google Cloud Console.
You complete Google login, two-step verification, and Cloud project selection. Keyset never asks for or reads your Google password.
Keyset completes the Google Auth Platform application information, audience, contact information, and finish steps. This includes accepting the required Google API Services User Data Policy for the selected project.
It creates a Web application OAuth client with the detected local origin and callback URI.
It reads the newly created Client ID and Client Secret in memory, writes them to
.env.local, and never emits their raw values.It updates the detected Better Auth or Auth.js source when needed.
It verifies the resulting configuration. Repeating the command on an already configured project returns
already_configuredwithout creating a new client.
For the default Next.js development port, the generated values are:
Authorized JavaScript origin: http://localhost:3000
Redirect URI: http://localhost:3000/api/auth/callback/googlePass a deployed origin when both local and production URLs should be registered:
keyset setup google --auto --production-url https://app.example.comIf Google changes the Console UI and Keyset cannot safely finish, it stops before applying newly read credentials, saves a diagnostic screenshot in the system temporary directory, and leaves Chrome available for inspection.
Manual Google setup
Preview the exact values first:
keyset setup google --dry-runThen import an exported Google Web client JSON file:
keyset setup google --credentials ./client_secret.jsonOr supply credentials non-interactively:
keyset setup google \
--client-id "123456-example.apps.googleusercontent.com" \
--client-secret "replace-with-the-real-secret"Avoid command-line flags on shared machines because shell history may retain their values. An exported credential file with restrictive permissions is safer.
Better Auth receives GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET. Auth.js
receives AUTH_GOOGLE_ID and AUTH_GOOGLE_SECRET.
GitHub OAuth setup
GitHub provisioning is currently guided. Keyset calculates the homepage and callback URL, then applies credentials from the OAuth App you create:
keyset setup github --dry-run
keyset setup github --client-id "your-client-id" --client-secret "your-client-secret"
keyset verify githubSee Providers for the GitHub console steps.
Inspection, diagnostics, and verification
keyset inspect # detect project facts
keyset providers # list provider capabilities
keyset doctor # report actionable findings
keyset verify google # static and semantic checks
keyset verify google --runtime # boot app and inspect OAuth redirect
keyset verify google --json # machine-readable, redacted output
keyset init # create .keyset/config.json if absentRuntime verification executes the detected project development command on a temporary available port. Use it only for project code you trust. It verifies the authorization redirect structure; it does not log into an end-user Google account or complete the final callback.
Use --project <path> with any project command when the current directory is
not the target application.
MCP for coding agents
The local MCP server lets compatible agents request typed OAuth operations instead of reimplementing setup with unrestricted shell commands.
After installing/linking the CLI, register it with a supported client:
keyset mcp install codex
keyset mcp install claudePreview the configuration change with --dry-run. Existing MCP servers are
preserved and real config mutations receive a numbered backup.
The agent workflow is:
inspect_project
→ plan_provider_setup
→ import_credentials
→ setup_provider
→ verify_providerAvailable MCP tools are inspect_project, list_providers,
plan_provider_setup, import_credentials, setup_provider, doctor, and
verify_provider. Only setup_provider changes an application project. MCP
responses redact secrets and the server does not expose a generic shell tool.
See MCP and Skills for client and agent setup.
What changes in an application
Depending on the detected adapter, setup may change only:
.env.local, using the adapter-specific Client ID and Client Secret names;the detected Better Auth or Auth.js configuration source; and
.keyset/config.jsonwhenkeyset initis explicitly run.
Provider packages do not edit source directly, and auth adapters do not create cloud credentials. Core coordinates these boundaries and rolls back local changes when verification fails.
Security model
Secrets are wrapped in a redacting value type and are not ordinary CLI/MCP output.
.env.exampleis never treated as a credential source.Secret-bearing environment files are checked against
.gitignore.Mutations are constrained to the inspected project root.
Google automation uses a visible browser; login and 2FA remain under the user's control.
Diagnostics, test fixtures, release archives, and source must contain no live credentials.
Review Security and the Threat model before using Keyset in security-sensitive automation. Report vulnerabilities privately; never open an issue containing credentials.
Repository structure
Package | Responsibility |
| Inspection, plans, transactions, secret-safe env writes, diagnostics, verification |
| User-facing |
| Local MCP protocol and typed agent tools |
| Visible Chrome automation for Google Web client creation |
| Google and GitHub provider plans and credential validation |
| Better Auth detection and source mutation |
| Auth.js detection and source mutation |
| Provider plugin contracts |
Runtime and compatibility fixtures live under examples/ and compatibility/.
Architecture and operational documentation lives under docs/.
Development and release checks
npm install
npm run build
npm run typecheck
npm run test
npm run lint
npm run verify
npm run test:packed
node scripts/security/secret-sentinel.mjs
node scripts/security/package-audit.mjs
npm run release:rcnpm run verify runs lint, type checking, tests, and a complete workspace
build. test:packed installs generated package archives into an isolated
temporary project and exercises the distributed CLI and MCP entry points.
release:rc creates ignored, checksummed release archives under
release-artifacts/.
Limitations
Google Cloud Console automation depends on the current Console UI and an installed Chrome browser.
Google login, 2FA, and project selection intentionally require the user.
GitHub OAuth App creation is guided rather than browser-automated.
Frameworks other than Better Auth and Auth.js are not currently supported.
Production runtime verification is not a substitute for a complete real-user sign-in test.
npm registry packages are prepared but not published yet.
Documentation
License
Keyset is available under the MIT License.
This server cannot be deployed
Maintenance
Related MCP Connectors
OAuth 2.1 short-link tools for AI agents with scoped tokens, approvals, audit logs, and revocation.
Connect AI agents to 1000+ apps with managed authentication and tool-calling.
MCP server connecting AI agents to 100+ apps (Gmail, Slack, Notion, GitHub) via one-click OAuth.
Helps AI coding agents integrate MetaMask Embedded Wallets (Web3Auth) SDKs.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to automate Next.js development including project scaffolding, React component generation, API route creation, and full-stack application workflows with TypeScript and Tailwind CSS support.MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to interact with GitHub through OAuth-authenticated operations including starting authorization flows, listing repositories, and creating issues using stored access tokens.1-

Next.js DevTools MCPofficial
AlicenseAqualityBmaintenanceProvides specialized development tools and utilities for Next.js, allowing AI agents to perform runtime diagnostics and access official documentation. It enables automated context initialization and real-time interaction with Next.js development servers to query application state.472,601 npm820MIT- AlicenseNot gradedqualityBmaintenanceEnables MCP-compatible clients to inspect Next.js codebases, analyze App Router and Pages Router structure, discover API routes, and audit build performance through controlled tools.7 npmMIT