> For the complete documentation index, see [llms.txt](https://trader-docs.b2trader.b2broker.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://trader-docs.b2trader.b2broker.com/connect-your-ai-agent/connect-claude.md).

# Connect Claude

You can connect B2Trader to **Claude** in two places:

* **claude.ai** (web and desktop app) — add B2Trader as a **custom connector**.
* **Claude Desktop** — add B2Trader as an MCP server; the OAuth sign-in completes through Claude's hosted redirect (`https://claude.ai/api/mcp/auth_callback`).

Both use the same B2Trader MCP URL and the same OAuth sign-in. Pick the surface you need first — see [Overview](/connect-your-ai-agent/overview.md):

* Read-only: `https://<your-broker-domain>/mcp-read-only`
* Full access: `https://<your-broker-domain>/mcp-full-access`

{% hint style="info" %}
Ask your broker for the exact base URL for your platform. The read-only connector may also be discoverable directly in Claude's connector directory.
{% endhint %}

## Connect on claude.ai

1. Open **Settings** → **Connectors** in claude.ai.
2. Click **Add custom connector**.
3. Paste the B2Trader MCP **URL** for the surface you want (read-only or full access).
4. Click **Add**. Claude reads the endpoint's OAuth metadata and opens the B2Trader sign-in page in your browser.
5. Sign in with your normal **B2Trader credentials**. Authentication uses OAuth 2.1 with PKCE — you are **not** pasting an API key into Claude.
6. **Full access only:** approve the consent screen (see [The full-access consent screen](#the-full-access-consent-screen)).
7. Claude shows the connector as **Connected**, and the B2Trader tools appear in the tool list for your conversations.

## Connect in Claude Desktop

1. Open **Claude Desktop** → **Settings** → **Connectors**.
2. Add a new MCP server pointing at the B2Trader MCP URL for your surface.
3. Claude Desktop opens your browser for OAuth sign-in and completes the flow through Claude's **hosted** redirect (`https://claude.ai/api/mcp/auth_callback`), a pre-registered redirect URI.
4. Sign in and — for full access — approve the consent screen.
5. The B2Trader tools appear in Claude Desktop once the connector reports **Connected**.

## The full-access consent screen

When you connect the **full-access** surface, B2Trader shows an explicit consent screen before issuing a token. It reads:

{% hint style="danger" %}
Connecting this AI agent lets it place, cancel and close orders and set triggers on your account directly, with no per-action confirmation. These actions are irreversible. This differs from the in-terminal AI chat, which confirms each trade.
{% endhint %}

* **Approve** — Claude receives a token carrying the `mcp:trade` scope and can trade on your account.
* **Decline** — no token is issued and Claude stays disconnected from the full-access surface.

The read-only surface does **not** show this screen — it only grants the `mcp:read` scope.

Before approving full access, read [Full-access safety](/connect-your-ai-agent/full-access-safety.md).

## What "connected" looks like

* The connector is listed as **Connected** in Claude's settings.
* B2Trader tools (for example `trader_get_accounts`, plus market-data and portfolio tools) are available to Claude in your conversations.
* On read-only, no order-placing or position-closing tools appear — they are not part of that surface.

## Disconnecting

* In Claude, remove the connector to stop it calling B2Trader.
* To revoke B2Trader's side of the grant, use the account console — see [How to stop your agent](/connect-your-ai-agent/full-access-safety.md#how-to-stop-your-agent).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://trader-docs.b2trader.b2broker.com/connect-your-ai-agent/connect-claude.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
