{
  "schemaVersion": "1.1.0",
  "serverVersion": "0.2.0",
  "language": "typescript",
  "generatedAt": "2026-12-01T08:55:51.757Z",
  "source": "/api/public/mcp-openapi",
  "usage": "?file=client.ts for raw text, ?file=bundle for a single-file client",
  "files": [
    {
      "path": "index.ts",
      "contents": "/**\n * index.ts — StockSignal AI MCP client SDK\n * AUTO-GENERATED from /api/public/mcp-openapi. Do not edit by hand.\n *\n * schema version : 1.1.0\n * server version : 0.2.0\n * MCP protocol   : 2025-06-18\n * generated      : 2026-12-01T08:55:51.757Z\n *\n * All data is simulated demo data for education — not financial advice.\n */\n\nexport * from \"./client\";\nexport * from \"./errors\";\nexport * from \"./types\";\n"
    },
    {
      "path": "client.ts",
      "contents": "/**\n * client.ts — StockSignal AI MCP client SDK\n * AUTO-GENERATED from /api/public/mcp-openapi. Do not edit by hand.\n *\n * schema version : 1.1.0\n * server version : 0.2.0\n * MCP protocol   : 2025-06-18\n * generated      : 2026-12-01T08:55:51.757Z\n *\n * All data is simulated demo data for education — not financial advice.\n */\n\nimport { McpError, isRetryable } from \"./errors\";\nimport type {\n  ListTickersInput,\n  ListTickersOutput,\n  AnalyzeTickerInput,\n  AnalyzeTickerOutput,\n  LeaderboardInput,\n  LeaderboardOutput,\n  CompareTickersInput,\n  CompareTickersOutput,\n} from \"./types\";\n\nexport type StockSignalMcpClientOptions = {\n  /** Origin of the StockSignal AI deployment, e.g. https://stocksignal-ai.lovable.app */\n  baseUrl: string;\n  /** Static OAuth 2.1 bearer token. */\n  accessToken?: string;\n  /** Or a getter, called before every request (useful for refreshing tokens). */\n  getAccessToken?: () => string | Promise<string>;\n  /** Retry attempts for 429/5xx responses. Default 3. */\n  maxRetries?: number;\n  fetchImpl?: typeof fetch;\n};\n\nexport class StockSignalMcpClient {\n  private readonly baseUrl: string;\n  private readonly options: StockSignalMcpClientOptions;\n  private id = 0;\n\n  constructor(options: StockSignalMcpClientOptions) {\n    if (!options.baseUrl) throw new Error(\"baseUrl is required\");\n    this.baseUrl = options.baseUrl.replace(/\\/$/, \"\");\n    this.options = options;\n  }\n\n  private async token(): Promise<string> {\n    if (this.options.getAccessToken) return await this.options.getAccessToken();\n    if (this.options.accessToken) return this.options.accessToken;\n    throw new McpError(\"No access token: pass accessToken or getAccessToken.\", -32001, 401);\n  }\n\n  /** Low-level JSON-RPC 2.0 tools/call against POST /mcp. */\n  async call<R>(name: string, args: Record<string, unknown>): Promise<R> {\n    const doFetch = this.options.fetchImpl ?? fetch;\n    const maxRetries = this.options.maxRetries ?? 3;\n    let attempt = 0;\n\n    for (;;) {\n      const res = await doFetch(`${this.baseUrl}/mcp`, {\n        method: \"POST\",\n        headers: {\n          \"content-type\": \"application/json\",\n          accept: \"application/json, text/event-stream\",\n          authorization: `Bearer ${await this.token()}`,\n        },\n        body: JSON.stringify({\n          jsonrpc: \"2.0\",\n          id: ++this.id,\n          method: \"tools/call\",\n          params: { name, arguments: args },\n        }),\n      });\n\n      if (!res.ok) {\n        if (isRetryable(res.status) && attempt < maxRetries) {\n          const retryAfter = Number(res.headers.get(\"retry-after\"));\n          const waitMs = Number.isFinite(retryAfter) && retryAfter > 0 ? retryAfter * 1000 : 2 ** attempt * 500;\n          await new Promise((r) => setTimeout(r, waitMs));\n          attempt++;\n          continue;\n        }\n        const text = await res.text().catch(() => \"\");\n        throw new McpError(`MCP request failed (${res.status}): ${text.slice(0, 300)}`, -32000, res.status);\n      }\n\n      const payload: any = await res.json();\n      if (payload?.error) {\n        throw new McpError(payload.error.message ?? \"MCP error\", payload.error.code ?? -32000, res.status, payload.error.data);\n      }\n      const result = payload?.result;\n      if (result?.isError) {\n        throw new McpError(result?.content?.[0]?.text ?? \"Tool returned an error\", -32000, res.status, result);\n      }\n      return (result?.structuredContent ?? result) as R;\n    }\n  }\n\n  /**\n   * List available tickers (tool v1.0.0).\n   * List every US ticker available in the StockSignal AI demo dataset, with company name and sector.\n   */\n  listTickers(args: ListTickersInput = {} as ListTickersInput): Promise<ListTickersOutput> {\n    return this.call<ListTickersOutput>(\"list_tickers\", args as Record<string, unknown>);\n  }\n\n  /**\n   * Analyze ticker (tool v1.1.0).\n   * 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.\n   */\n  analyzeTicker(args: AnalyzeTickerInput): Promise<AnalyzeTickerOutput> {\n    return this.call<AnalyzeTickerOutput>(\"analyze_ticker\", args as Record<string, unknown>);\n  }\n\n  /**\n   * Score leaderboard (tool v1.1.0).\n   * Rank the StockSignal AI demo tickers by overall 0-100 score, highest first. Optional limit.\n   */\n  leaderboard(args: LeaderboardInput): Promise<LeaderboardOutput> {\n    return this.call<LeaderboardOutput>(\"leaderboard\", args as Record<string, unknown>);\n  }\n\n  /**\n   * Compare tickers (tool v1.0.0).\n   * Compare 2-4 US tickers side by side: score, rating, price, percent change, and per-pillar scores. Missing tickers are reported in the response.\n   */\n  compareTickers(args: CompareTickersInput): Promise<CompareTickersOutput> {\n    return this.call<CompareTickersOutput>(\"compare_tickers\", args as Record<string, unknown>);\n  }\n}\n\nexport type {\n  ListTickersInput,\n  ListTickersOutput,\n  AnalyzeTickerInput,\n  AnalyzeTickerOutput,\n  LeaderboardInput,\n  LeaderboardOutput,\n  CompareTickersInput,\n  CompareTickersOutput,\n} from \"./types\";\nexport { McpError } from \"./errors\";\nexport default StockSignalMcpClient;\n"
    },
    {
      "path": "types.ts",
      "contents": "/**\n * types.ts — StockSignal AI MCP client SDK\n * AUTO-GENERATED from /api/public/mcp-openapi. Do not edit by hand.\n *\n * schema version : 1.1.0\n * server version : 0.2.0\n * MCP protocol   : 2025-06-18\n * generated      : 2026-12-01T08:55:51.757Z\n *\n * All data is simulated demo data for education — not financial advice.\n */\n\nexport const SCHEMA_VERSION = \"1.1.0\";\nexport const SERVER_VERSION = \"0.2.0\";\nexport const MCP_PROTOCOL_VERSION = \"2025-06-18\";\n\nexport type ToolName = \"list_tickers\" | \"analyze_ticker\" | \"leaderboard\" | \"compare_tickers\";\n\n/** Input for `list_tickers` (tool v1.0.0). List available tickers. */\nexport type ListTickersInput = Record<string, unknown>;\n\n/** Output of `list_tickers` (tool v1.0.0). */\nexport type ListTickersOutput = {\n  tickers: {\n    /** Uppercase US ticker symbol. */\n    ticker: string;\n    /** Company name. */\n    name: string;\n    /** Industry sector. */\n    sector: string;\n  }[];\n};\n\n/** Input for `analyze_ticker` (tool v1.1.0). Analyze ticker. */\nexport type AnalyzeTickerInput = {\n  /** US stock ticker symbol, e.g. EXEL, NVDA, AAPL. Case-insensitive. */\n  ticker: string;\n};\n\n/** Output of `analyze_ticker` (tool v1.1.0). */\nexport type AnalyzeTickerOutput = {\n  /** Uppercase ticker symbol. */\n  ticker: string;\n  /** Company name. */\n  name: string;\n  /** Industry sector. */\n  sector: string;\n  /** Simulated current price in USD. */\n  price: number;\n  /** Simulated daily percent change. */\n  changePct: number;\n  /** Overall 0-100 score. */\n  score: number;\n  /** Plain-English rating derived from the overall score. */\n  rating: \"Strong Buy\" | \"Buy\" | \"Hold\" | \"Reduce\" | \"Avoid\";\n  /** Confidence in the score. */\n  confidence: \"High\" | \"Medium\" | \"Low\";\n  /** Percent of pillars with data. */\n  coverage: number;\n  /** Per-pillar scores and weights. */\n  pillars: {\n    /** Pillar identifier, e.g. growth, valuation. */\n    key: string;\n    /** Human-readable pillar name. */\n    label: string;\n    /** 0-100 pillar score. */\n    score: number;\n    /** Weight of this pillar in the overall score (0-1). */\n    weight: number;\n  }[];\n  /** Upcoming catalysts. */\n  catalysts: string[];\n  /** Key risk flags. */\n  risks: string[];\n  cases: {\n    bull: string;\n    base: string;\n    bear: string;\n  };\n};\n\n/** Input for `leaderboard` (tool v1.1.0). Score leaderboard. */\nexport type LeaderboardInput = {\n  /** Max number of tickers to return. */\n  limit?: number;\n};\n\n/** Output of `leaderboard` (tool v1.1.0). */\nexport type LeaderboardOutput = {\n  leaders: {\n    ticker: string;\n    name: string;\n    sector: string;\n    score: number;\n    rating: \"Strong Buy\" | \"Buy\" | \"Hold\" | \"Reduce\" | \"Avoid\";\n    confidence: \"High\" | \"Medium\" | \"Low\";\n    changePct: number;\n  }[];\n};\n\n/** Input for `compare_tickers` (tool v1.0.0). Compare tickers. */\nexport type CompareTickersInput = {\n  /** 2 to 4 US ticker symbols to compare. */\n  tickers: string[];\n};\n\n/** Output of `compare_tickers` (tool v1.0.0). */\nexport type CompareTickersOutput = {\n  comparison: {\n    ticker: string;\n    /** False when the ticker is not in the demo dataset. */\n    available: boolean;\n    name?: string;\n    sector?: string;\n    price?: number;\n    changePct?: number;\n    score?: number;\n    rating?: \"Strong Buy\" | \"Buy\" | \"Hold\" | \"Reduce\" | \"Avoid\";\n    confidence?: \"High\" | \"Medium\" | \"Low\";\n    pillars?: {\n      /** Pillar identifier, e.g. growth, valuation. */\n      key: string;\n      /** Human-readable pillar name. */\n      label: string;\n      /** 0-100 pillar score. */\n      score: number;\n      /** Weight of this pillar in the overall score (0-1). */\n      weight: number;\n    }[];\n  }[];\n};\n"
    },
    {
      "path": "errors.ts",
      "contents": "/**\n * errors.ts — StockSignal AI MCP client SDK\n * AUTO-GENERATED from /api/public/mcp-openapi. Do not edit by hand.\n *\n * schema version : 1.1.0\n * server version : 0.2.0\n * MCP protocol   : 2025-06-18\n * generated      : 2026-12-01T08:55:51.757Z\n *\n * All data is simulated demo data for education — not financial advice.\n */\n\nexport class McpError extends Error {\n  readonly code: number;\n  readonly status?: number;\n  readonly data?: unknown;\n\n  constructor(message: string, code: number, status?: number, data?: unknown) {\n    super(message);\n    this.name = \"McpError\";\n    this.code = code;\n    this.status = status;\n    this.data = data;\n  }\n\n  /** True for 401/403 — re-run the OAuth flow or use a different account. */\n  get isAuthError() {\n    return this.status === 401 || this.status === 403;\n  }\n\n  /** True for 429 — back off and retry. */\n  get isRateLimited() {\n    return this.status === 429;\n  }\n}\n\nexport function isRetryable(status?: number) {\n  return status === 429 || (typeof status === \"number\" && status >= 500);\n}\n"
    },
    {
      "path": "README.md",
      "contents": "# StockSignal AI — MCP TypeScript SDK\n\nAuto-generated from the OpenAPI spec at `https://stocksignalai.pro/api/public/mcp-openapi`.\n\n- Schema version: `1.1.0`\n- Server version: `0.2.0`\n- MCP protocol: `2025-06-18`\n\n## Install\n\nDrop `client.ts`, `types.ts`, `errors.ts`, and `index.ts` into your project. No runtime dependencies (needs `fetch`, i.e. Node 18+, Bun, Deno, or a browser).\n\n## Authentication\n\nEvery tool call needs an OAuth 2.1 bearer token issued by the StockSignal AI authorization server. Complete the consent flow at `https://stocksignalai.pro/.lovable/oauth/consent` and exchange the code at `https://stocksignalai.pro/.mcp/token`. No scopes are required.\n\n## Usage\n\n```ts\nimport { StockSignalMcpClient, McpError } from \"./index\";\n\nconst client = new StockSignalMcpClient({\n  baseUrl: \"https://stocksignalai.pro\",\n  accessToken: process.env.STOCKSIGNAL_TOKEN!,\n});\n\nconst { tickers } = await client.listTickers();\n\ntry {\n  const analysis = await client.analyzeTicker({ ticker: \"EXEL\" });\n  console.log(analysis.score, analysis.rating, analysis.confidence);\n} catch (err) {\n  if (err instanceof McpError && err.isRateLimited) {\n    // client already retried with backoff; handle terminal failure here\n  }\n  throw err;\n}\n\nconst { leaders } = await client.leaderboard({ limit: 5 });\nconst { comparison } = await client.compareTickers({ tickers: [\"EXEL\", \"NVDA\"] });\n```\n\n## Data quality\n\n`analyze_ticker` returns `coverage` (percent of pillars with data) and `confidence` (High/Medium/Low). Low coverage or low confidence means the score is based on incomplete inputs.\n\nAll values are simulated demo data for education — not real market data, not financial advice.\n"
    }
  ]
}