# MCP Server Setup

<video
  autoPlay
  loop
  muted
  playsInline
  poster="/fruitstand-fund-returns-poster.jpg"
  aria-label="Comparing SPY, QQQ, VTI and other ETF returns through the Fruit Stand Fund Returns MCP server in Claude"
  style={{ width: "100%", borderRadius: "8px", border: "1px solid var(--border, rgba(120, 120, 120, 0.25))" }}
>
  <source src="/fruitstand-fund-returns.mp4" type="video/mp4" />
</video>

The API is also a hosted **[Model Context Protocol](https://modelcontextprotocol.io) (MCP)**
server, so an AI assistant can pull fund returns directly into a conversation. It's the same data,
the same key, and the same [rate limits and quotas](/errors) as the REST API — every tool call is
metered exactly like a REST request.

<Button asChild>
  <a href="https://app.fruitstand.dev/pricing">Get a free API key</a>
</Button>

## Endpoint

```
https://api.fruitstand.dev/mcp
```

Remote MCP over Streamable HTTP, authenticated with your API key as a **bearer token**.

## Connect a client

**Native remote-MCP clients** — point them at the endpoint above and set an
`Authorization: Bearer YOUR_API_KEY` header.

**Claude Desktop** (and other clients that run local MCP servers) — bridge to the remote endpoint
with `mcp-remote`. Add this to your MCP config (`claude_desktop_config.json`):

```json
{
  "mcpServers": {
    "fruit-stand": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://api.fruitstand.dev/mcp",
        "--header",
        "Authorization: Bearer YOUR_API_KEY"
      ]
    }
  }
}
```

Restart the client, and the Fruit Stand tools appear.

## Tools

Six tools, mirroring the REST endpoints:

| Tool | Does | Key inputs |
|---|---|---|
| `searchFunds` | Search/list the fund universe | `q`, `type`, `country`, `exchange`, `cursor`, `limit` |
| `getFund` | Fund metadata by ticker | `code` |
| `getTrailingReturns` | Trailing returns for one fund | `code`, `as_of` (optional) |
| `batchTrailingReturns` | Trailing returns for up to 100 funds | `codes[]`, `as_of` (optional) |
| `getCalendarReturns` | Calendar-year return for one fund | `code`, `year` (optional) |
| `batchCalendarReturns` | Calendar-year returns for up to 100 funds | `codes[]`, `year` (optional) |

## Try it

Once connected, ask your assistant something like:

> *"Compare the 1-year, 5-year, and since-inception returns of SPY, QQQ, and VTI, and tell me
> which had the best 2022 calendar year."*

The assistant will call `batchTrailingReturns` and `batchCalendarReturns` and summarize the
results. Returns come back as decimal fractions — see [Methodology](/methodology) for how they're
computed and [Field reference](/fields) for what each field means.

> **Metering note:** MCP tool calls are subscription-gated and metered just like REST calls. A key
> with no active plan gets a `403` on tool calls; usage counts against your monthly
> [quota](/errors).
