Token导航 LogoToken导航TokenDH.com
indra agent logo
数据服务stdio官方级别未说明来源级核验

indra agent

MCP Server

INDRA Agent是一个为AI代理提供访问超过2000万个生物医学知识图谱节点的服务,涵盖基因、疾病、药物、通路及其因果关系,通过9种可组合工具实现高效查询和分析。

工具数

9

提示词数

0

GitHub Stars

2

资源数

0
PythonClaude数据分析Claude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

gyorilab

提供方

gyorilab

最后核验

2026/5/17 20:20

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

pip install git+https://github.com/gyorilab/indra_agent.git

详细介绍

INDRA代理

MCP服务器用于INDRA CoGEx生物医学知识图。

让人工智能代理访问2000多万个节点,涵盖基因、疾病、药物、通路及其因果关系,这些节点由科学文献和精心策划的数据库组装而成 印度 (集成网络和动态推理汇编程序)。

将100多个独立功能工具替换为 9个可组合工具 在保持安全性和可用性的同时,充分展示了知识图谱的力量。

快速开始

公共服务器 --无需安装:

{
  "mcpServers": {
    "indra-cogex": {
      "url": "https://discovery.indra.bio/mcp"
    }
  }
}

本地安装 --对于开发或私有Neo4j实例:

pip install git+https://github.com/gyorilab/indra_agent.git

连接模式

Stdio(本地)HTTP(远程)
用例Claude桌面、游标、Claude代码已部署服务器、共享访问
配置键"command": "indra-agent""url": "https://..."
Neo4j凭据本地必需(环境变量)已配置服务器端
扩展单流程多工人(gunicorn)

标准模式(默认)

对于本地MCP客户:

# Via console script
indra-agent

# Or via module
python -m indra_agent.mcp_server

Claude桌面配置(~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "indra-cogex": {
      "command": "indra-agent",
      "env": {
        "INDRA_NEO4J_URL": "bolt://your-server:7687",
        "INDRA_NEO4J_USER": "neo4j",
        "INDRA_NEO4J_PASSWORD": "your-password",
        "MCP_ALLOWED_HOSTS": "localhost",
        "MCP_ALLOWED_ORIGINS": "http://localhost"
      }
    }
  }
}

HTTP模式

对于网络部署:

indra-agent --http
indra-agent --http --host 0.0.0.0 --port 8000
indra-agent --http --stateful --streaming

产量(gunicorn):

gunicorn indra_agent.mcp_server.server:app \
  --bind 0.0.0.0:8778 \
  --worker-class uvicorn.workers.UvicornWorker \
  -w 4

工具

9工具 分为两组:

网关工具(5个工具)

高级图形导航——大多数代理从这里开始:

工具目的
ground_entity自然语言到CURIE,具有语义过滤功能。支持单术语或批处理模式。
suggest_endpoints给定CURIE,建议可访问的实体类型和遍历函数
call_endpoint使用自动接地、缓存和外部参照回退执行100多个自动客户端功能中的任何一个
get_navigation_schema显示实体类型如何连接的完整边缘图。可选的 entity_type 过滤器。
batch_call在一次调用中为多个实体执行端点。路由到本地批处理查询(如果可用)。

查询基础架构(4个工具)

用于复杂查询的低级Cypher访问:

工具目的
get_graph_schema发现实体类型、关系、模式
execute_cypher使用参数化运行任意Cypher
validate_cypher飞行前安全验证
enrich_results在可配置的披露级别添加元数据

call_endpoint 参数

主查询工具支持多个优化参数:

参数类型说明
endpointstr函数名称(例如。, "get_diseases_for_gene")
kwargsstrJSON参数。实体作为CURIE元组 {"gene": ["HGNC", "6407"]} 或自然语言 {"gene": "LRRK2"}
auto_groundbool将接地字符串参数自动设置为CURIE(默认值:True)
disclosure_levelstr丰富结果: "standard" (约250个代币/项目), "detailed" (~400), "exploratory" (~750)
offsetint分页偏移量。使用 next_offset 从之前的响应继续。
limitint每页最大项目数。如果超过,自动截断为约20k个令牌。
fieldslist项目结果到特定密钥(例如。, ["db_ns", "db_id", "name"]).减少令牌使用。
estimatebool提取前探测查询成本。返回计数、令牌估计、可用字段、示例。
sort_bystr"evidence" (首先验证最多)或 "name" (按字母顺序)。在分页之前应用。
include_navigationbool将建议的后续遍历步骤附加到结果中。

