Sponsored by Deepsite.site

KRA Racing Data Analysis MCP Server

Created By
coyaSONG6 months ago
한국 마사회의 공공API를 이용한 MCP server 입니다.
Content

KRA Racing Data Analysis MCP Server

한국 마사회(Korea Racing Authority) 공공 API를 활용한 경마 데이터 분석 MCP 서버

이 프로젝트는 Model Context Protocol (MCP)을 사용하여 한국 마사회의 경마 데이터를 분석하고 인사이트를 제공하는 서버입니다.

🏇 주요 기능

🔧 분석 도구 (Tools)

  • analyze-race: 경주 분석 (날짜, 경주번호, 경마장별)
  • analyze-horse-performance: 말 성적 분석 및 폼 평가
  • get-jockey-stats: 기수 통계 및 성과 분석
  • analyze-odds: 배당률 분석 및 패턴 인식
  • analyze-track-condition: 주로 상태 및 날씨 영향 분석

📁 데이터 리소스 (Resources)

  • schedule://{date}: 경주 일정 정보 (오늘/내일)
  • horses://{horseName}: 말 상세 정보 및 기록
  • tracks://{trackCode}: 경마장 정보 (서울/부산/제주)
  • config://kra-api: KRA API 설정 및 구성

💬 분석 프롬프트 (Prompts)

  • predict-race: 경주 예측 분석 (기본/상세/통계)
  • horse-performance-report: 말 성적 상세 리포트
  • market-analysis: 마권 시장 분석 (배당률/거래량/트렌드)

🎯 활용 분야

  • 경주 예측: 데이터 기반 경주 결과 예측
  • 투자 분석: 마권 투자 전략 수립
  • 성과 평가: 말, 기수, 조교사 성과 분석
  • 시장 분석: 배당률 및 거래량 패턴 분석
  • 리스크 관리: 투자 리스크 평가 및 관리

📦 설치 및 설정

필수 요구사항

  • Node.js 18.0.0 이상
  • npm 또는 yarn
  • 한국 마사회 공공 API 접근 권한실제 연동 완료

KRA API 키 설정 (필수)

  1. 공공데이터포털 신청

    • 공공데이터포털 접속
    • "한국마사회 경주기록 정보" API 검색 및 신청
    • 승인 후 서비스키 발급받기
  2. 환경변수 설정

    # Windows (PowerShell)
    $env:KRA_SERVICE_KEY="YOUR_SERVICE_KEY_HERE"
    
    # macOS/Linux
    export KRA_SERVICE_KEY="YOUR_SERVICE_KEY_HERE"
    
    # 또는 .env 파일 생성
    echo "KRA_SERVICE_KEY=YOUR_SERVICE_KEY_HERE" > .env
    
  3. 서비스키 확인

    • URL 인코딩된 키를 사용해야 합니다
    • 특수문자가 포함된 경우 인코딩 필요

프로젝트 설치

# 저장소 클론
git clone <repository-url>
cd kra-racing-data-mcp-server

# 의존성 설치
npm install

# KRA API 키 설정 (위 참조)
export KRA_SERVICE_KEY="your_service_key"

🏃‍♂️ 실행 방법

개발 모드

npm run dev

감시 모드 (파일 변경 시 자동 재시작)

npm run watch

프로덕션 빌드 및 실행

npm run build
npm start

🔧 MCP 클라이언트 등록

Cursor IDE에서 사용

~/.cursor/mcp.json 파일에 추가:

{
  "mcpServers": {
    "kra-racing-analysis": {
      "command": "npx",
      "args": ["tsx", "C:/Users/SONG/kra-racing-data-mcp-server/src/index.ts"]
    }
  }
}

프로덕션 버전 사용 시:

{
  "mcpServers": {
    "kra-racing-analysis": {
      "command": "node",
      "args": ["C:/Users/SONG/kra-racing-data-mcp-server/dist/index.js"]
    }
  }
}

Cursor 재시작 후 사용 가능합니다.

