Thesis
Thesis
面向散户投资者的自托管逐代码研究空间。通过 PWA 分享面板从任何地方捕获内容。该工作区暴露了一个 MCP 服务器,以便您自己的代理(Claude、ChatGPT、Codex CLI)进行综合。单用户 MVP——您的数据保留在您的 Cloudflare 账户中。
研究辅助,而非建议。代理负责撰写;您来做决定。
架构
┌─────────────────────────────────────────────────────────────┐
│ Browser / Mobile │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ PWA (Vite + React + Tailwind) │ │
│ │ - Web Share Target - Workspace tabs │ │
│ │ - Tiptap rich text - Component renderer │ │
│ └────────────────────┬─────────────────────────────────┘ │
└───────────────────────┼─────────────────────────────────────┘
│ /api/* /mcp
┌───────────────────────▼─────────────────────────────────────┐
│ Cloudflare Worker (Hono) │
│ ┌───────────────────────────────┐ ┌──────────────────┐ │
│ │ Workspace Durable Object │ │ WorkspaceAgent │ │
│ │ SQLite + embedding BLOB │ │ DO (Slice 4) │ │
│ │ 30 MCP tools │ │ nightly cron │ │
│ └───────────────────────────────┘ └──────────────────┘ │
│ ┌───────────────────────────────────────────────────────┐ │
│ │ Data providers │ │
│ │ Yahoo Stooq EDGAR Finnhub FRED │ │
│ └───────────────────────────────────────────────────────┘ │
│ ┌──────────────┐ ┌────────────┐ ┌──────────────────────┐ │
│ │ R2 (docs) │ │ KV cache │ │ CF AI Gateway │ │
│ └──────────────┘ └────────────┘ └──────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
Future:
┌─────────────────────────┐
│ Auth app (Slice 5) │
│ better-auth + Postgres │
│ Docker → Fly.io │
└─────────────────────────┘Related MCP server: equity-desk
快速开始
git clone <repo> && cd invest
npm install
cp apps/worker/.dev.vars.example apps/worker/.dev.vars
# Edit apps/worker/.dev.vars — set THESIS_BEARER_TOKEN, optionally FINNHUB_API_KEY + FRED_API_KEY
# Terminal 1 — worker on :8787
npm run dev:worker
# Terminal 2 — PWA on :5173 (proxies /api and /mcp to :8787)
npm run dev:pwa打开 http://localhost:5173。在 设置 中添加一个 bearer 令牌(使用 .dev.vars 中的值)。
连接代理(BYOA)
GET /api/mcp-info 返回 MCP 端点、工具列表和认证说明。设置页面以可复制的 URL 形式呈现相同信息。
流式 HTTP(首选):
POST /mcp、GET /mcp旧版 SSE:
GET /mcp/sse、POST /mcp/messages认证:
Authorization: Bearer <token>或?token=<token>
环境变量
所有机密都放在 apps/worker/.dev.vars 中用于本地开发。参见 apps/worker/.dev.vars.example。
变量 | 必需 | 说明 |
| 是 | 所有 API + MCP 请求的共享密钥 |
| 可选 | 在 finnhub.io 免费获取 — 启用基本面、收益、新闻 |
| 可选 | 在 fred.stlouisfed.org 免费获取 — 启用宏观图块 |
| 可选 | 2025 年验证码门槛 — 跳过以使用 Yahoo 回退 |
| 切片 4 | 嵌入式代理夜间运行所需 |
| 切片 4 | Cloudflare AI Gateway 令牌 |
| 切片 4 | 您的 CF 账户 ID |
| 可选 | 默认每个工作区每月 200000 个令牌 |
已交付的切片
完整的决策日志和切片历史:docs/roadmap/GRILL-ME.md
切片 | 描述 | 状态 |
W0–W5 | 基础、作者身份、综合、视角、证据、数据 | ✅ |
切片 0 | 稳定化、Stooq 文档、EDGAR 重试、主题色 | ✅ |
切片 1 | 组合原语 — | ✅ |
切片 1.5 | 完整插槽映射 + 扩展组件词汇 | 🔄 |
切片 2 | 检索 — 嵌入(BLOB 余弦)、 | ✅ |
切片 3 | 时间性 — | ✅ |
切片 4 | 嵌入式代理 — WorkspaceAgent DO、夜间 cron、AI Gateway | ✅ |
切片 5 | 认证 — better-auth、Docker 化认证应用 | 设计中 |
切片 6 | 聊天界面 | 设计中 |
切片 7 | 跨代码 Vectorize 层 | 设计中 |
冒烟测试
分类的冒烟测试位于 smoke/。
# All Playwright specs (UI + E2E)
npm run smoke
# Individual shell scripts (worker API — no browser needed)
bash smoke/ingestion/capture.smoke.sh
bash smoke/claims/claims.smoke.sh
bash smoke/agent/agent.smoke.sh # needs ANTHROPIC_API_KEY部署
Cloudflare Worker + PWA
# 1. Build PWA into apps/pwa/dist
npm run build:pwa
# 2. Set production secrets (one-time)
cd apps/worker
wrangler secret put THESIS_BEARER_TOKEN
wrangler secret put ANTHROPIC_API_KEY
wrangler secret put CF_AIG_TOKEN
wrangler secret put FINNHUB_API_KEY
wrangler secret put FRED_API_KEY
# 3. Deploy worker + PWA assets
wrangler deployWorker 从同一源提供 PWA。/share-target、/mcp 和 /api/* 都是第一方。
完整的部署指南,包括 auth-app Docker 目标、DNS 和部署后冒烟检查:docs/deployment.md。
技术栈
层 | 技术 |
Worker 运行时 | Cloudflare Workers + Durable Objects (SQLite) |
API 框架 | Hono |
MCP | 手写 JSON-RPC over HTTP + SSE(30 个工具) |
PWA | Vite 5 + React 18 + Tailwind 3 |
富文本 | Tiptap |
嵌入 | Workers AI |
代理 | 普通 Durable Object( |
文档 | R2 + |
共享类型 |
|
贡献
阅读
docs/STATUS.md— 当前状态 + 前瞻计划阅读
docs/architecture/v2-embedded-agent.md— v2 设计在推送前运行
npm run typecheck在
smoke/中为新端点添加冒烟测试覆盖
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Licensed, cited financial data for AI agents: news, filings, transcripts, research and tearsheets.
Research agents, a shared workspace and market data for investment research teams.
Real SEC, 13F, insider, congress & macro data your AI agent can cite. Hosted MCP, 24 tools.
Research layer for AI agents: stock theses, filing Q&A with page cites, monitoring. Research-only.
Related MCP Servers
AlicenseBqualityBmaintenanceProvides AI agents with direct access to SEC filing intelligence, company fundamentals, dilution risk scoring, and cross-company analytics for financial research.1131,200 npm45MIT- AlicenseNot gradedqualityDmaintenanceEnables AI agents to perform grounded equity research by analyzing tickers from SEC filings and market data, producing citation-guarded memos with pre-computed fundamentals.MIT
- AlicenseNot gradedqualityBmaintenanceFinancial data and research MCP for AI agents: filings with full-text and fact search, statements as reported, earnings, insider and institutional ownership, corporate events, executives, analyst data, company discovery and research signals for US, China and Japan equities. Every figure traced to its filing. Browser sign-in.10MIT
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to access and analyze financial data such as stocks, ETFs, crypto, forex, commodities, company fundamentals, financial statements, and market insights through 250+ configurable tools.307 npmApache 2.0