# Connect your agent

Configure authenticated HTTP MCP in Cursor, Claude Code or Codex.

Canonical page: https://ontlgy.io/docs/agents/connect/

The installation's **Connect your agent** page is the preferred source of snippets: it uses the configured endpoint and your API key. The examples below use a local installation at `http://localhost:8080/mcp`. For a team installation, replace that URL with its HTTPS endpoint.

Create a key in the app first. Replace `YOUR_API_KEY` privately and keep the completed configuration out of Git, screenshots and shared logs.

## Cursor

Merge this entry into `~/.cursor/mcp.json` or your project MCP settings. Preserve your other servers.

```json
{
  "mcpServers": {
    "ontlgy": {
      "url": "http://localhost:8080/mcp",
      "headers": { "Authorization": "Bearer YOUR_API_KEY" }
    }
  }
}
```

Reload MCP servers and confirm ontlgy is enabled.

## Claude Code

Run the command generated by the app:

```bash
claude mcp add --transport http ontlgy http://localhost:8080/mcp --header "Authorization: Bearer YOUR_API_KEY"
```

The substituted command contains a secret. Use your team's secret-handling practices for shell history and configuration. Restart or reload the client after adding the server.

## Codex

Merge this into `~/.codex/config.toml`:

```toml
[mcp_servers.ontlgy]
url = "http://localhost:8080/mcp"
bearer_token_env_var = "ONTLGY_API_KEY"
```

Set the key in the environment of the process that launches Codex:

```bash
export ONTLGY_API_KEY='YOUR_API_KEY'
```

Restart Codex from that environment. A desktop app launched separately may not inherit a variable exported in a terminal; configure the environment for the actual launch method.

## Verify the connection

1. Use the app's connection test to verify the key and endpoint.
2. Confirm your agent lists `repo_find`, `search`, `symbol` and the other [default tools](https://ontlgy.io/docs/reference/mcp-tools/).
3. Ask the agent to find a repository and complete [the first-query walkthrough](https://ontlgy.io/docs/start/first-query/).

The app's test proves its endpoint works with the key. It does not prove the separate agent process loaded its configuration or can reach the server.

`localhost` means the machine where the agent runs. A remote agent or container needs a reachable installation URL; it cannot use your laptop's loopback address. Do not expose a plain HTTP installation publicly; [configure HTTPS](https://ontlgy.io/docs/operate/install/#add-https).

## HTTP and stdio

The shared product uses authenticated HTTP at `/mcp`. A source-development stdio server also exists, but it reads the configured graph without installation source credentials. Live `doc_read` requires HTTP MCP or your own source connector. Use the HTTP endpoint of your installation unless you are developing ontlgy itself.

Next: [Add repository guidance](https://ontlgy.io/docs/agents/guidance/).
