> ## Documentation Index
> Fetch the complete documentation index at: https://developers.squads.so/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP Integration

> Use with AI tools through Model Context Protocol

export const ApiKeyRequestButton = () => {
  const handleClick = () => {
    window.open('https://squads-grid.typeform.com/contact', '_blank');
  };
  return <button onClick={handleClick} className="px-4 py-2 bg-black text-white rounded-lg hover:bg-neutral-800 transition-colors">
  Request API Key
</button>;
};

export const CursorMCPButton = ({serverName = "Grid", serverUrl = "https://developers.squads.so/mcp"}) => {
  const generateWebLink = () => {
    const serverConfig = {
      url: serverUrl
    };
    const base64Config = btoa(JSON.stringify(serverConfig));
    return `https://cursor.com/install-mcp?name=${encodeURIComponent(serverName)}&config=${encodeURIComponent(base64Config)}`;
  };
  const handleClick = () => {
    window.open(generateWebLink(), '_blank', 'noopener,noreferrer');
  };
  return <button onClick={handleClick} style={{
    background: 'transparent',
    border: 'none',
    padding: 0,
    cursor: 'pointer',
    display: 'inline-block',
    lineHeight: 0
  }}>
      <img src="https://cursor.com/deeplink/mcp-install-dark.svg" alt="Add Grid MCP server to Cursor" height="32" style={{
    pointerEvents: 'none',
    display: 'block'
  }} />
    </button>;
};

Grid supports the Model Context Protocol (MCP), allowing AI tools like Claude, Cursor, and other MCP-compatible clients to interact with your APIs directly.

## What is MCP?

The Model Context Protocol is an open standard that creates standardized connections between AI applications and external services. Grid's MCP server exposes your endpoints as tools that AI assistants can use to help users interact with your financial infrastructure.

## Available MCP Tools

The entire Grid documentation is available to search through with the MCP server. Additionally, **all Grid API endpoints** are now enabled for MCP access, allowing you to:

### Smart Account Management

* **Create Smart Account** (`POST /smart-accounts`) - Create new smart accounts with policies
* **Create Authorities** (`POST /smart-accounts/auth`) - Create authorities for a smart account
* **Verify OTP** (`POST /smart-accounts/verify-otp`) - Verify one-time passwords
* **Get Smart Account** (`GET /smart-accounts/{address}`) - Retrieve account details with balances, and policies

### KYC/KYB Operations

* **Request KYC Link** (`POST /smart-accounts/{address}/kyc`) - Initiate KYC/KYB process
* **Get KYC Status** (`GET /smart-accounts/{address}/kyc/{kyc_id}`) - Check verification status

### Payment Intent Operations

* **Create Payment Intent** (`POST /smart-accounts/{address}/payment-intents`) - Create new payment intents
* **List Payment Intents** (`GET /smart-accounts/{address}/payment-intents`) - View all payment intents with filtering
* **Get Payment Intent** (`GET /smart-accounts/{address}/payment-intents/{id}`) - Retrieve specific payment intent
* **Confirm Payment Intent** (`POST /smart-accounts/{address}/payment-intents/{id}/confirm`) - Execute payment

### Virtual Account Management

* **Create Virtual Account** (`POST /smart-accounts/{address}/virtual-accounts`) - Request new virtual accounts
* **List Virtual Accounts** (`GET /smart-accounts/{address}/virtual-accounts`) - View all virtual accounts

## Accessing Grid's MCP Server

The Grid MCP server is automatically available at:

```
https://developers.squads.so/mcp
```

## Using with AI Tools

<AccordionGroup>
  <Accordion title="Claude Desktop" icon="message" defaultOpen>
    1. Navigate to [Connectors](https://claude.ai/settings/connectors) in Claude settings
    2. Select **Add custom connector**
    3. Add:
       * Name: `Grid`
       * URL: `https://developers.squads.so/mcp`
    4. Select **Add**

    When chatting with Claude, use the attachment button to connect to Grid.
  </Accordion>

  <Accordion title="Cursor" icon="code">
    <CursorMCPButton />

    Or manually configure:

    1. Open command palette (`Cmd+Shift+P` or `Ctrl+Shift+P`)
    2. Search for "Open MCP settings"
    3. Add to `mcp.json`:

    ```json theme={null}
    {
      "mcpServers": {
        "grid": {
          "url": "https://developers.squads.so/mcp"
        }
      }
    }
    ```
  </Accordion>

  <Accordion title="Other MCP Clients" icon="plug">
    Any MCP-compatible client can connect to Grid's MCP server using:

    * **Server URL**: `https://developers.squads.so/mcp`
    * **Server Name**: `grid` (or your preferred name)

    Consult your client's documentation for specific configuration instructions.
  </Accordion>
</AccordionGroup>

## Authentication

When using Grid endpoints through MCP, AI tools will prompt for your API key when needed. Authentication is handled securely by the AI tool - Squads never stores or processes these credentials.

### How API Authentication Works

1. **API Key Required**: All Grid API endpoints require authentication via Bearer token
2. **Environment Header**: Specify `X-Grid-Environment` as either `sandbox` or `production`
3. **Secure Handling**: Your AI tool manages the API key securely - it's never sent to Squads' MCP server

### Getting your API Keys

<ApiKeyRequestButton />

### Using Authentication in AI Tools

When you ask an AI assistant to make Grid API calls, it will:

1. Prompt you for your Grid API key (only on first use)
2. Store it securely within the AI tool's session
3. Include it automatically in all API requests as `Authorization: Bearer YOUR_API_KEY`
4. Add the required `X-Grid-Environment` header based on your preference

## Example Use Cases

With MCP integration, you can ask AI assistants to:

### Testing & Development

* "Create a test smart account in sandbox environment"
* "Show me the balance of smart account `7xKXtg2CW87d...` in sandbox"
* "List all payment intents for my test account"

### Real Operations

* "Create a production smart account with 2-of-3 multisig"
* "Initiate KYC for smart account address `ABC123...`"
* "Create a payment intent to send 100 USDC from my smart account"
* "Check the status of payment intent `intent_123...`"

### Integration Help

* "Generate Python code to create payment intents"
* "Show me how to set up webhook handling for Grid"
* "Help me implement virtual account creation"

The AI assistant will use the Grid API tools to execute these requests or generate appropriate code examples.

## Security Considerations

* API keys are managed by your AI tool, not by Squads
* All API calls respect the same permissions as direct API usage
* Use sandbox environment for testing and development
* Never share API keys in public repositories or conversations
* MCP requests go directly from your AI tool to Grid API endpoints
* Enable MCP only for trusted AI assistants with proper security measures
