> Source: https://developers.terrawallet.us/docs/ai . Terra Wallet developer docs (early access).

<!--
One-click formats below were checked against each client's official documentation on 2026-11-23:
  Claude Code:  https://code.claude.com/docs/en/mcp  ("claude mcp add --transport http <name> <url>"; .mcp.json uses
                mcpServers.<name>.type "http" and url)
  Cursor:       https://cursor.com/docs/mcp/install-links  (cursor://anysphere.cursor-deeplink/mcp/install?name=$NAME&config=$BASE64_ENCODED_CONFIG,
                config = base64 of JSON.stringify(<server object>))
                https://cursor.com/docs/context/mcp  (mcp.json: mcpServers.<name>.url for a remote server)
  VS Code:      https://code.visualstudio.com/api/extension-guides/ai/mcp  (vscode:mcp/install?{json-configuration},
                built with encodeURIComponent(JSON.stringify({name, ...})); Insiders: vscode-insiders:)
                https://code.visualstudio.com/docs/agents/reference/mcp-configuration  (mcp.json: servers.<name>.type "http", url)
  Windsurf:     https://docs.devin.ai/windsurf/plugins/cascade/mcp  (formerly docs.windsurf.com; mcp_config.json:
                mcpServers.<name>.serverUrl for a remote HTTP server)
  MCP spec:     https://modelcontextprotocol.io/specification/2025-11-25/basic/transports  (Streamable HTTP)
The same snippets are served on https://mcp.terrawallet.us/ (apps/mcp/src/setup.ts holds the single copy).
-->

# Build with AI

The Terra MCP server lets your AI assistant read these docs, fetch code samples and look up API operations while
it writes your integration. The Docs tier needs no sign-in and is read-only.

> **Early access.** The hosted server address is `https://mcp.terrawallet.us/mcp`. Tool names and outputs may
> change before launch.

## Add it to your assistant

### Claude Code

```bash
claude mcp add --transport http terra https://mcp.terrawallet.us/mcp
```

### Cursor

Open this link to install it in Cursor:

```text
cursor://anysphere.cursor-deeplink/mcp/install?name=terra&config=eyJ1cmwiOiJodHRwczovL21jcC50ZXJyYXdhbGxldC51cy9tY3AifQ==
```

The `config` value is the base64 of `{"url":"https://mcp.terrawallet.us/mcp"}`. Or add it to `.cursor/mcp.json`
yourself:

```json
{
  "mcpServers": {
    "terra": {
      "url": "https://mcp.terrawallet.us/mcp"
    }
  }
}
```

### VS Code

Open this link to install it in VS Code (for VS Code Insiders, start the link with `vscode-insiders:` instead):

```text
vscode:mcp/install?%7B%22name%22%3A%22terra%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fmcp.terrawallet.us%2Fmcp%22%7D
```

It is `encodeURIComponent` of `{"name":"terra","type":"http","url":"https://mcp.terrawallet.us/mcp"}`. VS Code
shows the configuration for you to review before it installs anything. Or add it to `.vscode/mcp.json`:

```json
{
  "servers": {
    "terra": {
      "type": "http",
      "url": "https://mcp.terrawallet.us/mcp"
    }
  }
}
```

### Windsurf

Add this to Windsurf's `mcp_config.json` (Windsurf uses `serverUrl` for remote servers):

```json
{
  "mcpServers": {
    "terra": {
      "serverUrl": "https://mcp.terrawallet.us/mcp"
    }
  }
}
```

### Any other MCP client

Most clients that support remote servers over Streamable HTTP accept this shape:

```json
{
  "mcpServers": {
    "terra": {
      "type": "http",
      "url": "https://mcp.terrawallet.us/mcp"
    }
  }
}
```

### Local install (later)

A local helper that detects your AI clients and writes their config after you confirm is planned. It is not
published:

```bash
# npx @terrawallet/mcp init (not published yet; name may change)
```

## What the Docs tier can do

Every tool is read-only (`readOnlyHint: true`), reaches no outside system (`openWorldHint: false`) and needs no
sign-in. The docs are bundled into the server, so nothing is fetched at request time.

| Tool | What it does |
|---|---|
| `search_docs` | Searches these docs and returns the best matching sections with their page slugs |
| `get_doc_page` | Returns one docs page as Markdown, by slug |
| `get_code_sample` | Returns a code sample for a framework (`nextjs`, `react`, `html`, `react-native`, `node`, `python`, `php`) and a product (`connect`, `pay`, `subscriptions`, `webhooks`) |
| `get_api_operation` | Looks up a `/v1` operation by method and path (for example `POST /v1/payment_intents`), by operation id, or lists a resource's operations |
| `list_supported_networks` | Lists networks and their verified USDT and USDC contracts, filtered by family or asset |
| `get_sdk_info` | Describes each planned SDK package and its status. None is published yet |

**Resources.** Every page is also a resource at `terra://docs/{slug}`, for example
`terra://docs/pay-payment-intents`.

**Prompts.** Four ready-made prompts:

- "Add Terra Pay checkout to my app"
- "Set up crypto subscriptions"
- "Connect Terra Wallet to my dApp"
- "Debug a failed webhook"

## Protocol details

- Transport: MCP Streamable HTTP at `/mcp`, `POST` only. The server is stateless: it issues no session ids, and
  `GET` and `DELETE` on `/mcp` return 405.
- Protocol revision: `2025-11-25` (the `initialize` handshake), with earlier revisions supported by the official
  SDK for older clients.
- Responses are JSON, size-capped, and requests are rate limited per client IP. A `429` means wait and retry.

## What no AI can ever do with Terra

Not through the MCP server and not through any other AI path:

- move or sign funds (refunds are drafts that a person signs in their own wallet);
- change payout wallets;
- create or reveal live secret keys or webhook secrets;
- change team roles or two-factor settings;
- delete an organization.

These limits are built into what the tools can reach, not left to the model's judgement.

## Prompt-injection defence

- Tool definitions are static and reviewed. Nothing a user types can change the list of tools or their
  descriptions.
- The Docs tier returns only Terra's own documentation. Later tiers return merchant and customer text (names,
  memos, webhook payloads) only in clearly labelled, length-capped data fields marked as untrusted.
- Treat text that arrives from customers, webhooks or chain data as data, never as instructions, in your own AI
  features too.

## The Account tier (later)

A second tier will connect to your own account through OAuth 2.1 with PKCE and a consent screen on
`dashboard.terrawallet.us`:

- **read:** projects, payments with their verified on-chain status, payment links, invoices, plans,
  subscriptions, webhook deliveries, events, the audit log;
- **sandbox writes:** test payment links, invoices and plans, a simulated payment, a test webhook;
- **live writes, only if you enable them per connection with an authenticator code:** a payment link or invoice
  (paid only to your verified payout wallet), cancelling a subscription, a refund draft.

Every write asks a person to confirm. Tokens are sandbox-only by default, short-lived and revocable, and an
org-wide switch turns all AI access off.

## AI-readable docs

These pages are plain Markdown with front matter, so any assistant can read them. On the landing site,
`llms.txt`, `llms-full.txt` and a Markdown twin of every page are available for the same reason.
