BioMCP 가이드
목차
BioMCP란 무엇인가?
BioMCP는 AI 어시스턴트와 에이전트에게 전문화된 생물의학 지식을 제공하는 오픈 소스(MIT 라이선스) 툴킷입니다.
핵심 개념
BioMCP는 Anthropic의 Model Context Protocol(MCP)을 따르는 서버로 AI가 다음과 같은 전문 데이터베이스에 접근할 수 있도록 합니다.
- 임상시험 데이터 (ClinicalTrials.gov)
- 과학 문헌 (PubMed, bioRxiv)
- 유전체 변이 (MyVariant.info)
- 유전자 정보 (MyGene.info)
- 암 게놈 데이터 (TCGA, cBioPortal)
- 약물 안전성 데이터 (OpenFDA)
- 정밀 종양학 지식 (OncoKB)
라이선스 및 개발사
- 라이선스: MIT (완전 오픈소스)
- 개발: GenomOncology
- GitHub: genomoncology/biomcp
BioMCP의 핵심 기능
1. 통합 데이터 소스 (10개 이상)
문헌 자료
- PubTator3/PubMed: 3천만 개 이상의 동료심사 논문
- bioRxiv/medRxiv: 생물학 및 의학 프리프린트
- Europe PMC: 오픈 사이언스 플랫폼
임상 및 게놈 소스
- ClinicalTrials.gov: 전 세계 임상시험 데이터
- NCI Clinical Trials: 암 임상시험 검색
- MyVariant.info: 유전자 변이 주석
- MyGene.info: 유전자 정보
- MyDisease.info: 질병 온톨로지
- MyChem.info: 약물/화학물질 정보
- TCGA/GDC: 암 게놈 아틀라스
- cBioPortal: 암 유전체 포털
- OncoKB: 정밀 종양학 지식베이스
규제 및 안전 소스
- OpenFDA: FDA 규제 및 안전 데이터
- 약물 이상반응(FAERS)
- 의약품 라벨(SPL)
- 의료기기 이상사례(MAUDE)
2. 24개의 전문 도구
BioMCP는 총 24개의 MCP 도구를 제공합니다.
핵심 도구 (3개)
- Think: 복잡한 생의학 문제를 체계적으로 분해
- Search: 통합 쿼리 언어로 크로스도메인 검색
- Fetch: 개별 항목의 상세 정보 가져오기
개별 도구 (21개)
- 논문 도구 (2개): article_searcher, article_getter
- 임상시험 도구 (6개): trial_searcher, trial_getter, trial_protocol_getter 등
- 변이 도구 (2개): variant_searcher, variant_getter
- NCI 도구 (6개): organization_searcher/getter, intervention_searcher/getter 등
- 생물정보 도구 (3개): gene_getter, disease_getter, drug_getter
설치 및 환경 설정
STEP 1: BioMCP Python 패키지 설치
1
2
3
4
5
# pip 사용
pip install biomcp-python
# uv 사용 (권장)
uv add biomcp-python
STEP 2: 설치 확인
1
2
3
4
5
# 명령어가 정상 동작하는지 확인
biomcp --help
# 버전 확인
biomcp --version
출력 예시:
1
2
3
4
5
6
7
8
Usage: biomcp [OPTIONS] COMMAND [ARGS]...
Commands:
article Article-related commands
trial Trial-related commands
variant Variant-related commands
run Run BioMCP server
...
STEP 3: 환경 변수 설정 (선택사항)
일부 기능은 API 키가 필요합니다. .env 파일을 생성하거나 시스템 환경 변수를 설정합니다.
주요 환경 변수:
CBIO_TOKEN: cBioPortal API 토큰 (선택사항, 속도 제한 완화)ONCOKB_TOKEN: OncoKB API 토큰 (없으면 데모 서버 자동 사용)BIOMCP_USE_CONNECTION_POOL: HTTP 연결 풀 사용 (성능 향상)BIOMCP_METRICS_ENABLED: 메트릭 수집 활성화
BioMCP 사용하기
방법 1: 명령줄 인터페이스 (CLI)
BioMCP는 강력한 CLI를 제공하여 코드 없이 바로 사용할 수 있습니다.
기본 구조
1
biomcp <domain> <action> [options]
<domain>: article, trial, variant, gene, disease, drug 등<action>: search, get 등[options]: 검색 조건, 필터 등
방법 2: Claude Desktop과 통합
Claude Desktop에서 BioMCP를 MCP 서버로 사용할 수 있습니다.
STEP 1: Claude Desktop 설정 열기
- Claude Desktop 실행
Developer→Edit Config클릭
STEP 2: 설정 파일 수정
macOS/Linux: ~/.config/claude/config.json
Windows: %APPDATA%\Claude\config.json
1
2
3
4
5
6
7
8
{
"mcpServers": {
"biomcp": {
"command": "uv",
"args": ["run", "--with", "biomcp-python", "biomcp", "run"]
}
}
}
STEP 3: Claude Desktop 재시작
재시작 후 Claude와 대화할 때 BioMCP 도구를 자동으로 사용할 수 있습니다.
사용 예시:
1
2
3
사용자: "BRAF 유전자와 멜라노마에 관련된 최신 논문을 찾아줘"
Claude: [BioMCP의 article_searcher 도구를 자동으로 사용하여 검색]
방법 3: Python 코드와 함께 사용
BioMCP 서버를 프로그래밍 방식으로 호출할 수 있습니다.
HTTP 서버 모드로 실행
1
2
3
4
5
# Streamable HTTP 모드 (권장)
biomcp run --mode streamable_http --host 127.0.0.1 --port 8080
# 레거시 SSE 모드
biomcp run --mode worker
Python에서 HTTP API 호출
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import aiohttp
import asyncio
import json
MCP_ENDPOINT = "http://127.0.0.1:8080/mcp"
async def send_mcp_request(method: str, params: dict = None):
"""Send MCP request and yield raw SSE chunks"""
payload = {
"jsonrpc": "2.0",
"id": 1,
"method": method,
"params": params or {}
}
headers = {
"Content-Type": "application/json",
"Accept": "application/json, text/event-stream"
}
print(f"\n[REQUEST] {method}")
print(json.dumps(payload, indent=2))
async with aiohttp.ClientSession() as session:
async with session.post(MCP_ENDPOINT, json=payload, headers=headers) as response:
print(f"\n[RESPONSE] Status: {response.status}")
print(f"Content-Type: {response.headers.get('Content-Type')}")
print("\n[STREAMING]")
async for chunk in response.content:
if chunk:
yield chunk
async def main():
print("Test 1: List Tools")
async for chunk in send_mcp_request("tools/list"):
print(chunk.decode('utf-8'), end='', flush=True)
print("Test 2: Article Searcher (Streaming)")
async for chunk in send_mcp_request(
"tools/call",
{"name": "article_searcher", "arguments": {"gene": "BRAF", "disease": "Melanoma"}}
):
print(chunk.decode('utf-8'), end='', flush=True)
if __name__ == "__main__":
asyncio.run(main())
방법 4: LLM 코드와 함께 사용
langchain_mcp_adapters를 이용해서 langchain, langgraph에서 사용할 수 있다.
StdioServer 방식
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from langchain_mcp_adapters.client import MultiServerMCPClient
from langchain.agents import create_agent
mcp_config = {
"biomcp": {
"command": "biomcp",
"args": ["run"],
"transport": "stdio",
"env": {
"BIOMCP_USE_CONNECTION_POOL": "true",
"BIOMCP_METRICS_ENABLED": "true",
},
}
}
client = MultiServerMCPClient(mcp_config)
tools = await client.get_tools()
agent = create_agent("openai:gpt-4.1", tools)
response = await agent.ainvoke({"messages": "BRAF 유전자와 멜라노마에 관련된 최신 논문을 찾아줘"})
Streamable HTTP 방식
1
2
3
4
5
6
7
8
9
10
11
12
13
from mcp import ClientSession
from mcp.client.streamable_http import streamablehttp_client
from langchain.agents import create_agent
from langchain_mcp_adapters.tools import load_mcp_tools
async with streamablehttp_client("http://localhost:8080/mcp") as (read, write, _):
async with ClientSession(read, write) as session:
await session.initialize()
tools = await load_mcp_tools(session)
agent = create_agent("openai:gpt-4.1", tools)
response = await agent.ainvoke({"messages": "BRAF 유전자와 멜라노마에 관련된 최신 논문을 찾아줘"})
Streamable HTTP 방식에서 Custom headers 사용하기
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from langchain_mcp_adapters.client import MultiServerMCPClient
from langchain.agents import create_agent
mcp_config = {
"biomcp": {
"transport": "streamable_http",
"url": "http://localhost:8080/mcp",
"headers": {
"Authorization": "Bearer YOUR_TOKEN",
"X-Custom-Header": "custom-value"
}
"env": {
"BIOMCP_USE_CONNECTION_POOL": "true",
"BIOMCP_METRICS_ENABLED": "true",
}
}
}
client = MultiServerMCPClient(mcp_config)
tools = await client.get_tools()
agent = create_agent("openai:gpt-4.1", tools)
response = await agent.ainvoke({"messages": "BRAF 유전자와 멜라노마에 관련된 최신 논문을 찾아줘"})
LangGraph StateGraph 전체 예시
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from langchain_mcp_adapters.client import MultiServerMCPClient
from langgraph.graph import StateGraph, MessagesState, START
from langgraph.prebuilt import ToolNode, tools_condition
from langchain.chat_models import init_chat_model
model = init_chat_model("openai:gpt-4.1")
mcp_config = {
"biomcp": {
"transport": "streamable_http",
"url": "http://localhost:8080/mcp",
"headers": {
"Authorization": "Bearer YOUR_TOKEN",
"X-Custom-Header": "custom-value"
}
"env": {
"BIOMCP_USE_CONNECTION_POOL": "true",
"BIOMCP_METRICS_ENABLED": "true",
}
}
}
client = MultiServerMCPClient(mcp_config)
tools = await client.get_tools()
def call_model(state: MessagesState):
response = model.bind_tools(tools).invoke(state["messages"])
return {"messages": response}
builder = StateGraph(MessagesState)
builder.add_node(call_model)
builder.add_node(ToolNode(tools))
builder.add_edge(START, "call_model")
builder.add_conditional_edges(
"call_model",
tools_condition,
)
builder.add_edge("tools", "call_model")
graph = builder.compile()
response = await agent.ainvoke({"messages": "BRAF 유전자와 멜라노마에 관련된 최신 논문을 찾아줘"})
BioMCP는 AI를 생물의학 연구에 활용하고자 하는 연구자와 개발자들에게 강력한 도구입니다.
10개 이상의 데이터 소스와 24개의 전문 도구를 통해 논문 검색부터 유전체 분석까지 폭넓은 작업을 수행할 수 있습니다.
CLI로 간단히 시작하거나, Claude Desktop과 통합하거나, Python/LangChain으로 커스터마이징하는 등 필요에 맞는 방식으로 활용할 수 있습니다.
MIT 라이선스의 오픈소스 프로젝트이므로 부담 없이 시도해보시기 바랍니다.