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 整合