InvestBrain

by lj22503

Not rated
GitHub

About

AI-powered investment research MCP server with GraphRAG, behavior pattern detection, trading journal analysis, and market data integration

Details

Author
lj22503
Categories
Finance, Other

Setup

Install InvestBrain in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/lj22503/invest-brain

Follow the installation instructions in the repository README, then restart your MCP client.

有经验投资者的纪律自主工具,解决"知行合一"问题不是投顾,不给建议,而是"镜子" + "纪律锚点"
- 下载并安装InvestBrain_0.1.2_x64_en-US.msi(见Releases)
- 打开桌面应用,即见「大脑已加载」状态条与试聊引导
- 想对话时在设置页填入自己的 LLM Key,即可走真实对话链路

桌面端数据存储在%APPDATA%\InvestBrain\data,设置页可直接查看数据位置。

# 1. 安装 MCP Server 依赖 cd src/mcp_server && pip install -r requirements.txt # 2. 配置你自己的 LLM API Key(见下文「你的 Key,自己填」) cp .env.example .env # 编辑 .env,把 DEEPSEEK_API_KEY 填成你从 DEEPSEEK 后台拿到的 key # 3. 启动 MCP Server python server.py

首次启动提示:向量库(Chroma + ONNX Embedding)首次会下载约 80MB 模型文件。若希望跳过向量库、纯工具调用体验,可保持server.py中相关注释不变;如需完整 RAG 体验,下载后取消server.py内的注释行。

启动后 Server 会以 stdio 方式接受 MCP 客户端调用。配置 Claude Desktop 见下方Claude Desktop 接入。

重要:本仓库不预置任何用户的 API keydata/config/llm.jsonapi_key默认为 null(不是真的 key 占位);.env.example只是模板;webhook.json是空 schema。

