ScopeGate

io.github.alifanov由 GitHub 账号 alifanov 发布v1.0.1更新于 Oct 24, 2026

Permission gateway for AI agents: scoped MCP endpoints over 27 services, audited and revocable.

发布方自己的服务:Scope (AEC) - Preview

已验证Streamable HTTP可网页运行效率与工作流安全与监控

概览

AI 生成的概览

面向 AI 智能体的权限网关:为 27 项服务提供按操作授权的 MCP 端点,带审计日志与一键吊销。

可以做什么
  • 通过受限的 MCP 端点调用已连接的第三方服务,如 Gmail、日历、云端硬盘、Slack、Notion、Jira、HubSpot、Salesforce、Stripe、Airtable 等
  • 仅能执行该端点勾选的具体操作,例如只读邮件而不能发邮件
  • 按项目查看审计记录:谁调用了哪个工具、结果与耗时,并可导出
  • 通过重新生成端点密钥即时吊销访问,而服务连接本身保留
  • 按项目组织服务连接、端点与权限
适用场景
当智能体需要访问真实账号(邮件、日历、CRM、支付等),而你希望把它限制在少数确切操作上、而不是授予宽泛的 OAuth 权限,并且需要日志与快速切断访问的手段时适用。
运行要求
可使用 scopegate.dev 的远程端点并通过 OAuth 登录,或自托管:用 Docker Compose 一键启动(自带 PostgreSQL),或以 Node.js 20.19+/22.12+/24+ 配合 pnpm 与 PostgreSQL 运行。连接真实服务需在 .env 中为各提供商填写 OAuth client id/secret;自托管需配置 DATABASE_URL、BETTER_AUTH_SECRET、BETTER_AUTH_URL、ADMIN_EMAIL 与 ADMIN_PASSWORD。
安装前请注意
网关保存所连接账号的 OAuth 令牌,是高价值攻击目标;令牌加密存储,智能体只能看到 sg_ 密钥。端点可执行写操作,如发送邮件、创建、更新或删除日历事件与文件,应只授予必要操作。审计日志会记录请求详情。自托管需设置 BETTER_AUTH_SECRET 与管理员凭据,首次启动生成的管理员登录信息会打印在容器日志中。

安装

在 SourceWeft 中

  1. 打开 控制台中的 ScopeGate,将其添加到工作区。
  2. 连接 所需的 凭据。它们会被私密存储,绝不会在公开页面上展示。
  3. 为需要使用其工具的对话启用该服务。

Web executable,通过 Streamable HTTP。 远程服务在工作区中配置后即可从网页运行时运行。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

ScopeGate

Never hand an AI agent a full OAuth scope again.

ScopeGate sits between your agents and the accounts they reach — yours or your clients'. You connect a service once, tick the exact actions an agent may call, and hand it an MCP endpoint that can do nothing else. Every call is logged; one click kills the key without touching the connection.

  • Per-action permissions — gmail:read_emails yes, gmail:send_email no. Finer than any provider's OAuth scopes.
  • Audit trail — who, which tool, what outcome, how long. Per project, exportable.
  • One-click revocation — regenerate an endpoint key; the service connection stays.
  • Tokens never leave — AES-256-GCM at rest, refreshed automatically, agents only ever see sg_….

Run it yourself in one command:

bash
docker compose --profile local up

Open http://localhost:3000 — the admin login is printed in the container logs on first boot. Details in Quick Start.

Tech Stack

  • Framework: Next.js 16 (App Router)
  • Language: TypeScript
  • Database: PostgreSQL + Prisma 7
  • UI: Tailwind CSS v4, shadcn/ui
  • Auth: Better Auth (database-backed sessions, Prisma adapter)
  • MCP: @modelcontextprotocol/sdk (Streamable HTTP)
  • Package Manager: pnpm

Quick Start (self-hosted)

Full feature parity with the hosted cloud version — nothing is cut for self-host.

bash
git clone https://github.com/alifanov/scopegate.gitcd scopegatedocker compose --profile local up

Open http://localhost:3000. No .env file needed: a local Postgres and a fresh BETTER_AUTH_SECRET are provisioned automatically, and the generated admin login is printed once in the app container logs on first boot (look for Generated admin login) — search it with docker compose logs app | grep -A4 "First run". The password is also saved to the app_data volume so it survives restarts.

To connect real services (Gmail, LinkedIn, GitHub, …), copy .env.example to .env and fill in the OAuth client id/secret for the providers you want — every block is independent and optional, a provider without credentials simply doesn't show up.

Development Setup

