# run_mcp_login

> **Function** in `deepagents_cli`

📖 [View in docs](https://reference.langchain.com/python/deepagents-cli/mcp_commands/run_mcp_login)

Handle `deepagents mcp login <server>`.

When `config_path` is omitted, auto-discovered MCP configs are merged in
the same precedence order as the runtime loader, with matching trust
gating: user-level configs are always included, but project-level configs
are only included when the trust store has a fingerprint match. An
untrusted project-level config (for example, a `.mcp.json` in a cloned
repo) is skipped so attacker-controlled `headers` entries cannot exfiltrate
local secrets during the OAuth handshake. When `config_path` is set, that
file alone is loaded and treated as explicitly trusted.

## Signature

```python
run_mcp_login(
    *,
    server: str,
    config_path: str | None,
) -> int
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `server` | `str` | Yes | Target server name from `mcpServers`. |
| `config_path` | `str \| None` | Yes | Optional explicit MCP config path. |

## Returns

`int`

Process exit code: 0 on success, 1 on config or login failure,

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/64d45f67c86edb4df2ced0e7b82f1a8fd158ec8c/libs/cli/deepagents_cli/mcp_commands.py#L70)