- MCP 启动必须DEEPSEEK_API_KEY环境变量(推荐 User 级系统环境变量,或 CLAUDE.md /.env
- 可选:TUSHARE_TOKEN/DASHSCOPE_API_KEY/AGAINST_API_KEY(环境变量)
- 飞书 webhook:data/config/webhook.json里的feishu字段(已被.gitignore保护)

- 你的 key 是你的——不要 share、不要 commit、不要发到任何对话里
- key 进 git 历史(如被 commit 过的老版本)即使后来 rotate 仍可能被人滥用 →发现泄露立即去对应平台 rotate
- 仓库已有.gitignore保护data/config/.json(含 llm/webhook 配置)+data/memory/.db(用户记忆库,按 CLAUDE.md 决策"用户数据本地存储,不上传云端"),不要!取消忽略

备注:仓库历史曾 commit 过密钥占位(commit22e6c72),如已 push 远端,老 key 在 clone 历史里仍可被读——清历史成本高、通常接受 + rotate 即可

powershell -ExecutionPolicy Bypass -File scripts/configure_pushplus.ps1

脚本会交互式引导你完成全部步骤:显示 PushPlus 获取 token 的操作步骤 → 粘贴 token(自动校验格式)→ 写入data/config/webhook.json并启用pushplus渠道 → 自动调用send_notification发送测试消息 → 打印成功/失败原因。

1. 查看当前配置状态:notify_get_notifier_config() 2. 配置 PushPlus 并发送测试:notify_configure_notifier(channel="pushplus", token="你的token", enabled=true, send_test=true)

- 微信扫码关注公众号:https://www.pushplus.plus
- 进入「个人中心」→ 复制页面上的 token
- 填入上述任一方式

验证成功:收到测试消息,或notify_get_notifier_config()返回"enabled_channels": ["pushplus"]。未配置渠道时,提醒触发路径(price_checker/scheduler)返回中会携带setup_guide引导信息,而不会静默失败。

安全说明:data/config/webhook.json已被.gitignore保护,token 不会进入 git;请勿把 token 发到任何对话或提交到仓库。

用户:段永平怎么看"快钱"和"慢钱"?

调用rag_ask_investment(question="段永平怎么看快钱和慢钱")

AI 返回: 段永平的核心观点是"快钱"看似机会多但风险敞口大,"慢钱"依靠复利与确定性。 在「段永平」语料中相关论述 12 条,节选:

"投资赚钱的速度不应该快过学习的速度。" "敢重仓的就是你能看懂的生意,剩下的不是机会。" 关联概念:能力圈、安全边际、复利。
-

追涨模式(置信度 0.83) 触发样本:买入 NVDA/TSLA 在单日涨幅 > 5% 后的 D+1/D+2,胜率 25%,平均收益 -3.2% 建议:买入前强制查看rag_ask_investment(question="追高的代价")

恐慌割肉模式(置信度 0.71) 触发样本:持仓亏损 > 15% 后的 5 日内卖出,后续 30 日反弹 67% 建议:触发时自动推送飞书提醒 + 大师原话引用

调用reminder_set_reminder(condition={ticker:"NVDA", operator:"<=", threshold:950, action:"review"})

AI 返回: 提醒已建立:NVDA <= 950 USD 时触发"复盘评估"。 触发后将自动拉取:当前价格、你对此票的历史决策卡片、相关大师语录。 提醒已同步通知通道(如已配置)。

将 InvestBrain 接入 Claude Desktop(macOS / Windows 通用):

- macOS:~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:%APPDATA%\Claude\claude_desktop_config.json

{ "mcpServers": { "investbrain": { "command": "python", "args": [ "D:/claudework/invest-brain/src/mcp_server/server.py" ], "env": { "DEEPSEEK_API_KEY": "sk-your-key-here" } } } }

配置完成后重启 Claude Desktop,会在工具栏出现"投资助手"图标(39 个工具,与server.json注册的工具清单一致)。

本项目采用GNU Affero General Public License v3.0 (AGPLv3)授权。简言之:你可以自由使用、修改和分发,但通过网络提供服务的衍生作品也必须以相同协议开源。详见LICENSE。

src/mcp_server/ # MCP Server(39 个工具) ├── server.py # 主入口 ├── tools/ # 工具集 │ ├── thought_tools.py # 想法记录 │ ├── rag_tools.py # 投资 RAG │ ├── memory_tools.py # 记忆系统 │ ├── reminder_tools.py # 提醒系统 │ ├── pattern_tools.py # 行为模式 │ ├── report_tools.py # 周报/月报 │ ├── roundtable_tools.py # 大师圆桌 │ └── notifier_tools.py # 多通道通知 ├── datasources/ # 数据源 │ ├── akshare_datasource.py │ └── tushare_datasource.py ├── knowledge/ # 知识库 │ ├── vector_store.py # Chroma 向量存储 │ └── graph_client.py # 图存储 ├── memory/ # 记忆存储 ├── patterns/ # 行为模式挖掘 ├── llm/ # LLM 客户端 │ ├── llm_router.py # 通用 LLM 路由 │ ├── providers.py # Provider 配置 │ └── deepseek_client.py └── api_server.py # REST API (LLM 配置) data/ ├── graph/ # 知识图谱(16 位大师 + 概念) ├── knowledge/ │ └── vectors/ # 向量索引(Chroma) ├── memory/ # 用户记忆 ├── cards/ # 想法卡片 ├── reminders/ # 提醒条件 └── config/ # 配置文件
// 想法记录(3) "thought_record_thought(text)", "thought_search_memories(query)", "thought_get_thought_cards(ticker)", // 投资 RAG(4) "rag_ask_investment(question)", "rag_get_master_view(master, topic)", "rag_search_knowledge(query)", "rag_search_reports(query, top_k)", // 记忆系统(3) "memory_get_user_profile()", "memory_record_decision(data)", "memory_get_behavior_patterns()", // 提醒系统(3) "reminder_set_reminder(condition)", "reminder_get_reminders()", "reminder_delete_reminder(id)", // 行为模式(3) "pattern_run_pattern_detection()", "pattern_get_pattern_summary()", "pattern_get_pattern_report(id)", // 周报/月报(1) "report_run_scheduled_report(range)", // 大师圆桌(1) "invest_roundtable(question)", // 通知配置(2) "notify_configure_notifier(channel, webhook_url)", "notify_get_notifier_config()", // 行情数据 — AKShare(5) "market_get_stock_quote(ticker)", "market_get_stock_history(ticker, period)", "market_get_index_components(index_code)", "market_get_valuation(ticker)", "market_get_market_sentiment()", // 行情数据 — Tushare(15) "tushare_get_daily_price(ts_code)", "tushare_get_weekly_price(ts_code)", "tushare_get_realtime_quote(ts_code)", "tushare_get_index_daily(index_code)", "tushare_get_financial_indicator(ts_code)", "tushare_get_income_statement(ts_code)", "tushare_get_balance_sheet(ts_code)", "tushare_get_cash_flow(ts_code)", "tushare_get_index_components(index_code)", "tushare_get_industry_classification(ts_code)", "tushare_get_valuation_multi(ts_code)", "tushare_get_market_top_movers()", "tushare_get_stock_pledge_status(ts_code)", "tushare_convert_ticker(ticker)", "tushare_check_token_status()"

16 位投资大师: 巴菲特、芒格、段永平、霍华德·马克斯、李录、格雷厄姆、达莫达兰、阿克曼、凯西·伍德、迈克尔·伯里、帕伯莱、塔勒布、林奇、费雪、德鲁肯米勒

行业知识: 28 个申万行业深度研究框架(向量库内检索,不公开原文,保护核心方法论 IP)

# 启动 REST API Server(用于 LLM 配置) python src/mcp_server/api_server.py # 访问 http://localhost:8000/api/llm/config # 启动前端(Next.js 落地页 + 设置面板) npm install npm run dev # 访问 http://localhost:3000

以下工具推荐基于awesome-finai-tools-zn的SKILL.md场景→工具映射表生成,每类场景精选 1 个最佳工具。完整工具清单请访问仓库主页。

工具推荐逻辑基于 awesome-finai-tools-zn/data/institution-skills.json,每周自动更新。

- 🔴 用户自定义 RAG 知识库(让用户自己的框架可被 RAG 引用)
- 🔴 新闻/事件触发 reminder(央行购金、地缘冲突、美债冻结等)
- 🔴 投资框架管理工具(结构化记录用户的框架规则与触发条件)

- 🟡 黄金现货 / 美元指数 / 美债收益率实时数据
- 🟡 黄金 ETF(518880 / GLD)数据修复

- ✅ 黄金投资框架核心已写入思考卡(thought_8
- ✅ 基于真实数据的黄金推演已写入思考卡(thought_9
- ✅ 改造需求文档已建(docs/改造需求-roadmap.md

版本: v0.1.2创建时间: 2026-06-24许可: AGPL v3

Remote MCP server for historical crypto & prediction-market data: search ~500K instruments, live market stats (OHLC, turnover, spreads, depth, slippage) and tick-data purchase. Keyless for catalog & stats; optional OAuth for account tools. Endpoint: https://cryptostruct.com/mcp

Read-only MCP server for your Evibe investment portfolio + live market data (holdings, performance, dividends, benchmarks, screeners). Works with Claude & ChatGPT.

Live Polymarket prediction market data — whale trades, market odds, trader profiles, leaderboards, and AI-citable summaries.

Operate the AgentPump agent economy: read the live market and create, fund, tune, and run autonomous on-chain trading agents.

Alpaca’s official MCP Server lets you trade stocks, ETFs, crypto, and options, run data analysis, and build strategies in plain English directly from your favorite LLM tools and IDEs

Independent statistical validation for trading signals and backtests: deflated Sharpe, out-of-sample and leakage forensics, signed replayable verdicts; a methodology audit, not investment advice.

CLI + MCP server for SEC 13F institutional holdings, insider trading, and smart money convergence signals. Free anonymous tier, no signup required.

Hosted MCP server for Chinese A-share and ETF market data, including prices, fundamentals, capital flows, financial statements, real-time quotes, and news.

可转债高级策略 MCP Server — 双低/三低/YTM/强赎/下修6大策略引擎

Portfolio & trading-strategy stress diagnostics for AI agents: multi-asset stress with hedge-break detection, a daily preregistered regime outlook and deflated-Sharpe backtest-integrity checks. Remote streamable HTTP, free tier, no auth.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.