Better Auth Server

Better Auth Server

🚀 更好的身份验证 MCP 服务器

这是一款用于身份验证管理的企业级解决方案,能提供安全可靠的身份验证服务。它具备基于 AES - 256 加密的安全凭证管理、多协议认证以及实时威胁检测与防御等功能,为企业的身份验证管理保驾护航。

smithery 徽章

✨ 主要特性

核心工具

  • 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 - 身份验证系统日志

📦 安装指南

通过 Smithery 安装

要自动通过 Smithery 安装 Better Auth MCP 服务器,可执行以下命令:

npx -y @smithery/cli install @nahmanmate/better-auth-mcp-server

完成安装后,您可以在 node_modules/.bin 中找到可执行文件。

手动安装

要手动安装,请从 GitHub 克隆仓库:

git clone https://github.com/better-auth-mcp-server/better-auth-mcp-server.git
cd better-auth-mcp-server
npm install

开发环境安装

克隆并安装:

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

📚 详细文档

配置

环境变量

# 必需
BETTER_AUTH_PROJECT_ID=your-project-id
BETTER_AUTH_API_KEY=your-api-key

# 可选
BETTER_AUTH_ENV=development|staging|production
LOG_LEVEL=info|debug|error

安全最佳实践

  1. API 密钥管理
    • 将 API 密钥存储在环境变量中
    • 定期轮换密钥
    • 为每个环境使用不同的密钥
  2. 访问控制
    • 实现速率限制
    • 配置 IP 白名单
    • 使用最小权限原则
  3. 监控
    • 启用审核日志
    • 监控身份验证失败情况
    • 设置对可疑活动的警报

调试

要调试服务器,请运行:

npm run debug

要使用 MCP Inspector 进行调试,请安装并运行:

npm install -g @mcp/debug && mcp-debug better-auth-mcp-server

💻 使用示例

基础用法

const { BetterAuth } = require('better-auth-mcp-server');
const auth = new BetterAuth({
projectId: 'your-project-id',
apiKey: 'your-api-key'
});
// 使用 auth 对象进行身份验证操作

高级配置

const { BetterAuth } = require('better-auth-mcp-server');
const auth = new BetterAuth({
projectId: 'your-project-id',
apiKey: 'your-api-key',
environment: 'production',
logLevel: 'info'
});
// 使用 auth 对象进行身份验证操作

调试示例

npm run debug
# 或者使用 MCP Inspector
mcp-debug better-auth-mcp-server
  • 0 关注
  • 0 收藏,12 浏览
  • system 提出于 2025-09-30 17:33

相似服务问题