Connections
Connections give your AI agents access to external services and data at runtime. Configure a provider once, assign it to specific repos or agent types, and Optio automatically injects it into agent pods when tasks execute.
Under the hood, connections use the Model Context Protocol (MCP) to extend agent capabilities. When a task runs, Optio resolves which connections apply, starts the corresponding MCP servers in the pod, and the agent can use them as tools.
How It Works
Connections follow a three-layer architecture:
- Providers — catalog entries that define a service type (e.g., “Notion”, “PostgreSQL”). Built-in providers ship with Optio; you can also create custom ones.
- Connections — configured instances of a provider with your API keys and settings. For example, “Production Notion” with your team's integration token.
- Assignments — rules that control which repos and agent types can access a connection, with permission levels (read, readwrite, full).
Built-in Providers
| Provider | Category | Capabilities |
|---|---|---|
| Notion | Productivity | Search pages, databases, and comments |
| GitHub | Productivity | Issues, PRs, discussions, repository content |
| Slack | Productivity | Search messages, read channels, post messages |
| Linear | Productivity | Issues, projects, and cycles management |
| PostgreSQL | Database | Query databases, inspect schema |
| Sentry | Cloud | Search errors, stack traces, issue management |
| Filesystem | Knowledge | Read and search files from mounted directories |
| Custom MCP Server | Custom | Any MCP-compatible server with custom command |
| HTTP API | Custom | Any REST API with configurable authentication |
Creating a Connection
Navigate to Connections in the dashboard. Select a provider from the catalog, fill in the configuration (API keys, tokens, URLs), and optionally configure access control.
POST /api/connections
{
"name": "Team Notion",
"providerId": "<notion-provider-id>",
"config": {
"NOTION_TOKEN": "ntn_..."
},
"scope": "global",
"enabled": true
}By default, new connections are globally available to all repos and agent types. Use assignments to restrict access.
Custom MCP Servers
If you have an MCP server not in the built-in catalog, use the “Custom MCP Server” provider. Specify the command, arguments, and environment variables:
POST /api/connections
{
"name": "Internal Docs Server",
"providerId": "<custom-mcp-provider-id>",
"config": {
"command": "npx",
"args": ["-y", "@myorg/docs-mcp-server"],
"env": { "DOCS_API_KEY": "..." }
},
"scope": "global",
"enabled": true
}HTTP APIs
For REST APIs that aren't MCP-compatible, use the “HTTP API” provider. Supports no-auth, API key, and bearer token authentication.
Access Control
Assignments control which repos and agent types can use a connection. Each assignment specifies:
- Repository — a specific repo, or all repos (global)
- Agent types — restrict to specific agents (e.g., only Claude Code), or allow all
- Permission —
read,readwrite, orfull
POST /api/connections/:id/assignments
{
"repoId": "repo-uuid",
"agentTypes": ["claude-code"],
"permission": "readwrite"
}Tip
repoId null and agentTypes empty to make a connection available to all repos and all agent types.How Connections Are Injected
When a task runs, the task worker resolves applicable connections:
- Looks up enabled connections matching the task's workspace
- Filters by assignment rules (repo URL and agent type)
- Builds MCP configuration entries with resolved secrets and environment variables
- Writes the configuration into the agent pod's
.mcp.json - The agent discovers and uses the MCP servers as tools during execution
Secrets are resolved at runtime and injected into the pod environment. They are never exposed in the web UI or API responses.
Health Checking
Each connection tracks its health status: healthy, error, or unknown. Test a connection from the dashboard or via the API:
POST /api/connections/:id/testManaging Connections
| Endpoint | Description |
|---|---|
| GET /api/connection-providers | List available providers |
| GET /api/connections | List configured connections |
| POST /api/connections | Create a new connection |
| PATCH /api/connections/:id | Update connection config or status |
| DELETE /api/connections/:id | Delete connection and its assignments |
| POST /api/connections/:id/test | Test connection health |
| GET /api/connections/:id/assignments | List assignments |
| POST /api/connections/:id/assignments | Create assignment |
| DELETE /api/connection-assignments/:id | Delete assignment |
| GET /api/repos/:id/connections | List connections for a repo |