ConceptBridge MCP
# ConceptBridge MCP
**Connect known concepts to unfamiliar research, then build an editable lineage note.** ConceptBridge is a local-first, pure-Python MCP server for Cursor, Antigravity, Claude Desktop, and other stdio MCP clients. It retrieves papers from the free OpenAlex API and optionally scans local Markdown knowledge bases. It can run without Obsidian, a Wiki, or Zotero; a compatible MCP client and internet access for OpenAlex are the only optional-system-independent requirements for the full online research workflow. Local notes, Obsidian wikilinks, and Zotero exports add context but are not required. ConceptBridge does not read Zotero databases or PDFs directly.
README 使用说明:ConceptBridge 可独立于 Obsidian、Wiki 和 Zotero 使用(需要支持 MCP 的 Agent 工作台;联网文献检索需要互联网)。本地 Wiki 和双向链接是可选增强;Zotero 目前没有直接集成,不读取其数据库或 PDF,可先将文献条目导出为 Markdown 后纳入 Wiki。
## Highlights | 核心亮点
- **Known-to-unknown concept bridging | 已知到未知的概念桥接:** optionally match known concepts against local Markdown notes and `[[wikilinks]]`, then retrieve citation-ranked OpenAlex works.
- **Math Diff | 数学公式对比:** organize historical motivation and LaTeX-level equation comparisons in a dedicated section.
- **Iterative learning | 多轮状态迭代:** the `research_lineage_workflow` MCP prompt instructs clients to ask diagnostic questions and reread the latest file before follow-up edits.
- **One file, two-way editing | 单文件双向编辑:** YAML frontmatter, Obsidian links, Mermaid mind map, comparison table and math discussion live together. Section markers let updates preserve text outside the selected managed region.
- **Optional local setup | 本地知识库可选:** no `WIKI_ROOT_DIR` is required; missing or invalid Wiki paths simply disable local search. No Obsidian or Zotero install is required.
- **Resilient literature lookup | 文献检索容错:** OpenAlex failures trigger an arXiv search fallback. If both sources are unavailable, the one-call workflow still saves local context and records the retrieval failure instead of dropping the note.
## How the integrations fit together | 各组件的关系
- **Agent workbench / MCP client** (Cursor, Antigravity, Claude Desktop, etc.) is the user-facing host. It sends requests to this MCP server and presents the tools/prompts to the model. ConceptBridge is not itself an agent or a chat UI.
- **ConceptBridge** performs local Markdown search, OpenAlex requests, and note creation/update. It can be used on its own with the MCP client and OpenAlex; local knowledge integration is optional.
- **Wiki / LLM Wiki** is an optional folder of Markdown notes used as existing knowledge context. ConceptBridge searches files and links; it does not require a particular Wiki product or indexer.
- **Obsidian** is an optional editor for that Markdown folder. `[[wikilinks]]` and YAML frontmatter make saved notes convenient to browse in Obsidian, but ordinary Markdown editors also work.
- **Zotero** remains separate. There is currently no direct Zotero API/database/PDF integration. Export or sync Zotero item notes to Markdown in the Wiki if you want them included in local matching.
In short: **Agent workbench → MCP protocol → ConceptBridge** is the required relationship. **Wiki/Obsidian/Zotero are optional sources and destinations**, not runtime dependencies. Without a Wiki, notes are saved to the default user data folder; OpenAlex still requires network access.
## Quick start | 快速开始
Requires Python 3.10+. By default, `OUTPUT_DIR` uses a persistent user data directory (Windows: `%LOCALAPPDATA%\ConceptBridge\workspace`; macOS: `~/Library/Application Support/ConceptBridge/workspace`; Linux: `$XDG_DATA_HOME/conceptbridge/workspace` or `~/.local/share/conceptbridge/workspace`). This avoids writing into the `uvx` package cache. Set `OUTPUT_DIR` to choose another location. Set `WIKI_ROOT_DIR` only if you want local-note matching; the legacy `LOCAL_WIKI_DIR` is also accepted. Configuration is loaded from the project-root `.env` even when an MCP client launches the server from a different working directory. Missing paths are reported in the research context together with the Markdown file count and attempted keyword variants. For local development, copy `.env.example` to `.env` and set optional variables there.
### Run with `uvx` | 使用 uvx
Launch it from PyPI without cloning the repository:
```powershell
uvx --from concept-bridge-mcp concept-bridge-mcp
```
MCP clients start the same entry point using `uvx` as the command. Configure environment variables in the client as shown below.
### Run from a local clone | 本地运行
```powershell
uv sync --extra test
uv run concept-bridge-mcp
```
Or install with pip and run `python -m pip install -e .` followed by `concept-bridge-mcp`.
### MCP client JSON | 客户端配置
Use the matching stdio configuration in Cursor, Antigravity, or Claude Desktop. `WIKI_ROOT_DIR` and `OUTPUT_DIR` are optional; remove either setting to use its default behavior. Replace placeholders with local paths and use JSON-escaped backslashes on Windows.
Published package (`uvx`; available after the first PyPI release):
```json
{
"mcpServers": {
"concept-bridge": {
"command": "uvx",
"args": ["--from", "concept-bridge-mcp", "concept-bridge-mcp"],
"env": {
"WIKI_ROOT_DIR": "<optional-path-to-Obsidian-or-LLM-Wiki>",
"OUTPUT_DIR": "<optional-path-for-generated-notes>"
}
}
}
}
```
Local clone with `uv` (no PyPI release required):
```json
{
"mcpServers": {
"concept-bridge": {
"command": "uv",
"args": ["run", "--directory", "<path-to-cloned-project>", "concept-bridge-mcp"],
"env": {
"WIKI_ROOT_DIR": "<optional-path-to-Obsidian-or-LLM-Wiki>",
"OUTPUT_DIR": "<optional-path-for-generated-notes>"
}
}
}
}
```
Local Python alternative, after installing the project dependencies with `python -m pip install .`:
```json
{
"mcpServers": {
"concept-bridge": {
"command": "<path-to-python-executable>",
"args": ["<path-to-cloned-project>/mcp_server.py"],
"env": {
"WIKI_ROOT_DIR": "<optional-path-to-Obsidian-or-LLM-Wiki>",
"OUTPUT_DIR": "<optional-path-for-generated-notes>"
}
}
}
}
```
For all examples, omit the `env` object or individual variables when not needed. An unset `OUTPUT_DIR` writes to the persistent user data location described above. For VS Code's MCP support, the equivalent entry belongs under `servers` with `type: "stdio"`.
### Available tools and prompt | 工具与工作流提示
- `research_and_save_lineage_doc(unknown_concept, known_concepts, filename)` — one call retrieves local notes and literature (OpenAlex, falling back to arXiv), then persists an evidence-based note and returns its path; it also saves local context when both APIs fail.
- `gather_research_context(unknown_concept, known_concepts)` — local notes if available, plus OpenAlex/arXiv results and an explicit next-action request to save a lineage document before replying.
- `create_lineage_doc(filename, mindmap_mermaid, comparison_table_md, math_diff_md, known_anchors?, seminal_papers?)` — create a standalone named Markdown note.
- `patch_lineage_section(filename, section, new_content)` — patch only `MINDMAP`, `TABLE`, or `MATH_DIFF`.
- `read_current_doc(filename)` — read the latest disk version before follow-up edits.
- `research_lineage_workflow(unknown_concept, known_concepts)` — a reusable MCP prompt that guides the evidence-first, multi-turn workflow.
Document frontmatter includes `title`, `created`, `tags`, `known_anchors`, and `seminal_papers`. Concept anchors are rendered as Obsidian `[[wikilinks]]`. Each section has outer `SECTION` markers and inner `MANAGED` markers containing a SHA-256 checksum. Put human annotations inside the section but outside `MANAGED`; patches preserve those annotations. If generated content inside a managed block was edited, the update refuses to overwrite it and asks for conflict resolution. The first patch of a legacy section without managed markers preserves all old content and appends a new generated block.
## Worked example: from GRPO to agentic credit assignment | 使用示例
Try this prompt in your MCP client (some clients prefix the tool name with the configured server name):
```text
请调用 `conceptbridge-gather_research_context` 工具。
参数:
- unknown_concept: "GiGPO, SPIRAL, SWEET-RL, C3"
- known_concepts: ["GRPO, Credit Assignment"]
请检索并整理:
1. 本地知识库中与 Monte Carlo planning 相关的笔记。
2. GiGPO 与 GRPO 的知识联系, Credit Assignment 和 C3。
3. 从 GRPO, Credit Assignment 学习 GiGPO, SPIRAL, SWEET-RL, C3 需要补充的核心概念。
请区分名称相近的两种 C3/C^3 方法。生成带因果/演进连线及不同锚点样式的 Mermaid `flowchart TD`,并保留每篇论文的标题、作者、年份和 DOI。请将笔记保存为 `GiGPO-SPIRAL-SWEET-RL-C3-lineage.md` 后再回复。
```
The following diagram is an evidence-informed example of the kind of learning path the prompt requests. Its links describe conceptual relationships for orientation; they are not claims that each paper directly cites or derives from another. Local-note matches depend on the user's configured Wiki.
```mermaid
flowchart TD
accTitle: GRPO to Agentic Credit Assignment
accDescr: A learning path from GRPO and credit assignment foundations to four multi-turn and multi-agent methods, with a separate node for each distinct C3 method.
prereq["Prerequisites: returns, policy gradients, MDPs"]
mc["Local anchor: Monte Carlo planning"]
grpo["GRPO: group-relative outcome advantages<br/>DeepSeekMath [1]"]
credit["Credit assignment:<br/>which decision caused the return?"]
gigpo["GiGPO: episode groups +<br/>anchor-state groups [2]"]
spiral["SPIRAL: multi-turn zero-sum<br/>self-play [3]"]
sweet["SWEET-RL: critic with<br/>training-time information [4]"]
c3_conf["C^3: confidence-guided<br/>credit correction [5]"]
c3_cf["C3: counterfactual continuation<br/>for shared-trace agent teams [6]"]
new_concepts["New concepts to learn:<br/>state matching, critics, Markov games,<br/>confidence calibration, counterfactuals"]
prereq --"grounds return estimation and advantage comparisons"--> grpo
mc -.->|local planning notes may add background| prereq
grpo --"trajectory-level outcomes leave within-episode decisions under-credited"--> credit
grpo --"repeated states enable finer action comparisons"--> gigpo
credit --"multi-agent roles change how outcomes are attributed"--> spiral
credit --"learned step values provide denser supervision"--> sweet
grpo --"undesirable spans can receive positive local credit"--> c3_conf
credit --"message value can be estimated by changing it and continuing the trace"--> c3_cf
gigpo --"requires state equivalence and anchor matching"--> new_concepts
spiral --"requires game theory, roles, and opponent adaptation"--> new_concepts
sweet --"requires critic learning and train/deployment information boundaries"--> new_concepts
c3_conf --"requires process-span labels and confidence calibration"--> new_concepts
c3_cf --"requires interventions and Monte Carlo variance reasoning"--> new_concepts
classDef known fill:#dbeafe,stroke:#2563eb,color:#1e3a5f,stroke-width:2px
classDef bridge fill:#dcfce7,stroke:#16a34a,color:#14532d,stroke-width:2px
classDef new_method fill:#ffedd5,stroke:#ea580c,color:#7c2d12,stroke-width:2px
classDef next fill:#f3e8ff,stroke:#9333ea,color:#581c87,stroke-width:2px
class prereq,mc,grpo,credit known
class gigpo,spiral,sweet bridge
class c3_conf,c3_cf new_method
class new_concepts next
```
### References shown in the example | 示例文献
The author lists below follow the arXiv records; each DOI is the arXiv/DataCite DOI shown by that record. The two C3 names refer to different papers and methods.
| # | Paper title | Authors | Year | DOI |
|---|---|---|---:|---|
| 1 | [DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models](https://arxiv.org/abs/2402.03300) | Zhihong Shao, Peiyi Wang, Qihao Zhu, Runxin Xu, Junxiao Song, Xiao Bi, Haowei Zhang, Mingchuan Zhang, Y.K. Li, Y. Wu, Daya Guo | 2024 | [10.48550/arXiv.2402.03300](https://doi.org/10.48550/arXiv.2402.03300) |
| 2 | [Group-in-Group Policy Optimization for LLM Agent Training](https://arxiv.org/abs/2505.10978) | Lang Feng, Zhenghai Xue, Tingcong Liu, Bo An | 2025 | [10.48550/arXiv.2505.10978](https://doi.org/10.48550/arXiv.2505.10978) |
| 3 | [SPIRAL: Self-Play on Zero-Sum Games Incentivizes Reasoning via Multi-Agent Multi-Turn Reinforcement Learning](https://arxiv.org/abs/2506.24119) | Bo Liu, Leon Guertler, Simon Yu, Zichen Liu, Penghui Qi, Daniel Balcells, Mickel Liu, Cheston Tan, Weiyan Shi, Min Lin, Wee Sun Lee, Natasha Jaques | 2025 preprint; ICLR 2026 | [10.48550/arXiv.2506.24119](https://doi.org/10.48550/arXiv.2506.24119) |
| 4 | [SWEET-RL: Training Multi-Turn LLM Agents on Collaborative Reasoning Tasks](https://arxiv.org/abs/2503.15478) | Yifei Zhou, Song Jiang, Yuandong Tian, Jason Weston, Sergey Levine, Sainbayar Sukhbaatar, Xian Li | 2025 | [10.48550/arXiv.2503.15478](https://doi.org/10.48550/arXiv.2503.15478) |
| 5 | [C3: Rethinking Process Supervision via Confidence-Guided Credit Correction in Multi-Turn Reinforcement Learning](https://arxiv.org/abs/2610.19695) | Ai Jian, Haoran Pan, Eryu Guo, Haojin Yang, Jinghan He, Xiaoyun Zhang, Jiangbo Pei, Peiyu Liu | 2026 | [10.48550/arXiv.2610.19695](https://doi.org/10.48550/arXiv.2610.19695) |
| 6 | [The Trace Is the State: Exact Credit Assignment for LLM Agent Teams](https://arxiv.org/abs/2603.06859) | Yanjun Chen, Yirong Sun, Hanlin Wang, Jinghan Wang, Xinming Zhang, Xiaoyu Shen, Wenjie Li, Wei Zhang | 2026 | [10.48550/arXiv.2603.06859](https://doi.org/10.48550/arXiv.2603.06859) |
## Zotero + Obsidian + LLM Wiki | 生态联动
ConceptBridge can act as an incremental knowledge-hub compiler in an existing local research workflow, but does not depend on that ecosystem. Zotero remains your reference manager; export or sync bibliographic records and notes into Markdown files under the Wiki root if you want those records included in local matching. ConceptBridge does not ingest Zotero's database, attachments, or PDFs itself.
```mermaid
flowchart LR
Z[Zotero library] -->|Export or sync notes| W[Obsidian / LLM Wiki<br/>Markdown + wikilinks]
W -->|Optional local concept cards| C[ConceptBridge MCP]
O[OpenAlex<br/>citation-ranked records] --> C
C -->|Named lineage note<br/>Frontmatter + Mermaid + table + Math Diff| W
W <-->|Read latest / patch one section| L[LLM client<br/>Cursor / Antigravity / Claude]
L -->|Research workflow prompt| C
```
## Development and tests | 开发与测试
```powershell
uv sync --extra test
uv run pytest -q
```
The unit suite verifies graceful no-Wiki startup, local note matching when configured, preservation of manual annotations during repeated section-level edits, and note persistence when OpenAlex/arXiv are unavailable. The live OpenAlex integration test is network-dependent and may be skipped when the service is unreachable or rate-limits the request.
## Packaging and publishing | 打包发布
Project metadata follows PEP 621 in `pyproject.toml`; the console command is `concept-bridge-mcp`. Build and publish with uv after configuring trusted publishing or PyPI credentials:
```powershell
uv build
uv publish
```
Before the first public release, confirm the package name is available on PyPI and add repository-specific details such as the GitHub URL, maintainers, and contribution policy.
TDQS
Scored across 5 tools
research_and_save_lineage_doc functionally duplicates the gather_research_context + create_lineage_doc pair in a single call, yet the descriptions conflict over which is the first step (MANDATORY STEP 1/2 vs RECOMMENDED FIRST-TURN TOOL). This leaves the agent unsure whether to follow the two-step flow or the one-shot tool, and create vs patch boundaries are only distinguishable via the 'generated portion' detail.
All names use snake_case with a recognizable verb_noun structure (gather_research_context, create_lineage_doc, patch_lineage_section, read_current_doc). The only slight deviation is the compound verb in research_and_save_lineage_doc, but overall the pattern is predictable.
Five tools is well-scoped for a focused research/lineage-doc workflow, with each tool mapping to a distinct operation. If anything it is on the lean side, but nothing feels gratuitous.
The surface covers the core lifecycle: search context, create a note, patch generated sections, and read the current on-disk doc with manual edits preserved. Minor gaps exist (no delete/rename or list-documents operation), but the main workflow is fully supported.