Skip to main content

Integration guide

Follow these steps in order. Skip optional steps unless you need them.

Checklist


Step 1: Install core

Requirements: PHP 8.2+, Laravel 12 or 13, Composer.
Migrations create sv_* tables automatically. No separate Sanvex migrate command. Optional: production encryption key:

Step 2: Install a driver

Your driver id (e.g. github, gmail) must appear in the table. Driver packages register with Laravel automatically after Composer install. You do not add them to config/sanvex.php unless you built a custom driver class.

Step 3: Configure .env

Open the driver’s Configuration page for exact variable names: API key drivers (GitHub, Notion internal, Linear, Slack): you can skip OAuth env vars. Store the token in step 4 with sanvex:setup. OAuth drivers (Gmail; Notion public integration): set client id, secret, and redirect URI in .env. APP_URL must match your running app and the provider console redirect URL.
Publishing config/sanvex.php is optional — only if you want to edit core or driver settings in your app:
See Configuration.

Step 4: Connect credentials

Choose one path for your driver.

A — API key or bot token (CLI)

Per-user or per-team credentials:
See Authentication and Tenancy.

B — OAuth (browser)

Built-in login routes (Gmail and Notion today):
  1. Set OAuth env vars (step 3).
  2. Open the login URL in a browser (same app as APP_URL).
  3. Approve access at the provider.
  4. You are redirected back; tokens are stored in sv_accounts.
Default OAuth connections use the global owner. For per-user OAuth, implement your own callback and use oauth()->buildState($owner) — see OAuth. GitHub, Linear, and Slack do not ship login routes yet — store tokens with sanvex:setup or your own OAuth flow.

Step 5: Verify

Replace github with your driver id. Expect true. API call:
If this fails with 401, the token is missing or invalid — repeat step 4. OAuth routes missing? Run php artisan route:list --path=sanvex and confirm login/callback routes exist. If not, check client id env vars (step 3).

Step 6: Agents (optional)

After step 5 succeeds:
  • Laravel AISanvexAi::driver('github')->tools()
  • MCPphp artisan sanvex:mcp-stdio
Only register tools when isConfigured() is true for that driver.

Troubleshooting


Next

  • Usage — resources, webhooks, tenancy patterns
  • Quickstart — minimal GitHub example
  • Installation — same steps with extra notes
  • Drivers — per-driver setup and resources