AI Assistant Setup Guide

Connect Claude & ChatGPT to Stock Data

Add StashGamma's daily OHLCV stock data to your AI assistant over MCP, then ask about any U.S.-listed symbol in plain language. Setup takes one URL.

Step 1 — Your API key and connection URL

Every StashGamma account gets its own API key (it starts with sg_live_). The key is how the server knows a request is yours: it identifies your account and counts the request against your plan's limits. Wherever this guide shows YOUR_API_KEY, your own key goes there.

Sign in and this page fills your key into every URL and snippet, ready to copy. The key is free — no card required.

Your connection URL

https://www.stashgamma.com/api/dataapi/mcp/YOUR_API_KEY

Replace YOUR_API_KEY with your key, or sign in and it is filled in for you.

How the key works

  • One key per account. The same key works for the REST API and for every assistant on this page, and they all share one usage allowance.
  • Free plan limits: 300 requests/hour, 800/day, 4,000/week. Each question your assistant answers with data uses one or two requests.
  • Treat the connection URL like a password. Anyone with it can use your allowance. It can only read stock prices — it cannot see or change anything in your StashGamma account.
  • If it leaks, rotate it in Profile → Developer API. The old key and any URL containing it stop working immediately; then update the URL in your assistant.

Step 2a — Claude

Claude on the web and the Claude desktop app

  1. Open Settings → Connectors and choose Add custom connector. (Custom connectors are available on Claude's paid plans.)
  2. Name it StashGamma and paste your connection URL from Step 1 into the server URL field.
  3. Leave the OAuth client fields empty and click Add.
  4. In a chat, open the tools menu, switch StashGamma on, and ask about a symbol.

Claude Code

One command. Claude Code can send a header, so the key stays out of the URL:

claude mcp add --transport http stashgamma https://www.stashgamma.com/api/dataapi/mcp --header "X-Api-Key: YOUR_API_KEY"

Or add it to a project's .mcp.json:

{
  "mcpServers": {
    "stashgamma": {
      "url": "https://www.stashgamma.com/api/dataapi/mcp",
      "headers": { "X-Api-Key": "YOUR_API_KEY" }
    }
  }
}

Claude API

The Messages API can call remote MCP servers directly. Use https://www.stashgamma.com/api/dataapi/mcp as the server URL and your key as its authorization token — see Anthropic's MCP connector documentation for the current request format.

Step 2b — ChatGPT

ChatGPT app (connector)

  1. Open Settings → Apps & Connectors → Advanced settings and turn on Developer mode. (Available on ChatGPT's paid plans; it is what allows a connector with custom tools.)
  2. Back in Apps & Connectors, choose Create.
  3. Name it StashGamma, paste your connection URL from Step 1 as the MCP server URL, and set Authentication to No authentication — the key is already in the URL.
  4. Confirm that you trust the application and click Create.
  5. In a new chat, enable the StashGamma connector from the tools menu and ask about a symbol.

Custom GPTs (Actions)

A Custom GPT uses an OpenAPI schema rather than MCP. In GPT Builder → Configure → Actions, paste the contents of stashgamma-eod.openapi.yaml, then set Authentication to API Key, Auth Type Custom, header name X-Api-Key, and your key as the value.

Step 2c — OpenAI API

The Responses API accepts a remote MCP server as a built-in tool. The key goes in a header here, not the URL:

from openai import OpenAI
client = OpenAI()

response = client.responses.create(
    model="gpt-4.1",
    tools=[{
        "type": "mcp",
        "server_label": "stashgamma",
        "server_url": "https://www.stashgamma.com/api/dataapi/mcp",
        "headers": {"X-Api-Key": "YOUR_API_KEY"},
        "require_approval": "never",
    }],
    input="What did QQQ close at, and how does that compare to a month ago?",
)
print(response.output_text)

Step 3 — Ask for data

Once connected, the assistant picks the right tool by itself. Some things to try:

  • "What did QQQ close at, and what was the change from the day before?"
  • "Get NVDA's daily bars for the last three months and summarize the trend."
  • "Compare AAPL and MSFT closing prices since January 1."
  • "How many StashGamma requests do I have left today?"
ToolWhat it returnsCounts as a request
get_latest_quoteMost recent daily bar plus change vs the previous closeYes
get_eod_dataDaily OHLCV bars for a date range (default: last 30 days)Yes
get_api_usageYour plan and remaining requests per hour/day/weekNo

Data is end-of-day: daily bars, updated after the U.S. market close. It is not a real-time or intraday feed. All three tools are read-only.

Troubleshooting

The assistant says it can't connect, or shows 401 / unauthorized
The key in the URL is missing, mistyped, or was rotated. Copy the connection URL from Step 1 again and replace the one saved in the assistant. Check that nothing was added after the key, such as a trailing space.
The connector was added but no tools appear
Connectors are usually off by default in each new chat — enable StashGamma from the chat's tools menu. In ChatGPT, confirm Developer mode is still on.
"Rate limit exceeded"
The message says which window (hour, day, or week) ran out and how many seconds until it resets. Asking for shorter date ranges in one question, instead of many separate questions, uses fewer requests.
"No EOD data for symbol"
The symbol isn't in the dataset yet, or isn't a U.S.-listed ticker. Use the plain ticker (for example BRK.B, not a company name).

Building your own agent? See the MCP server page for SDK code samples and the API documentation for the protocol reference.