# Connect Decret to an agent

Verified against official client documentation on September 7, 2026. Use the endpoint and key supplied by the user; the API path is /api/mcp on their Decret web origin. Never invent a production hostname.

The primary flow is Company → Agent link: choose company access and optional research access, create a key, choose your client beside the prompt, copy the setup prompt, paste it into a trusted agent in the intended company project. The prompt includes the key and explicit editing scope when an editing key was selected. The chat/clipboard may retain this secret under the client's policies. Manual configuration is available if the user prefers to keep the key out of a chat. The public guides contain no credentials or private company data.

Use Streamable HTTP POST with an Authorization bearer header. This is a bearer-key integration, not an OAuth login or an SSE URL. Never send the key when fetching these public guides. User-level settings keep a connection available across projects. Check the intended company before each sync. Merge configuration; never replace unrelated servers or override a different existing Decret connection silently. Keep secrets outside repositories and restrict local configuration permissions. Do not use installation deep links containing credentials.

## Codex

Merge into your user configuration, usually ~/.codex/config.toml.

```toml
[mcp_servers.decret]
url = "https://decret.ai/api/mcp"
http_headers = { Authorization = "Bearer YOUR_CONNECTION_KEY" }
```

Replace the placeholder privately. CLI alternative: codex mcp add decret --url <endpoint> --bearer-token-env-var DECRET_MCP_KEY, with that variable available to the launching process. A terminal export does not reach an already running desktop app. Restart/reload the client when necessary, then verify company_get. [Official Codex MCP docs](https://developers.openai.com/codex/mcp/).

## Cursor

Merge into your private user configuration at ~/.cursor/mcp.json.

```json
{
  "mcpServers": {
    "decret": {
      "url": "https://decret.ai/api/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_CONNECTION_KEY"
      }
    }
  }
}
```

Replace the placeholder privately. Cursor supports ${env:DECRET_MCP_KEY} in headers when the client environment supplies it. Avoid the shared project .cursor/mcp.json for literal secrets. Reload/enable Decret in MCP settings, then verify company_get. [Official Cursor MCP docs](https://cursor.com/docs/mcp).

## Claude Code

Use user scope in ~/.claude.json, or claude mcp add-json with --scope user.

```json
{
  "mcpServers": {
    "decret": {
      "type": "http",
      "url": "https://decret.ai/api/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_CONNECTION_KEY"
      }
    }
  }
}
```

The type: http field is required. With add-json, pass only the inner decret object and use --scope user. Keep the literal key out of shell arguments/history; prefer a private structured config edit. /mcp shows status; a new session may be needed. This is a Claude Code guide, not a promise of Claude web/Desktop OAuth connector support. [Official Claude Code MCP docs](https://code.claude.com/docs/en/mcp).

## Gemini CLI

Merge into your private user configuration at ~/.gemini/settings.json.

```json
{
  "mcpServers": {
    "decret": {
      "httpUrl": "https://decret.ai/api/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_CONNECTION_KEY"
      },
      "trust": false
    }
  }
}
```

Use httpUrl for Streamable HTTP; url selects SSE. Keep trust: false so tool confirmations remain enabled. Check /mcp after setup. This recipe is documentation-verified, not a native-client certification. [Official Gemini CLI MCP docs](https://geminicli.com/docs/tools/mcp-server/).

## Other clients and hosting

Discover the installed client's official HTTP/header configuration; there is no universal mcp.json schema. Antigravity and Grok clients have no individually verified guide here yet. Do not claim they were tested. OAuth-only clients require a future integration. No marketplace plugin is currently published.

Localhost is only reachable from the machine running Decret. A hosted agent requires a reachable HTTPS endpoint. Use the web origin where the key was created. Production must provide TLS and pass Authorization, Accept, Content-Type and MCP-Protocol-Version headers without redirecting the MCP endpoint. There are no client session IDs or sticky-routing requirements. Do not automatically publish a tunnel.

## Verify and prepare

Connect, list tools, call company_get and inspect its result. Read-only keys expose company_get and document_read; editing keys also expose company_update, document_put and document_delete. The company resource is decret://company. Read [the preparation guide](./agent-guide.md), also available as decret://guides/company-context. Follow it for provenance, curation, version checks, pagination and privacy. An HTTP 200 can still contain an MCP tool error. Do not equate key activity in the UI with a completed company upload.

Optional research access adds original source browsing and the board research workflow. source_search and source_read return original attributed passages without model allowance use. research_start creates a generated board response and uses the account's allowance; never call it as a setup test. Read [the research guide](./research-guide.md), also available as decret://guides/research, for source versions, page navigation, job polling, complete results and limits.

Keys created in the app expire in 90 days, with at most 10 active connections. Revoke from Agent link. Use Manage connections → Copy key to retrieve an active key after returning to the page. Older hash-only keys become recoverable when next used by an agent; until then create another connection if needed. Revoke exposed keys. 401 means missing/expired/revoked credentials, 403 may mean an untrusted browser Origin, 429 means wait for Retry-After. Inaccessible localhost is a network-location issue. A missing tool after adding settings may require a fresh session or native approval. Give the precise remaining action, never claim tools loaded merely because configuration was saved.
