用于身份验证管理的 MCP 服务器
企业级身份验证解决方案,提供:
analyze_project
- 分析项目结构以获取身份验证设置建议setup_better_auth
- 使用项目 ID 和 API 密钥配置身份验证提供者analyze_current_auth
- 检测现有的 auth.js/next-auth 实现generate_migration_plan
- 创建逐步迁移路径test_auth_flows
- 验证登录/注册/重置/两步验证流程test_security
- 运行符合 OWASP 的安全检查analyze_logs
- 审查身份验证系统日志中的问题monitor_auth_flows
- 实时身份验证监控better-auth://config
- 当前 Better-Auth 配置设置better-auth://logs
- 身份验证系统日志克隆并安装:
git clone https://github.com/better-auth-mcp-server/better-auth-mcp-server.git
cd better-auth-mcp-server
npm install

构建服务器:
npm run build
开发时自动重建:
npm run watch
# Required
BETTER_AUTH_PROJECT_ID=your-project-id
BETTER_AUTH_API_KEY=your-api-key
# Optional
BETTER_AUTH_ENV=development|staging|production
LOG_LEVEL=info|debug|error

API 密钥管理
访问控制
监控
要通过 Smithery 自动安装适用于 Claude Desktop 的 Better Auth MCP 服务器:
npx -y @smithery/cli install @nahmanmate/better-auth-mcp-server --client claude
要在 Claude Desktop 中使用该服务器,请添加服务器配置:
在 MacOS 上:~/Library/Application Support/Claude/claude_desktop_config.json
在 Windows 上:%APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"better-auth-mcp-server": {
"command": "node",
"args": ["/path/to/better-auth-mcp-server/build/index.js"],
"disabled": false,
"alwaysAllow": []
}
}
}

由于 MCP 服务器通过标准输入输出通信,调试可能具有挑战性。我们建议使用 MCP Inspector,它作为一个包脚本提供:
npm run inspector
Inspector 将提供一个 URL 以便您在浏览器中访问调试工具。
// Initialize Better-Auth in your project
await mcp.useTool('setup_better_auth', {
projectPath: './my-next-app',
config: {
projectId: process.env.BETTER_AUTH_PROJECT_ID,
apiKey: process.env.BETTER_AUTH_API_KEY
}
});
// Test core authentication flows
await mcp.useTool('test_auth_flows', {
flows: ['login', 'register', '2fa']
});

// Analyze current auth implementation
await mcp.useTool('analyze_current_auth', {
projectPath: './my-next-app'
});
// Generate migration steps
await mcp.useTool('generate_migration_plan', {
projectPath: './my-next-app',
currentAuthType: 'next-auth'
});
