MCP API Documentation

Model Context Protocol tools for StockSignal AI.

StockSignal AI exposes a read-only MCP server that AI assistants (ChatGPT, Claude, Cursor, etc.) can connect to. Callers can discover tickers, fetch full analyses, compare tickers, and view the top-scored leaderboard.

Authentication

Endpoint: /mcp

Protocol: OAuth 2.1 via the project's Lovable Cloud auth server. The MCP server accepts only Supabase-issued bearer tokens with the authenticated audience.

Required OAuth scopes: None. Supabase access tokens do not carry scopes; the only requirement is a valid, authenticated access token obtained after the user consents.

An MCP client must complete the OAuth consent flow at /.lovable/oauth/consent. Pasting a dashboard session token will not work — the token must be issued by the OAuth authorization server and include the client claim.

Try it

Try it

Runs the same tool handlers as /mcp, authorized with your current session.

No response yet — run a tool.
Equivalent JSON-RPC request to /mcp
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "list_tickers",
    "arguments": {}
  }
}

Schemas & downloads

Machine-readable schemas

JSON Schema (2020-12) for every tool — exact input/output fields, annotations, versions, and example payloads.

schema v1.1.0
Open live endpoint
list_tickersv1.0.0

List available tickers · changed 2026-08-22

analyze_tickerv1.1.0

Analyze ticker · changed 2026-08-23

leaderboardv1.1.0

Score leaderboard · changed 2026-08-23

compare_tickersv1.0.0

Compare tickers · changed 2026-08-22

Live endpoints: /api/public/mcp-schemas for the full bundle, ?tool=analyze_ticker for one tool. Responses carry an x-schema-version header.

OpenAPI 3.1 spec

Import into Postman, Insomnia, Swagger UI, or a codegen tool. One operation per MCP tool, with OAuth 2.1 security, example payloads, and 401/403/429/5xx responses.

Open live spec

Schema changelog

v1.1.02026-08-23
  • Bundle now carries schemaVersion, per-tool versions, and this changelog.
  • analyze_ticker: documented coverage and confidence data-quality fields.
  • leaderboard: documented the scoring window input.
  • Added an OpenAPI 3.1 spec at /api/public/mcp-openapi.
v1.0.02026-08-22
  • Initial JSON Schema (2020-12) bundle for all four MCP tools.

TypeScript client SDK

Generated from the OpenAPI spec — typed methods for every tool, OAuth bearer auth, and 429/5xx retry with backoff. Zero runtime dependencies.

v1.1.0
Open live endpoint

Live endpoint: /api/public/mcp-sdk returns every file as JSON; ?file=client.ts or ?file=bundle returns raw TypeScript.

Schema diff

Compare schema versions

Diff two published versions of a tool and see which changes break existing clients.

Backward compatible — additive changes only.

0 breaking · 19 non-breaking · upgrade

Breaking (0)

None — existing clients keep working.

Non-breaking (19)

  • input.ticker
    description changed
    input

    Documentation text changed; the wire contract is unchanged.

  • output.confidence
    required added
    output

    "confidence" is now guaranteed to be present in responses.

  • output.coverage
    required added
    output

    "coverage" is now guaranteed to be present in responses.

  • output.ticker
    description changed
    output

    Documentation text changed; the wire contract is unchanged.

  • output.name
    description changed
    output

    Documentation text changed; the wire contract is unchanged.

  • output.sector
    description changed
    output

    Documentation text changed; the wire contract is unchanged.

  • output.price
    description changed
    output

    Documentation text changed; the wire contract is unchanged.

  • output.changePct
    description changed
    output

    Documentation text changed; the wire contract is unchanged.

  • output.score
    description changed
    output

    Documentation text changed; the wire contract is unchanged.

  • output.rating
    description changed
    output

    Documentation text changed; the wire contract is unchanged.

  • output.confidence
    field added
    output

    New output field "confidence" (string).

  • output.coverage
    field added
    output

    New output field "coverage" (number).

  • output.pillars
    description changed
    output

    Documentation text changed; the wire contract is unchanged.

  • output.pillars[].key
    description changed
    output

    Documentation text changed; the wire contract is unchanged.

  • output.pillars[].label
    description changed
    output

    Documentation text changed; the wire contract is unchanged.

  • output.pillars[].score
    description changed
    output

    Documentation text changed; the wire contract is unchanged.

  • output.pillars[].weight
    description changed
    output

    Documentation text changed; the wire contract is unchanged.

  • output.catalysts
    description changed
    output

    Documentation text changed; the wire contract is unchanged.

  • output.risks
    description changed
    output

    Documentation text changed; the wire contract is unchanged.

Live endpoint: /api/public/mcp-schema-diff?tool=analyze_ticker&from=1.0.0&to=1.1.0. Omit tool to diff everything.

