HerbAgent MCP Server
Provides literature-search and co-occurrence evidence tools that query PubMed to support hypothesis verification and PMID citation binding.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
English | 简体中文
An open-source Multi-Agent AI Co-Scientist for multi-target polypharmacology & drug mechanism-of-action discovery.
Given any multi-herb formulation, medicinal herb, or bioactive compound, HerbAgent runs a Generate–Debate–Evolve multi-agent engine with Dempster–Shafer belief fusion, Bradley–Terry / RRF + Submodular MMR ranking, Personalized PageRank synergy scoring, and deterministic citation auditing to synthesize verifiable 4-hop causal pathways (Drug → Active Compound → Human Target → Disease).
Quick Start · Innovations · Live Studio · Architecture · MCP Server · Benchmarks · Roadmap
✨ Why HerbAgent?
Complex multi-component therapeutics (botanical drugs, polyherbal formulas, natural product libraries) operate through multi-compound → multi-target → multi-pathway synergy that breaks single-target drug discovery pipelines — and causes standalone LLMs to hallucinate unverified molecular pathways (only 4.1% KG verifiability for Pure LLM).
HerbAgent solves this with a specialized 7-Agent Generate–Debate–Evolve architecture inspired by AI Co-Scientist workflows, backed by 17 domain tools and an in-memory 94,951-edge knowledge graph (zero external DB setup required):
Capability | What HerbAgent Delivers |
7-Agent Generate–Debate–Evolve |
|
17 Scientific Tools | 9 KG tools (multi-hop beam search, entity linking, verification), 6 Bioinformatics tools (KEGG/GO enrichment in Python/R, STRING v12 PPI, UniProt, ADMET drug-likeness, PubChem SEA fingerprints, AlphaFold DB), 2 Literature tools (Europe PMC co-occurrence, PubMed). |
Zero-Shot Generalization | Handles drugs absent from the KG via formula decomposition with Jun-Chen-Zuo-Shi weighting, constituent inference, and PubChem CACTVS Tanimoto ≥ 0.85 structural similarity target transfer (SEA). |
Native MCP Server | Run |
Provider-Agnostic LLM Layer | Works out-of-the-box with DeepSeek, OpenAI, Qwen, OpenRouter, vLLM, and Ollama, featuring Adaptive Reasoning-Effort Routing ( |
Interactive Web Studio | Minimalist real-time workspace with live collaboration trace, live hypothesis pool, Sankey pathway flows, animated architecture replay, comparative benchmarks, and interactive KG exploration. |
Related MCP server: BioMCP
🧠 Algorithmic & Engineering Innovations
Unlike prompt-chaining wrappers, HerbAgent implements formal probabilistic, graph-theoretic, and systems-engineering foundations (herbagent/algorithms/ & herbagent/engine/):
Module | Algorithm / Architecture | What Problem It Solves |
| Reverse Disease-Centric Drug Repurposing | Screens all 504 botanical drugs & 14,315 compounds against any target disease via hypergeometric target enrichment (BH FDR) & multi-compound convergence — sub-second, zero API key required. |
| Network Separation Synergy ($s_{AB}$) | Implements the Menche–Cheng network proximity metric $s_{AB} = \langle d_{AB} \rangle - (\langle d_{AA}\rangle + \langle d_{BB}\rangle)/2$ on the human PPI graph to classify complementary synergy vs. overlapping potentiation. |
| Dempster–Shafer Multi-Modal Belief Fusion | Maps KG tiers, PubMed co-occurrence, KEGG enrichment, STRING PPI, and peer review into |
| Bradley–Terry MLE + RRF + Submodular MMR | Solves latent tournament ratings via Minorization–Maximization, fuses heterogeneous scales via Reciprocal Rank Fusion, and selects Top-$K$ pathways maximizing $\lambda \cdot \text{Rel}(h) - (1-\lambda)\max_{s\in S}\text{Sim}(h,s)$ to prevent hub-compound collapse. |
| Personalized PageRank (PPR) & Multi-Component Synergy Index (MCSI) | Models tripartite |
| Deterministic Claim Auditor & Inline Citation Binder | Programmatically verifies every generated pathway explanation against verified entities & PMIDs, flags hallucinated citations, and binds structured |
| Observable Stage Runner, Circuit Breaker & Prometheus | Per-stage fault isolation and latency telemetry ( |
🖥️ Web Studio Showcase
🏗️ Architecture
Planner parses natural-language queries, performs multi-lingual entity linking (CN/EN/Latin/Pinyin/Gene Symbols/Aliases), recalls domain exemplars, and routes reasoning effort (
fast/standard/slow).Similarity activates for unseen drugs, inferring formula compositions or active constituents and transferring targets via PubChem CACTVS fingerprint similarity (SEA, Tanimoto ≥ 0.85), plus deduplicating redundant hypotheses (
Tanimoto ≥ 0.90).Generation runs deterministic KG Beam Search with backtracking pruning, scoring thousands of candidate 4-hop chains with a 13-feature logistic-regression ranker calibrated on 322,856 training candidates + LLM pharmacological priors.
Reflection ↔ Evolution Loop verifies Top-14 hypotheses against KEGG/GO enrichment, STRING v12 PPI networks, and Europe PMC/PubMed co-occurrence, critiques each path (
keep/revise/reject), and performs targeted weak-hop mutation with elitist selection.Ranking & Meta-Review fuse multi-source evidence with single-call listwise tournament reranking and synthesize a faithful Top-8 report with PMID citations, confidence calibration, and explicit limitations.
See docs/architecture.md for algorithmic details.
🚀 Quick Start
Option 1: Local Python Install (30 seconds)
git clone https://github.com/hwfengcs/HerbAgent.git
cd HerbAgent
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
# Configure your LLM API key (DeepSeek / OpenAI / Qwen / OpenRouter / Ollama)
cp .env.example .env
# Launch Web Studio at http://127.0.0.1:8000
herbagent serve
# Or launch in Offline Mode (no API key needed to explore KG, benchmarks & 8 real-run demos!)
herbagent serve --offlineOption 2: Docker Compose
cp .env.example .env
docker compose up --build
# Open http://127.0.0.1:8000 (API docs at /docs)Option 3: Python SDK & CLI
from herbagent import MultiAgentSystem
mas = MultiAgentSystem()
result = mas.run("What is the mechanism of action of Huoxiang Zhengqi Pills?")
for p in result["answer"]["paths"]:
print(f"[{p['rank']}] {p['drug']} → {p['ingredient']['name']} → {p['target']['symbol']} → {p['disease']['name']}")
print(" ", p["explanation"])# Zero-API-Key instant discovery CLI commands (sub-second, local KG)
herbagent repurpose "糖尿病" --top-k 10
herbagent synergy "人参" "丹参"
# Full multi-agent LLM mechanism analysis
herbagent analyze "丹参发挥药效的物质基础和作用靶点是什么?" --thinking auto
# Inspect KG & model info
herbagent info
# Run full offline test suite (31 unit, algorithm, discovery, API & MCP tests)
pytest -v🔌 Native MCP Integration
Plug HerbAgent's 17 pharmacology tools & multi-agent MoA discovery engine directly into Claude Desktop, Cursor, or OpenCode via the Model Context Protocol (MCP):
{
"mcpServers": {
"herbagent": {
"command": "herbagent",
"args": ["mcp"],
"env": {
"LLM_API_KEY": "sk-your-api-key",
"LLM_BASE_URL": "https://api.deepseek.com",
"LLM_MODEL": "deepseek-chat"
}
}
}
}Exposes 20 MCP tools (search_entity, find_mechanism_paths, verify_path, enrichment_analysis, ppi_network, similar_compounds, protein_structure, literature_cooccurrence, pubmed_search, analyze_mechanism, repurpose_for_disease, analyze_pair_synergy, etc.) and 2 MCP resources (herbagent://kg/stats, herbagent://architecture). See docs/tools_and_mcp.md.
📊 Benchmarks
Evaluated on our standardized, drug-disjoint 4-hop polypharmacology benchmark (500 sampled reference pathways across 220 drugs: 179 seen herbs, 39 masked unseen herbs, 2 multi-herb formulas). All systems output Top-8 pathways per drug using the identical LLM backbone and 17-tool registry:
System | Ref-Precision@8 | Path-Hit@8 | MRR@8 | Compound Hit@8 | Target Hit@8 | Disease Hit@8 | KG Verifiability | Avg Latency | Cost / Drug |
HerbAgent (MAS) | 71.56% | 4.80% | 0.0172 | 46.80% | 36.20% | 32.80% | 89.09% | 52.2s | $0.0137 |
ReAct (Single Agent) | 49.39% | 1.20% | 0.0037 | 36.20% | 21.60% | 18.80% | 85.91% | 25.4s | $0.0086 |
KG-Heuristic (No LLM) | 57.33% | 2.60% | 0.0057 | 32.20% | 18.40% | 20.00% | 82.27% | 0.1s | $0.0000 |
Pure LLM (No Tools) | 2.78% | 0.00% | 0.0000 | 18.00% | 11.00% | 6.80% | 4.09% | 25.4s | $0.0055 |
Key Ablation Findings (61-Drug Stratified Subset)
Full HerbAgent:
71.40%Ref-Precision@8w/o Reflection & Evolution:
54.10%(−17.3 pp) — multi-round critique & targeted mutation is the largest performance driverw/o Literature Verification:
56.97%(−14.4 pp) — Europe PMC/PubMed co-occurrence grounding dramatically reduces false positivesAll-Fast Mode:
71.72%in16.6s(3.1× faster with a modest dip in KG verifiability on unseen drugs)
Scientific Transparency: Reference pools are weakly supervised via KG topology and literature co-occurrence and are not clinical efficacy ground truth. In blind LLM-as-a-Judge evaluation (60 drugs), ReAct scored higher on narrative fluency (
4.30/5vs3.94/5) while HerbAgent led Ref-Precision@8 by +22.17 pp. Full tables, scenario splits, and error analysis are documented in docs/benchmarks.md.
📁 Project Structure
HerbAgent/
├── herbagent/ # Core Python package
│ ├── algorithms/ # DST belief fusion, Bradley-Terry/RRF/MMR, PPR synergy & citation auditor
│ ├── engine/ # Observable DAG telemetry, circuit breaker, Prometheus metrics & Pydantic v2
│ ├── agents/ # 7 specialized agents, Blackboard state, prompts & scoring
│ ├── kg/ # In-memory polypharmacology KG, masked views & entity linker
│ ├── tools/ # 17 KG, Bioinformatics & Literature tools + SQLite HTTP cache
│ ├── baselines/ # ReAct single-agent, Pure LLM, and KG-Heuristic baselines
│ ├── server/ # FastAPI SSE streaming server & KG Explorer API
│ ├── mcp_server.py # Native Model Context Protocol (MCP) JSON-RPC 2.0 server
│ ├── orchestrator.py # Generate–Debate–Evolve Supervisor workflow
│ ├── llm.py # Multi-provider OpenAI-compatible client & reasoning router
│ └── cli.py # Unified CLI (serve / analyze / mcp / info)
├── frontend/ # Zero-build minimalist Web Studio (HTML/CSS/ES Modules + ECharts)
├── data/ # Pre-built KG Parquet tables, 500-pathway benchmark & 8 demos
├── experiments/results/ # Benchmark metrics, ablations & LLM-as-a-Judge summaries
├── scripts/ # Deterministic end-to-end KG build, ranker training & eval scripts
├── tests/ # Fully offline pytest suite (core, FastAPI & MCP)
└── docs/ # Architecture, tools/MCP, benchmarks & data pipeline guides🗺️ Roadmap
v0.2 — 7-agent Generate–Debate–Evolve engine, 17 KG/Bio/Lit tools, multi-provider LLM router, native MCP server, Docker & CI, interactive Web Studio
v0.3 — Dempster–Shafer multi-modal belief fusion, Bradley–Terry MLE + RRF + Submodular MMR selection, Personalized PageRank network synergy (
MCSI), deterministic claim auditor & inline citation binding, DAG stage telemetry & Prometheus/metricsv0.4 — Bi-directional Discovery Lab (zero-API-key reverse disease repurposing with BH FDR + Menche–Cheng $s_{AB}$ network combination synergy) across Web Studio, REST API, CLI & 20 MCP tools
v0.5 — Structure-based 3D validation plugin (AutoDock Vina / DiffDock / Boltz-2 binding affinity scoring directly on AlphaFold pockets) & directional modulation polarity (activation vs. inhibition)
v0.6 — Single-cell & transcriptomic perturbation grounding (LINCS L1000 / CMap) + trajectory-level RL optimization
📜 Citation & License
Released under the Apache 2.0 License. If HerbAgent accelerates your research, please consider giving us a ⭐ and citing:
@software{herbagent2026,
title = {HerbAgent: Multi-Agent AI Co-Scientist for Polypharmacology and Mechanism-of-Action Discovery},
author = {HerbAgent Contributors},
year = {2026},
url = {https://github.com/hwfengcs/HerbAgent}
}Disclaimer: HerbAgent is intended strictly for computational pharmacology research and hypothesis generation. Outputs do not constitute medical advice, clinical diagnosis, or prescribing guidance.
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
Pharmacogenomics for AI agents: cited drug–gene, gene and rsID lookups plus a medication screen.
Connect AI clients to biomedical data and tools.
Open Targets MCP — disease/target/drug knowledge graph.
214 tools for AI agents over one MCP endpoint: image, video, audio, 3D, data, storage, mail, GPUs.
Related MCP Servers
- AlicenseCqualityBmaintenanceExposes EPA Computational Toxicology (CompTox) evidence federation through MCP, enabling chemical identity, hazard, exposure, and bioactivity data retrieval for AI agents.856Apache 2.0
- AlicenseAqualityBmaintenanceA high-performance MCP server that gives LLMs access to 25 biomedical tools federated across 50+ upstream APIs for genes, variants, drugs, diseases, literature, clinical trials, and structural biology.43164 npm12Apache 2.0
- AlicenseAqualityAmaintenanceAn MCP server that gives AI assistants access to biological and biomedical RDF databases via SPARQL at the RDF Portal, as well as selected REST APIs (NCBI E-utilities, UniProt, ChEMBL, PDB, Reactome, Rhea, MeSH, and more).3323MIT
- FlicenseNot gradedqualityDmaintenanceProvides oncology data (research, news, FDA approvals, clinical trials) and IBM MAMMAL biomedical predictions (PPI, DTI, ClinTox) as MCP tools. Allows AI agents to query cancer datasets and run predictions through a remote MCP server.-