ScopeGate

io.github.alifanovPublished by GitHub account alifanovv1.0.1Updated Oct 24, 2026

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

The publisher's own server: Scope (AEC) - Preview

VerifiedStreamable HTTPWeb executableProductivity & WorkflowSecurity & Monitoring

Overview

AI-generated overview

Permission gateway that gives AI agents scoped MCP endpoints over 27 services, with per-action permissions, audit logs and one-click revocation.

What you can do
  • Call actions on connected third-party services (Gmail, Calendar, Drive, Slack, Notion, Jira, HubSpot, Salesforce, Stripe, Airtable and more) through a scoped MCP endpoint
  • Read and act only on the specific actions ticked for that endpoint, such as reading emails without sending them
  • Review an audit trail of who called which tool, the outcome and duration, per project and exportable
  • Revoke access by regenerating an endpoint key while the underlying service connection stays in place
  • Organize service connections, endpoints and permissions by project
When to use it
Useful when an agent needs access to real accounts such as email, calendars, CRM or payments, and you want to limit it to a few exact actions instead of a broad OAuth scope, with logging and a quick way to cut access off.
Requirements
A remote endpoint at scopegate.dev with OAuth sign-in, or a self-hosted instance run via Docker Compose (PostgreSQL included) or Node.js 20.19+/22.12+/24+ with pnpm and PostgreSQL. Connecting real services requires OAuth client id/secret for each provider in a .env file; self-hosting needs DATABASE_URL, BETTER_AUTH_SECRET, BETTER_AUTH_URL, ADMIN_EMAIL and ADMIN_PASSWORD.
Before you install
The gateway holds OAuth tokens for connected accounts, so it becomes a high-value target; tokens are stored encrypted and agents only see sg_ keys. Endpoints can perform write actions such as sending email or creating, updating and deleting calendar events and files, so grant only the actions needed. Audit logs record request details. Self-hosting requires setting BETTER_AUTH_SECRET and admin credentials, and the generated admin login is printed in container logs.

Installation

In SourceWeft

  1. Open ScopeGate in the dashboard and add it to a workspace.
  2. Connect the required credentials. They are stored privately and never shown on public pages.
  3. Enable the server for the chats that should use its tools.

Web executable via Streamable HTTP. Remote servers run from the web runtime once configured in a workspace.

Other MCP clients

Follow the launch instructions in the repository.

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.

Source: README.md at commit c2ec9b9

Tools

0
This server asks for a credential such as an API key, so SourceWeft could not read its tools without one and has not indexed them.

Version history

1
  1. v1.0.1LatestSep 16, 2026

Score

85% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 daysRequired25 pts
  • Auth declaredRequired10 pts
  • Tools listed15 pts

    Answer tools/list without a credential, or ship a package that starts in a sandbox without one.

  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts

Other Scope integrations