Rate limits & error responses

Rate limits

Limits are per account and reset on a rolling window. Every 429 includes a Retry-After header.

ScopeLimitBurstNotes
Per authenticated user120 tool calls / minute20 in any 10s windowShared across all four tools and the Try-it console.
analyze_ticker / compare_tickers60 calls / minute10 concurrentcompare_tickers counts one call per ticker in the request.
Unauthenticated /mcp requests0 (401 immediately)—Discovery metadata and /api/public/mcp-schemas stay open.
401Unauthorized

Missing, malformed, or expired bearer token. Re-run the OAuth flow.

HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer resource_metadata="https://<app>/.well-known/oauth-protected-resource"

{
  "jsonrpc": "2.0",
  "id": 1,
  "error": { "code": -32001, "message": "Unauthorized: missing or expired access token" }
}
403Forbidden

Valid token, but the account may not call this tool (e.g. admin-only leaderboard config).

HTTP/1.1 403 Forbidden

{
  "jsonrpc": "2.0",
  "id": 2,
  "error": { "code": -32002, "message": "Forbidden: account lacks access to this tool" }
}
429Rate limited

Limit above exceeded. Wait for Retry-After seconds, then retry with backoff + jitter.

HTTP/1.1 429 Too Many Requests
Retry-After: 12

{
  "jsonrpc": "2.0",
  "id": 3,
  "error": {
    "code": -32003,
    "message": "Rate limit exceeded, retry in 12s",
    "data": { "retryAfterSeconds": 12, "limit": 120, "window": "60s" }
  }
}
5xxServer / upstream error

Transient. Retry up to 3 times with exponential backoff; then surface the message.

HTTP/1.1 503 Service Unavailable

{
  "jsonrpc": "2.0",
  "id": 4,
  "error": {
    "code": -32603,
    "message": "Upstream market data unavailable",
    "data": { "retryable": true }
  }
}

Fields that explain staleness or missing data

A 200 response can still be degraded — check these before acting on a score.

FieldTypeWhat it tells you
coveragenumber 0-1Share of scoring inputs actually present. Below 1 means some pillars were skipped — treat the score as a wider band.
confidence"high" | "medium" | "low"Derived from coverage and data age. low means missing or stale inputs materially weakened the score.
pillars[].scorenumber | nullnull means that pillar had no usable data and was excluded from the weighted total.
asOfISO 8601 timestampWhen the snapshot was produced. Anything older than 15 minutes should be shown to end users as stale.
dataSource / isDemostring / booleanProvenance. isDemo: true (source "simulated") means the numbers are generated demo data, not live market data.

Response headers

Response headers
Planned contract for /mcp
Every JSON response from the /mcp endpoint carries these headers, so clients can judge freshness and pace requests without parsing the body.

Staleness & data quality

HeaderTypeExampleMeaning
X-StockSignal-Coveragefloat 0–10.88Fraction of scoring inputs that had data for this response. Below 1 means some pillars were skipped and re-weighted.
X-StockSignal-Confidencelow | medium | highmediumModel confidence derived from coverage and input freshness. Treat `low` as directional only.
X-StockSignal-As-OfRFC 3339 timestamp2026-08-23T18:41:02.000ZWhen the underlying market snapshot was captured.
X-StockSignal-Stale-Secondsinteger seconds412Age of the snapshot at response time. Clients should warn past 900s.
X-StockSignal-Demotrue | falsetrue`true` when the payload is simulated demo data rather than a live market feed.
X-StockSignal-Schema-Versionsemver1.1.0Version of the tool input/output schemas used to produce this response.
X-StockSignal-Tool-Versionsemver0.2.0Version of the MCP server interface.

Values are the worst case across everything in the response — a compare_tickers call reports the lowest coverage and the oldest timestamp of the tickers it returned.

Rate limiting

HeaderTypeExampleMeaning
X-RateLimit-Limitinteger120Per-user tool calls allowed in the 60s window.
X-RateLimit-Remaininginteger117Per-user calls left in the current window.
X-RateLimit-Resetunix seconds1774291320When the per-user window resets.
X-RateLimit-Tool-Limitinteger60Per-tool calls allowed in the window for this caller.
X-RateLimit-Tool-Remaininginteger59Per-tool calls left for this caller.
Retry-Afterinteger seconds12Only present on 429. Wait this long before retrying (add jitter).

Counters are per caller (OAuth subject) over a rolling 60s window and are enforced per server instance, so treat remaining counts as approximate under heavy fan-out.

Example: successful tool call

