Docs: https://mcp-z.github.io/oauth Multi-account OAuth orchestration and token storage for MCP servers.
- Add consistent account tools to MCP servers
- Store OAuth tokens with a shared config and storage backend
- Reuse the same account lifecycle across Google and Microsoft providers
npm install @mcp-z/oauthOptional storage backends:
npm install keyv-duckdb
npm install keyv-filenpx @mcp-z/oauth initThis creates a .tokens/ directory and a default config file for token storage.
Use AccountServer to add account tools to your MCP server.
When using loopback OAuth, these tools are added:
account-meaccount-switchaccount-removeaccount-list
When using stateless auth (DCR/bearer tokens), only this tool is available:
account-me
import { AccountServer } from '@mcp-z/oauth';
const { tools, prompts } = AccountServer.createLoopback({
service: 'gmail',
store: tokenStore,
logger,
auth: authProvider
});Use sanitizeForLoggingFormatter to avoid leaking secrets in logs.
- Node.js >= 22