# Connect Claude Code

> Add the Stensul MCP server to Claude Code from the terminal with one command, then sign in through your browser.

Source: https://stensul.com/developers/quickstart/claude-code/ · Last reviewed 2026-09-28

> **Not the Stensul admin?**
>
> Your **instance name** is the first part of your Stensul address (`northwind` in `northwind.stensul.com`). The [config generator](https://stensul.com/developers/config?host=claude-code) writes the exact settings and a message you can send your Stensul admin. Don't know who that is, or whether the MCP is turned on for your company? Ask your Stensul customer success manager, or email [help@stensul.com](mailto:help@stensul.com?subject=Stensul%20MCP%20access) from your work address.

## Before you start

- [Claude Code](https://docs.anthropic.com/en/docs/claude-code) installed.
- A **Client ID** from an Authorization Code API connection with PKCE on. Your Stensul admin creates it in step 1 of [Connect Claude](https://stensul.com/developers/quickstart/claude/#1-create-the-api-connection-in-stensul).
- Your **instance name**: the first part of your Stensul address (`northwind` in `northwind.stensul.com`).

## 1. Add the server

Run this in a terminal, replacing both placeholders:

```bash
claude mcp add --transport http \
  --client-id <client-id> \
  --callback-port 3334 \
  mcp-stensul \
  https://mcp.stensul.com/<your-instance>/mcp
```

The fixed callback port (`3334`) stops a second sign-in from colliding with the first.

> **No Client ID?**
>
> Claude Code can also register itself with Dynamic Client Registration, with no admin action. Run the same command without `--client-id`. A self-registered client gets every Stensul scope and can't be narrowed, so admins who want control should hand out a Client ID instead. See [Authentication](https://stensul.com/developers/authentication/#dynamic-client-registration).

## 2. Sign in

Start Claude Code and run `/mcp`. Select **mcp-stensul** and choose to authenticate. A Stensul sign-in page opens in your browser. Log in and approve.

## 3. Draft an email

```text
Use Stensul to list the libraries I can use, then create a draft product update
email in the most suitable one. Keep it under 120 words and show me a preview.
```

Claude Code shows each tool call before running it. You're done when it prints an edit link that opens the draft in Stensul.

## If something goes wrong

| What you see | Fix |
| --- | --- |
| `EADDRINUSE` or two browser tabs open at sign-in | Keep `--callback-port 3334` so every launch uses the same port |
| Redirect URI mismatch | The connection's redirect URI must be exactly `https://mcp.stensul.com/<your-instance>/oauth/callback` |
| `410 Gone` | You're using the old shared `/mcp` endpoint with headers. Use your per-instance URL |

More in [Errors and troubleshooting](https://stensul.com/developers/troubleshooting/).
