# build_oauth_provider

> **Function** in `deepagents_cli`

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

Construct an `OAuthClientProvider` for an MCP server.

## Signature

```python
build_oauth_provider(
    *,
    server_name: str,
    server_url: str,
    storage: TokenStorage,
    extra_auth_params: dict[str, str] | None = None,
    interactive: bool = True,
) -> OAuthClientProvider
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `server_name` | `str` | Yes | MCP server name used in re-auth messages. |
| `server_url` | `str` | Yes | Remote MCP server URL. |
| `storage` | `TokenStorage` | Yes | Token storage implementation for this server. |
| `extra_auth_params` | `dict[str, str] \| None` | No | Optional query params for the interactive auth URL. (default: `None`) |
| `interactive` | `bool` | No | Whether the provider may prompt on stdin. (default: `True`) |

## Returns

`OAuthClientProvider`

A configured `OAuthClientProvider`.

---

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