Prerequisites

  • Node.js 20.19+, 22.12+ or 24+ (required by Prisma 7)
  • pnpm
  • PostgreSQL

Setup

  1. Clone the repository and install dependencies:
bash
pnpm install
  1. Copy the environment file and fill in your values:
bash
cp .env.example .env
VariableDescription
DATABASE_URLPostgreSQL connection string
BETTER_AUTH_SECRETSecret key for session signing
BETTER_AUTH_URLApp base URL (e.g. http://localhost:3000)
ADMIN_EMAILBootstrap admin email
ADMIN_PASSWORDBootstrap admin password
  1. Run database migrations:
bash
pnpm prisma migrate dev
  1. Start the development server:
bash
pnpm dev

Open http://localhost:3000.

Project Structure

src/├── app/│   ├── (auth)/              # Login & register pages│   ├── (dashboard)/         # Protected dashboard pages│   │   └── projects/        # Project management, endpoints, audit, settings│   ├── api/│   │   ├── auth/[...all]/    # Better Auth catch-all handler│   │   ├── projects/        # Projects CRUD, endpoints, services, audit│   │   └── mcp/[apiKey]/    # MCP Streamable HTTP handler│   ├── layout.tsx│   └── page.tsx             # Landing page├── components/│   ├── ui/                  # shadcn/ui components│   ├── layout/              # Sidebar, header│   └── shared/              # Reusable app components├── lib/│   ├── db.ts                # Prisma client singleton│   ├── auth.ts              # Better Auth server instance│   ├── auth-client.ts       # Better Auth client SDK│   ├── auth-middleware.ts   # getCurrentUser() helper│   ├── bootstrap.ts         # Admin user bootstrap on empty DB│   ├── provider-registry.ts # Every supported provider — the one file to edit│   └── mcp/│       ├── permissions.ts   # Permission groups (derived from the registry)│       ├── tools/           # One file per service, aggregated in index.ts│       ├── service-fetch.ts # Unified, SSRF-safe transport for all providers│       └── handler.ts       # MCP server factory + audit logging├── generated/prisma/        # Generated Prisma client└── middleware.ts             # Route protection

Available Scripts

bash
pnpm dev              # Start development serverpnpm build            # Production buildpnpm start            # Start production serverpnpm lint             # Run ESLintpnpm prisma generate  # Regenerate Prisma clientpnpm prisma migrate dev  # Create and apply migrationspnpm prisma studio    # Open Prisma Studio (DB browser)

How It Works

  1. Login — sign in with admin credentials (bootstrapped from env vars on first run)
  2. Create a Project — organize endpoints and services by project
  3. Connect a Service — add a service connection to the project
  4. Create an MCP Endpoint — select a service connection and pick specific permissions (e.g. gmail:read_emails, calendar:create_event)
  5. Use the MCP URL — plug the endpoint URL into any MCP-compatible AI agent; only the allowed actions are exposed
  6. Monitor — track every request in the audit log

Permissions

A permission is a single action, not a service — gmail:read_emails can be granted without gmail:send_email. Groups are derived from src/lib/provider-registry.ts (27 providers: Google Workspace, Google Ads & Search Console, Meta, LinkedIn, Twitter, Slack, Notion, Jira, HubSpot, Salesforce, Stripe, Airtable, …) and listed in src/lib/mcp/permissions.ts. Adding a provider means editing the registry — transport, token strategy and permission groups are all derived from it.

A few Google examples:

GroupActions
Gmailgmail:read_emails, gmail:send_email, gmail:list_labels, gmail:search_emails
Google Calendarcalendar:list_events, calendar:create_event, calendar:update_event, calendar:delete_event
Google Drivedrive:list_files, drive:read_file, drive:create_file, drive:delete_file

Database Schema

  • User — authentication, team membership
  • Session — database-backed auth sessions
  • Account — auth provider credentials (email/password)
  • Project — logical grouping for services and endpoints
  • TeamMember — user-project relationship with roles (owner/member)
  • ServiceConnection — OAuth tokens for connected services
  • McpEndpoint — MCP endpoint with API key, rate limit, active status
  • EndpointPermission — allowed actions per endpoint
  • AuditLog — request log with action, status, duration, errors

License

See LICENSE.

来源:README.md,提交 c2ec9b9

工具

0
该服务器需要 API 密钥等凭据,因此 SourceWeft 无法在没有凭据的情况下读取其工具,也未收录。

版本历史

1
  1. v1.0.1最新Sep 16, 2026

评分

已满足适用检查项的 85%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通必需25 分
  • 已声明认证方式必需10 分
  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

其他 Scope 集成