# Agent and MCP connections (/docs/cli/agent-connections)



The CLI can prepare a local MCP connection for a third-party agent. Each named connection receives its own Pollaris grant for one workspace. You do not copy an MCP API key into a configuration file.

## Install bridge dependencies [#install-bridge-dependencies]

```bash
uv tool install 'pollaris-cli[mcp]'
export POLLARIS_API_URL=https://api.pollaris.cc
```

## Connect a local MCP host [#connect-a-local-mcp-host]

For a host that uses a JSON `mcpServers` configuration:

```bash
pollaris mcp connect \
  --connection library-agent \
  --config-file /absolute/path/to/mcp.json \
  --json
```

Open the returned authorization link and approve access, then run the returned continuation command. On completion, the CLI merges a Pollaris entry into the specified configuration and reports whether the host needs to reload.

The managed entry runs:

```bash
pollaris mcp serve --profile library-agent
```

That process speaks MCP over standard input/output and forwards requests to the remote Pollaris MCP server with the connection's credential. It does not print the credential or put it in the host configuration.

Configuration formats differ between hosts. `--config-file` currently supports JSON files containing an `mcpServers` object. Pollaris preserves unrelated entries and makes a backup before changing an existing file. If a different Pollaris entry already exists, the command stops instead of overwriting it.

## Prepare configuration without changing a file [#prepare-configuration-without-changing-a-file]

Omit `--config-file`:

```bash
pollaris mcp connect --connection library-agent --json
```

The result contains an `mcp_config` object you can review and add using your host's normal setup method.

## Test the connection [#test-the-connection]

Reload the agent host, then ask it:

```text
Use Pollaris to list my available workspace and create a short library feedback form. Publish it and return its public URL.
```

The MCP agent calls `create_form`, polls `get_job`, and reads the final `public_url`. Existing draft tools remain draft-only.

## Inspect or disconnect [#inspect-or-disconnect]

```bash
pollaris mcp status --profile library-agent --json
pollaris mcp disconnect --profile library-agent --json
```

Disconnecting revokes that Pollaris grant and removes only the CLI-managed configuration entry. Other Pollaris profiles and agent connections continue working.

Processes running as the same operating-system user can often access the same keychain. Use separate OS users or containers when you need strong isolation between local agents.

## Hosted agents [#hosted-agents]

A hosted agent should connect directly to the Pollaris remote MCP endpoint and complete Pollaris OAuth in its own client. Do not export a CLI refresh token to a hosted service. If a hosted client does not support remote MCP OAuth or offer a supported integration API, the local CLI cannot silently configure it.
