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

# Mirobody MCP Server

> Connect Mirobody tools to Claude, Cursor, and other MCP clients

## Overview

Mirobody functions as an **OAuth-enabled MCP server** that exposes its [built-in tools](/en/tools/built-in) to AI clients like Claude Desktop, Cursor, and custom MCP clients. The endpoint speaks **JSON-RPC 2.0** and is served by `src/mcp/`.

<Info>
  The Model Context Protocol (MCP) is a standard interface for AI applications to access tools, resources, and context.
</Info>

The engine exposes two request paths:

```
http://localhost:8080/mcp                 # authenticates via bearer JWT
http://localhost:8080/mcp/{secret}        # personal-MCP secret resolving to a user
```

<Note>
  The standalone binary listens on `HTTP_HOST:HTTP_PORT`, which defaults to `0.0.0.0:8080`. Adjust the port below if you've changed `HTTP_PORT`.
</Note>

## MCP Configuration

### For Claude Desktop & Cursor

Add Mirobody to your MCP configuration:

```json ~/Library/Application Support/Claude/claude_desktop_config.json theme={null}
{
  "mcpServers": {
    "mirobody_mcp": {
      "command": "npx",
      "args": [
        "-y",
        "universal-mcp-proxy"
      ],
      "env": {
        "UMCP_ENDPOINT": "http://localhost:8080/mcp"
      }
    }
  }
}
```

<Tabs>
  <Tab title="macOS/Linux">
    Configuration file location:

    ```bash theme={null}
    ~/Library/Application Support/Claude/claude_desktop_config.json
    ```

    For Cursor:

    ```bash theme={null}
    ~/.cursor/mcp_config.json
    ```
  </Tab>

  <Tab title="Windows">
    Configuration file location:

    ```powershell theme={null}
    %APPDATA%\Claude\claude_desktop_config.json
    ```

    For Cursor:

    ```powershell theme={null}
    %USERPROFILE%\.cursor\mcp_config.json
    ```
  </Tab>
</Tabs>

### Restart Your Client

After updating the configuration:

<Steps>
  <Step title="Save configuration file">
    Ensure your changes are saved to the MCP config file
  </Step>

  <Step title="Restart Claude/Cursor">
    Close and reopen Claude Desktop or Cursor completely
  </Step>

  <Step title="Verify connection">
    The MCP server should appear in the client's MCP servers list

    In Claude Desktop: Click the MCP icon to see connected servers

    In Cursor: Check MCP status in settings
  </Step>

  <Step title="Test a tool">
    Try using one of your tools:

    "How did I sleep recently?"

    The client should call the `family_health` tool. (A no-auth smoke test: ask it to `echo` some text.)
  </Step>
</Steps>

<Check>
  You should see your Mirobody tools available in the AI client!
</Check>

## Authentication Flow

When using tools through MCP clients, OAuth authentication is handled automatically:

<Frame>
  <img src="https://mintcdn.com/thetahealth/XPteEwyWLNYyOt7h/images/mcp-sequence.svg?fit=max&auto=format&n=XPteEwyWLNYyOt7h&q=85&s=716cfafd705924dbfec078a04ea2f1be" alt="MCP request flow: user -> client -> MCP -> Mirobody -> answer" data-og-width="1000" width="1000" data-og-height="110" height="110" data-path="images/mcp-sequence.svg" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/thetahealth/XPteEwyWLNYyOt7h/images/mcp-sequence.svg?w=280&fit=max&auto=format&n=XPteEwyWLNYyOt7h&q=85&s=3c97ef9df96b61c4f112b92aa2632948 280w, https://mintcdn.com/thetahealth/XPteEwyWLNYyOt7h/images/mcp-sequence.svg?w=560&fit=max&auto=format&n=XPteEwyWLNYyOt7h&q=85&s=8d2663f650107ec26690162e0e397e62 560w, https://mintcdn.com/thetahealth/XPteEwyWLNYyOt7h/images/mcp-sequence.svg?w=840&fit=max&auto=format&n=XPteEwyWLNYyOt7h&q=85&s=4168d0178e485cac25a0b9747a016eee 840w, https://mintcdn.com/thetahealth/XPteEwyWLNYyOt7h/images/mcp-sequence.svg?w=1100&fit=max&auto=format&n=XPteEwyWLNYyOt7h&q=85&s=eb7a06293bf6d2496b587516c7dec631 1100w, https://mintcdn.com/thetahealth/XPteEwyWLNYyOt7h/images/mcp-sequence.svg?w=1650&fit=max&auto=format&n=XPteEwyWLNYyOt7h&q=85&s=eac517a26f968c337f9d775908024a9b 1650w, https://mintcdn.com/thetahealth/XPteEwyWLNYyOt7h/images/mcp-sequence.svg?w=2500&fit=max&auto=format&n=XPteEwyWLNYyOt7h&q=85&s=0aad55b0a21a86a7a7c83301b4f26a37 2500w" />
</Frame>

<Note>
  The OAuth token is managed by Mirobody. Users authenticate once, and tools have secure access to their data.
</Note>

## Available Endpoints

The MCP server exposes the following endpoint:

**Base URL**: `http://localhost:8080/mcp` (or `http://localhost:8080/mcp/{secret}` for a personal-MCP secret)

**Protocol**: JSON-RPC 2.0

**Methods** include:

* `tools/list`: List all available tools
* `tools/call`: Execute a specific tool

## Custom MCP Clients

### Direct HTTP Requests

You can call tools directly via HTTP:

```bash theme={null}
# List all tools
curl -X POST http://localhost:8080/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/list"
  }'

# Call a tool (auth-scoped tools need a bearer JWT)
curl -X POST http://localhost:8080/mcp \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "jsonrpc": "2.0",
    "id": 2,
    "method": "tools/call",
    "params": {
      "name": "family_health",
      "arguments": { "member": "me", "count": 20 }
    }
  }'
```

## Next Steps

<CardGroup cols={2}>
  <Card title="Built-in Tools" icon="wrench" href="/en/tools/built-in">
    Explore default health tools
  </Card>

  <Card title="Add Custom Tools" icon="plus" href="/en/tools/adding-tools">
    Create your own tools
  </Card>

  <Card title="MCP API Reference" icon="book" href="/en/api-reference/mcp-servers">
    Detailed MCP protocol documentation
  </Card>
</CardGroup>