batch_call 参数

参数类型说明
endpointstr函数名称(例如。, "get_diseases_for_gene")
entity_paramstr要批处理哪个参数(例如。, "gene")
entity_valueslist要查询的实体值(例如。, ["SIRT3", "PRKN", "MAPT"]).自动接地。
fields列表每个项目特定密钥的项目结果
max_concurrentint最大并行查询数(默认值:10)
merge_strategystr"keyed" (默认): {entity: results} 字典 "flat":连接列表。

对于 get_drugs_for_targetget_targets_for_drug,batch_call会自动路由到使用单个Neo4j的本机批处理函数 WHERE IN 查询,而不是N个单独的查询。

建筑

flowchart LR
    Agent["Agent"]

    subgraph Gateway["Gateway Tools"]
        direction TB
        Ground["ground_entity
NL to CURIE"]
        Suggest["suggest_endpoints
navigation hints"]
        Call["call_endpoint
100+ functions"]
        NavSchema["get_navigation_schema
edge map"]
        Batch["batch_call
parallel execution"]
    end

    subgraph Core["Query Infrastructure"]
        direction TB
        Schema["get_graph_schema
progressive discovery"]
        Execute["execute_cypher
arbitrary queries"]
        Validate["validate_cypher
safety checks"]
        Enrich["enrich_results
metadata layers"]
    end

    subgraph Cache["Cache Layer"]
        direction TB
        DiskCache["diskcache
LRU + TTL"]
        Coalesce["request coalescing
dedup in-flight"]
    end

    subgraph Data["Data Layer"]
        direction TB
        Neo[("Neo4j
20M nodes")]
        GILDA["GILDA API"]
    end

    Agent -->|"ground terms"| Ground
    Agent -->|"explore edges"| Suggest
    Agent -->|"call functions"| Call
    Agent -->|"batch queries"| Batch
    Agent -->|"discover schema"| Schema
    Agent -->|"run Cypher"| Execute

    Ground --> GILDA
    Suggest --> Call
    Call --> DiskCache
    Batch --> Call
    NavSchema --> Call

    DiskCache -->|"miss"| Neo
    DiskCache -->|"hit"| Call
    Coalesce --> DiskCache

    Schema --> Neo
    Execute --> Validate
    Validate --> Neo

    classDef agent fill:#2C3E50,stroke:#1A252F,stroke-width:3px,color:#ECF0F1,font-weight:bold
    classDef gateway fill:#9B59B6,stroke:#8E44AD,stroke-width:2px,color:#FFFFFF
    classDef core fill:#3498DB,stroke:#2980B9,stroke-width:2px,color:#FFFFFF
    classDef cache fill:#27AE60,stroke:#1E8449,stroke-width:2px,color:#FFFFFF
    classDef data fill:#7F8C8D,stroke:#5D6D7E,stroke-width:2px,color:#ECF0F1

    class Agent agent
    class Ground,Suggest,Call,NavSchema,Batch gateway
    class Schema,Execute,Validate,Enrich core
    class DiskCache,Coalesce cache
    class Neo,GILDA data

大多数代理使用网关工具——CURIE的基础自然语言,然后调用预构建的函数。当预定义函数无法表达查询时(图算法、多跳遍历、条件聚合),代理会下拉到查询基础架构。

情境感知接地

参数语义编码实体类型,消除跨类型歧义:

ground_entity(term="ALS", param_name="disease")
# → MESH:D000690 (Amyotrophic Lateral Sclerosis)

ground_entity(term="ALS", param_name="gene")
# → HGNC:396 (SOD1, formerly ALS1)

ground_entity(term="aspirin", param_name="drug")
# → CHEBI:15365

支持 param_name 过滤器: disease, gene, drug, pathway, tissue, cell_line, cell_type, side_effect.

批处理模式 在一次通话中使用多个术语:

ground_entity(terms=["SIRT3", "PRKN", "MAPT"], param_name="gene")
# → {mappings: {"SIRT3": {curie, name, score}, ...}, failed: [...]}

生物体背景 接受通用名称或分类ID:

ground_entity(term="LRRK2", organism="human")   # resolved to 9606
ground_entity(term="LRRK2", organism="9606")     # passthrough
ground_entity(term="Trp53", organism="mouse")    # resolved to 10090

交叉引用回退

当接地查询返回零结果时, call_endpoint 通过以下方式自动查找等效标识符 xref 图中的关系和重试。这处理了GILDA位于一个命名空间(例如MESH)但相关数据在另一个命名空间下(例如DOID)被索引的情况。

缓存

全部 call_endpoint 结果通过缓存 diskcache.FanoutCache:

  • 跨流程安全 --SQLite后端,与gunicon多工协同工作
  • LRU 淘汰机制 --可配置的最大大小(默认2GB)
  • 按键TTL --默认1小时,架构缓存24小时
  • 请求合并 --并发的相同请求共享一个Neo4j查询
  • 缓存存储原始结果;排序、字段投影和分页在缓存后应用

安全

  • 验证层 阻止所有写入/修改操作(DELETE、CREATE、MERGE、SET、REMOVE、DROP、DETACH)
  • 参数化查询 防止注射攻击
  • Neo4j execute_read() 在驱动程序级别强制执行只读语义

令牌感知分页

大型结果集会自动截断,并带有延续提示:

{
  "results": [...],
  "pagination": {
    "total": 1500,
    "returned": 127,
    "has_more": true,
    "next_offset": 127
  }
}

使用 estimate=True 在提取之前探测查询成本:

call_endpoint("get_drugs_for_target", '{"target": "EGFR"}', estimate=True)
# → {result_count: 78, token_estimate_full: 15200, fields_available: [...], sample: [...]}

然后用投影获取:

call_endpoint("get_drugs_for_target", '{"target": "EGFR"}', fields=["db_ns", "db_id", "name"], limit=50)

配置

Neo4j凭据

export INDRA_NEO4J_URL="bolt://localhost:7687"
export INDRA_NEO4J_USER="neo4j"
export INDRA_NEO4J_PASSWORD="your-password"

或在中配置 ~/.config/indra/config.ini (标准INDRA配置文件)。

运输安全(必填)

变量必填描述
MCP_ALLOWED_HOSTS逗号分隔的允许主机(例如。, localhost,discovery.indra.bio)
MCP_ALLOWED_ORIGINS逗号分隔的允许来源(例如。, http://localhost:3000,https://discovery.indra.bio)

缓存

变量默认值描述
INDRA_CACHE_DIR~/.cache/indra_cogex_mcp缓存目录路径
INDRA_CACHE_SIZE_MB2048最大缓存大小(MB)(LRU逐出超过此值)
INDRA_CACHE_TTL3600默认TTL(秒)
INDRA_CACHE_SHARDS4FanoutCache分片(更高=更好的并发性,更多的文件句柄)

HTTP模式

变量默认值描述
MCP_HOST0.0.0.0主机以HTTP模式绑定
MCP_PORT8000在HTTP模式下绑定的端口

发展

git clone https://github.com/gyorilab/indra_agent.git
cd indra_agent
pip install -e ".[dev]"

# Run tests
pytest tests/

# Run specific test file
pytest tests/mcp_server/test_gateway_tools.py -v

依赖项

  • indra_cogex --INDRA CoGEx知识图客户端
  • mcp>=1.2.0 --模型上下文协议SDK(传输安全需要1.2.0+)
  • gilda --生物医学实体接地
  • diskcache>=5.6 --具有LRU驱逐功能的持久缓存
  • pydantic>=2.0 --数据验证
  • click>=8.0 --CLI框架
  • starlette>=0.27.0 --ASGI框架
  • uvicorn>=0.20.0 --ASGI服务器(HTTP模式)
  • jinja2>=3.0.0 --模板引擎

许可证

BSD-2条款

目录标签

目录标签

PythonClaude数据分析生物医学本地部署知识图谱基因分析药物发现疾病研究

支持客户端

Claude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

9

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP