세네칼 MCP 서버
Senechal 프로젝트의 보조 서버 역할을 하는 MCP(Model Context Protocol) 서버로, Senechal API에서 LLM 애플리케이션으로 상태 데이터를 제공합니다.
개요
이 서버는 LLM이 Senechal API의 건강 데이터에 접근할 수 있도록 표준화된 인터페이스를 제공합니다. 다음과 같은 기능을 제공합니다.
리소스 : LLM 컨텍스트에 로드할 수 있는 건강 데이터
도구 : LLM이 건강 데이터를 가져오기 위해 호출할 수 있는 함수
프롬프트 : 건강 데이터 분석을 위한 재사용 가능한 템플릿
Related MCP server: OpenAPI MCP Server
설치
이 저장소를 복제하세요
가상 환경 만들기:
지엑스피1
종속성 설치:
pip install -r requirements.txt
구성
.env.example 파일을 .env 로 복사하고 Senechal API 키와 URL을 추가합니다.
# Required: Senechal API Key
SENECHAL_API_KEY=your_api_key_here
# Required: API base URL
SENECHAL_API_BASE_URL=https://your-api-host/api/senechal서버가 작동하려면 API 키와 API URL이 모두 필요합니다.
Windows 구성
Windows에서 실행하는 경우 다음 사항을 확인하세요.
구성에서 백슬래시나 적절하게 이스케이프된 경로를 사용하세요.
claude-desktop-config.json에서 Python 가상 환경의 전체 경로를 사용하세요.
{
"mcpServers": {
"senechal-health": {
"command": "C:\\path\\to\\venv\\Scripts\\python.exe",
"args": [
"C:\\path\\to\\senechal_mcp_server.py"
],
"env": {
"SENECHAL_API_KEY": "your_api_key_here"
}
}
}
}MCP 구성의 환경 변수는 .env 파일을 사용하지 않으므로 config에서 명시적으로 설정해야 합니다.
용법
클라이언트/서버 설정 테스트
설정을 테스트하는 가장 간단한 방법은 예제 클라이언트를 실행하는 것입니다.
# In one terminal, start the server
python senechal_mcp_server.py
# In another terminal, run the example client
python example_client.py서버 시작
python senechal_mcp_server.pyMCP Inspector를 사용한 개발 모드
mcp dev senechal_mcp_server.pyClaude Desktop에 설치
서버에는 Claude Desktop에 대한 구성 파일이 포함되어 있습니다.
mcp install senechal_mcp_server.py그런 다음 Claude Desktop의 도구 메뉴에서 "Senechal Health"를 선택할 수 있습니다.
사용 가능한 리소스
senechal://health/summary/{period}- 일, 주, 월 또는 연도별 건강 요약을 가져옵니다.예:
senechal://health/summary/day?span=7&metrics=all매개변수:
period: 일, 주, 월, 년span: 기간 수 (기본값: 1)metrics: 쉼표로 구분된 목록 또는 "모두"(기본값)offset: 지금부터 오프셋할 기간 수 (기본값: 0)
senechal://health/profile- 사용자의 건강 프로필을 가져옵니다.인구 통계, 약물, 보충제 포함
senechal://health/current- 현재 건강 측정값을 가져옵니다.예:
senechal://health/current?types=1,2,3매개변수:
types: 측정 유형 ID의 선택적 쉼표로 구분된 목록
senechal://health/trends- 시간 경과에 따른 건강 추세 파악예:
senechal://health/trends?days=30&types=1,2,3&interval=day매개변수:
days: 분석할 일수(기본값: 30)types: 측정 유형 ID의 선택적 쉼표로 구분된 목록interval: 그룹화 간격 - 일, 주, 월 (기본값: 일)
senechal://health/stats- 건강 지표에 대한 통계 분석 받기예:
senechal://health/stats?days=30&types=1,2,3매개변수:
days: 분석 기간(일) (기본값: 30)types: 측정 유형 ID의 선택적 쉼표로 구분된 목록
사용 가능한 도구
fetch_health_summary- 특정 기간의 건강 요약을 가져옵니다.매개변수:
period(필수): 일, 주, 월, 년metrics(선택 사항): 쉼표로 구분된 메트릭 또는 "모두"(기본값)span(선택 사항): 반환할 기간 수(기본값: 1)offset(선택 사항): 오프셋할 기간 수(기본값: 0)
fetch_health_profile- 사용자의 건강 프로필을 가져옵니다.매개변수가 필요하지 않습니다
fetch_current_health- 최신 건강 측정값을 가져옵니다.매개변수:
types(선택 사항): 필터링할 측정 유형 ID 목록
fetch_health_trends- 건강 추세 데이터 가져오기매개변수:
days(선택 사항): 분석할 일 수(기본값: 30)types(선택 사항): 필터링할 측정 유형 ID 목록interval(선택 사항): 그룹화 간격 - 일, 주, 월(기본값: 일)
fetch_health_stats- 건강 지표의 통계 분석 가져오기매개변수:
days(선택 사항): 분석 기간(일)(기본값: 30)types(선택 사항): 필터링할 측정 유형 ID 목록
사용 가능한 프롬프트
analyze_health_summary- 건강 요약을 분석하라는 메시지비정상적인 측정항목, 추세를 식별하고 조치를 제안하기 위한 템플릿을 제공합니다.
senechal://health/summary/day?span=7의 데이터와 함께 사용하도록 의도되었습니다.
compare_health_trends- 다양한 기간 동안의 건강 추세를 비교하라는 메시지다양한 기간(7일, 30일, 90일)에 걸친 추세를 비교하기 위한 템플릿을 제공합니다.
건강 추세 엔드포인트의 데이터와 함께 사용하도록 의도됨
예시 상호작용
상태 요약 데이터 로딩 중
# In an LLM application, load a week of health summaries
content, mime_type = await session.read_resource("senechal://health/summary/day?span=7")건강 데이터 도구 호출
# In an LLM conversation
result = await session.call_tool(
"fetch_health_trends",
arguments={
"days": 30,
"interval": "day"
}
)
# More complex example combining tools and resources
profile = await session.call_tool("fetch_health_profile")
trends = await session.call_tool(
"fetch_health_trends",
arguments={"days": 90, "interval": "week"}
)상태 분석 프롬프트 사용
# Get a prompt for analyzing health data
prompt_result = await session.get_prompt("analyze_health_summary")
for message in prompt_result.messages:
print(f"[{message.role}]: {message.content.text}")완전한 동작 예제는 example_client.py 파일을 참조하세요.
API 엔드포인트
Senechal MCP 서버는 다음 Senechal API 엔드포인트와 통신합니다.
/health/summary/{period}- 건강 요약 받기/health/profile- 건강 프로필 가져오기/health/current- 현재 측정값을 가져옵니다./health/trends- 건강 트렌드 알아보기/health/stats- 건강 통계 가져오기