🧪 테스트 및 검증

MCP Inspector 사용

npx @modelcontextprotocol/inspector npx tsx src/index.ts

도구 테스트 예시

# 경주 분석 테스트
analyze-race --raceDate="2024-01-15" --raceNumber="3" --trackCode="seoul"

# 말 성적 분석 테스트
analyze-horse-performance --horseName="우승마" --period="1year"

📂 프로젝트 구조

kra-racing-data-mcp-server/
├── src/
│   └── index.ts              # 메인 서버 파일
├── dist/                     # 빌드된 JavaScript 파일
├── package.json              # 프로젝트 설정
├── tsconfig.json             # TypeScript 설정
├── .gitignore               # Git 제외 파일
└── README.md                # 프로젝트 문서

🔍 사용 예시

1. 경주 분석 요청

{
  "method": "tools/call",
  "params": {
    "name": "analyze-race",
    "arguments": {
      "raceDate": "2024-01-15",
      "raceNumber": 5,
      "trackCode": "seoul"
    }
  }
}

2. 말 정보 조회

{
  "method": "resources/read",
  "params": {
    "uri": "horses://우승마"
  }
}

3. 경주 예측 프롬프트

{
  "method": "prompts/get",
  "params": {
    "name": "predict-race",
    "arguments": {
      "raceDate": "2024-01-15",
      "raceNumber": "5",
      "analysisType": "detailed"
    }
  }
}

🛠️ 개발 가이드

새로운 분석 도구 추가

server.tool("new-analysis-tool",
  { 
    param1: z.string(),
    param2: z.number().optional()
  },
  async ({ param1, param2 }) => ({
    content: [{ 
      type: "text", 
      text: `분석 결과: ${param1} ${param2 || ''}` 
    }]
  })
);

새로운 데이터 리소스 추가

server.resource(
  "new-resource",
  new ResourceTemplate("resource://{id}", { list: undefined }),
  async (uri, { id }) => ({
    contents: [{
      uri: uri.href,
      text: JSON.stringify({ id, data: "..." }, null, 2)
    }]
  })
);

🌐 API 연동 (예정)

현재는 모의 데이터를 사용하며, 향후 다음 API들과 연동 예정:

  • 한국 마사회 공공 API: 경주 정보, 출전마 데이터
  • 실시간 배당률 API: 배당률 변화 추적
  • 경주 결과 API: 과거 경주 결과 데이터
  • 기상 정보 API: 주로 상태 영향 분석

📊 데이터 분석 기능

지원하는 분석 유형

  • 기술적 분석: 과거 성적 기반 패턴 분석
  • 통계적 분석: 확률 모델 및 회귀 분석
  • 시장 분석: 배당률 및 거래량 분석
  • 비교 분석: 말, 기수, 조교사 간 비교

예측 모델 (계획)

  • 머신러닝 모델: 과거 데이터 기반 예측
  • 앙상블 모델: 다중 모델 결합 예측
  • 실시간 분석: 경주 당일 실시간 데이터 분석

🔒 보안 및 준수사항

  • 한국 마사회 API 이용약관 준수
  • 개인정보보호법 준수
  • 안전한 API 키 관리
  • 데이터 사용량 제한 준수

📚 참고 자료

📄 라이선스

MIT License


⚠️ 중요: 현재 버전은 프로토타입이며, 실제 KRA API 연동은 API 제공 후 구현 예정입니다.

💡 : Context7과 함께 사용하면 더욱 정확한 경마 데이터 분석을 받을 수 있습니다! 프롬프트에 use context7을 추가해보세요.

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Playwright McpPlaywright MCP server
CursorThe AI Code Editor
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Serper MCP ServerA Serper MCP Server
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Amap Maps高德地图官方 MCP Server
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Tavily Mcp
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
ChatWiseThe second fastest AI chatbot™
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
WindsurfThe new purpose-built IDE to harness magic
DeepChatYour AI Partner on Desktop