HTTP/1.1 200 OK
Content-Type: application/json
X-StockSignal-Coverage: 0.88
X-StockSignal-Confidence: medium
X-StockSignal-As-Of: 2026-08-23T18:41:02.000Z
X-StockSignal-Stale-Seconds: 412
X-StockSignal-Demo: true
X-StockSignal-Schema-Version: 1.1.0
X-StockSignal-Tool-Version: 0.2.0
X-RateLimit-Limit: 120
X-RateLimit-Remaining: 117
X-RateLimit-Reset: 1774291320
X-RateLimit-Tool-Limit: 60
X-RateLimit-Tool-Remaining: 59

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "structuredContent": {
      "ticker": "EXEL",
      "score": 78,
      "rating": "Buy",
      "confidence": "medium",
      "coverage": 0.88,
      "isDemo": true
    }
  }
}

Example: rate limited

HTTP/1.1 429 Too Many Requests
Content-Type: application/json
X-RateLimit-Limit: 120
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1774291380
Retry-After: 12

{
  "jsonrpc": "2.0",
  "id": 7,
  "error": {
    "code": -32003,
    "message": "Rate limit exceeded, retry in 12s",
    "data": { "limit": 120, "windowSeconds": 60, "retryAfter": 12 }
  }
}

Versioning & status

Server version

0.2.0

Min compatible

0.2.0

MCP protocol

2025-06-18

Interface last changed

2026-08-23

Compatibility check: GET /mcp/status (public mirror: /api/public/mcp-status). Tools follow semver — a major bump means a breaking input/output change, a minor bump means additive fields.

Open raw JSON

Tool versions

ToolVersionStatusLast changedWhat changed
list_tickers1.0.0
stable
2026-08-22Ticker discovery. Inputs and output shape unchanged since launch.
analyze_ticker1.1.0
stable
2026-08-23Added coverage/confidence data-quality fields alongside the pillar breakdown; existing fields unchanged.
compare_tickers1.0.0
stable
2026-08-22Side-by-side comparison of 2-4 tickers.
leaderboard1.1.0
stable
2026-08-23Added the admin-controlled scoring window (1M/3M/6M/1Y) to inputs and output.

Changelog

v0.2.02026-08-23
  • OAuth 2.1 protection added — all tool calls require a signed-in StockSignal AI account.
  • analyze_ticker now returns coverage and confidence.
  • leaderboard accepts a scoring window.
  • Published machine-readable JSON Schemas at /api/public/mcp-schemas.
v0.1.02026-08-22
  • Initial MCP server with list_tickers, analyze_ticker, compare_tickers, leaderboard.

Tools

List available tickers

list_tickers
Read-only: YesIdempotent: YesDestructive: No

List every US ticker available in the StockSignal AI demo dataset, with company name and sector.

Inputs

No inputs required.

Outputs

FieldTypeDescription
tickersobject[]Array of { ticker, name, sector } objects.

Analyze ticker

analyze_ticker
Read-only: YesIdempotent: YesDestructive: No

Return the full StockSignal AI analysis for a US ticker from the demo dataset: current price, 0-100 score, rating, per-pillar scores, catalysts, risks, and bull/base/bear cases.

Inputs

FieldTypeRequiredDescription
tickerstring
Required
US stock ticker symbol, e.g. EXEL, NVDA, AAPL.

Outputs

FieldTypeDescription
tickerstringUppercase ticker symbol.
namestringCompany name.
sectorstringIndustry sector.
pricenumberSimulated current price.
changePctnumberSimulated daily percent change.
scoreintegerOverall 0-100 score.
ratingstringPlain-English rating (e.g. Strong Buy, Buy).
confidencestringHigh / Medium / Low confidence.
coveragenumberPercent of input pillars that have data.
pillarsobject[]Per-pillar scores with key, label, score, weight.
catalystsstring[]Upcoming catalysts.
risksstring[]Key risk flags.
casesobjectBull / base / bear narrative cases.

Score leaderboard

leaderboard
Read-only: YesIdempotent: YesDestructive: No

Rank the StockSignal AI demo tickers by overall 0-100 score, highest first. Optional limit.

Inputs

FieldTypeRequiredDescription
limitinteger
Optional
Max number of tickers to return (default 10, max 50).

Outputs

FieldTypeDescription
leadersobject[]Array of { ticker, name, sector, score, rating, confidence, changePct }.

Compare tickers

compare_tickers
Read-only: YesIdempotent: YesDestructive: No

Compare 2-4 US tickers side by side: score, rating, price, percent change, and per-pillar scores. Missing tickers are reported in the response.

Inputs

FieldTypeRequiredDescription
tickersstring[]
Required
2 to 4 US ticker symbols to compare.

Outputs

FieldTypeDescription
comparisonobject[]Array of per-ticker result objects, including available flag.
Educational data. All values are demo / simulated data for illustration. Not real market data, and not financial advice.