시냅스 MCP 서버
Synapse 엔티티(데이터 세트, 프로젝트, 폴더, 파일, 테이블)와 해당 주석을 노출하는 MCP(모델 컨텍스트 프로토콜) 서버입니다.
개요
이 서버는 모델 컨텍스트 프로토콜(MCP)을 통해 Synapse 엔터티와 해당 주석에 액세스하는 RESTful API를 제공합니다. 다음을 수행할 수 있습니다.
- Synapse로 인증
- ID로 엔터티 검색
- 엔티티 주석 가져오기
- 엔티티 자식 가져오기
- 다양한 기준에 따라 엔터티 쿼리
- Synapse 테이블 쿼리
설치
지엑스피1
PyPI에서 설치
# Install from PyPI
pip install synapse-mcp
용법
서버 시작
이렇게 하면 기본 포트(9000)에서 MCP 서버가 시작됩니다.
CLI 사용
# Start the server using the CLI
synapse-mcp --host 127.0.0.1 --port 9000 --debug
명령줄 옵션
usage: server.py [-h] [--host HOST] [--port PORT] [--debug]
Run the Synapse MCP server
options:
-h, --help show this help message and exit
--host HOST Host to bind to
--port PORT Port to listen on
--debug Enable debug logging
테스트 실행
# Run all tests with coverage
./run_tests.sh
# Or run pytest directly
python -m pytest
서버 테스트
python examples/client_example.py
API 엔드포인트
서버 정보
도구
GET /tools
- 사용 가능한 도구 나열POST /tools/authenticate
- Synapse로 인증POST /tools/get_entity
- ID로 엔티티 가져오기POST /tools/get_entity_annotations
- 엔티티에 대한 주석 가져오기POST /tools/get_entity_children
- 컨테이너 엔티티의 자식 엔티티 가져오기POST /tools/query_entities
- 다양한 기준에 따라 엔터티 쿼리POST /tools/query_table
- Synapse 테이블 쿼리
자원
GET /resources
- 사용 가능한 리소스 나열GET /resources/entity/{id}
- ID로 엔터티 가져오기GET /resources/entity/{id}/annotations
- 엔티티 주석 가져오기GET /resources/entity/{id}/children
- 엔터티 자식 가져오기GET /resources/query/entities/{entity_type}
- 유형별 엔터티 쿼리GET /resources/query/entities/parent/{parent_id}
- 부모 ID로 엔터티 쿼리GET /resources/query/entities/name/{name}
- 이름으로 엔터티 쿼리GET /resources/query/table/{id}/{query}
- SQL과 유사한 구문으로 테이블 쿼리
예시
입증
서버를 사용하려면 실제 Synapse 자격 증명으로 인증해야 합니다.
import requests
# Authenticate with Synapse
response = requests.post("http://127.0.0.1:9000/tools/authenticate", json={
"email": "your-synapse-email@example.com",
"password": "your-synapse-password"
})
result = response.json()
print(result)
# Alternatively, you can authenticate with an API key
response = requests.post("http://127.0.0.1:9000/tools/authenticate", json={
"api_key": "your-synapse-api-key"
})
엔티티 얻기
import requests
# Get an entity by ID
response = requests.get("http://127.0.0.1:9000/resources/entity/syn123456") # Replace with a real Synapse ID
entity = response.json()
print(entity)
엔터티 주석 가져오기
import requests
# Get annotations for an entity
response = requests.get("http://127.0.0.1:9000/resources/entity/syn123456/annotations") # Replace with a real Synapse ID
annotations = response.json()
print(annotations)
엔터티 쿼리
import requests
# Query for files in a project
response = requests.get("http://127.0.0.1:9000/resources/query/entities/parent/syn123456", params={ # Replace with a real Synapse ID
"entity_type": "file"
})
files = response.json()
print(files)
테이블 쿼리
import requests
# Query a table
table_id = "syn123456" # Replace with a real Synapse table ID
query = "SELECT * FROM syn123456 LIMIT 10" # Replace with a real Synapse table ID
response = requests.get(f"http://127.0.0.1:9000/resources/query/table/{table_id}/{query}")
table_data = response.json()
print(table_data)
Croissant 형식으로 데이터 세트 가져오기
import requests
import json
# Get public datasets in Croissant format
response = requests.get("http://127.0.0.1:9000/resources/croissant/datasets")
croissant_data = response.json()
# Save to file
with open("croissant_metadata.json", "w") as f:
json.dump(croissant_data, f, indent=2)
특허
MIT