MLB Data MCP Server
A GitHub Copilot instruction set for building a Model Context Protocol (MCP) server that provides comprehensive access to MLB (Major League Baseball) data. This skill guides development of a TypeScript-based MCP server that interfaces with the MLB Stats API to capture baseball statistics, player information, team data, game schedules, and live scores.
What This Skill Does
This skill provides step-by-step guidance for building an MCP server that exposes MLB data through standardized tools. The server implements 6 core tools: get-standings, get-team-info, get-player-stats, get-schedule, get-live-game, and search-players. It creates a type-safe, production-ready MCP server with proper error handling and structured responses.
Instructions
Step 1: Clarify Project Requirements
Confirm the project scope: Building an MCP server for MLB data using TypeScript that captures MLB API information for baseball statistics, player information, team data, game schedules, and live scores.
Step 2: Scaffold the Project
Create the project structure with TypeScript configuration:
Set up package.json with MCP SDK dependencies (@modelcontextprotocol/sdk)Create main server file (src/index.ts) with MCP server implementationCreate MLB API client (src/mlb-api.ts) for interfacing with MLB Stats APIImplement 6 core tools: get-standings, get-team-info, get-player-stats, get-schedule, get-live-game, search-playersConfigure TypeScript (tsconfig.json) for Node.js targetStep 3: Customize the Project
Implement the core MCP server functionality:
Create type-safe interfaces for MLB API data structuresImplement proper error handling with structured error responsesAdd comprehensive tool schemas with parameter validationEnsure each tool returns structured JSON responsesCreate utility functions for API data transformationStep 4: Compile the Project
Build and validate the TypeScript project:
Install all npm dependenciesFix any TypeScript type compatibility issues with MCP SDKEnsure project compiles without errorsVerify build artifacts are created in /build directoryStep 5: Create and Run Task
Set up VS Code tasks and MCP debugging configuration:
Create VS Code task for running the MLB MCP serverConfigure task to execute "node build/index.js"Create .vscode/mcp.json configuration for MCP debuggingTest server startup to ensure "MLB MCP Server running on stdio" message appearsStep 6: Launch the Project
Test and validate the complete MCP server:
Launch the MCP server and verify it responds to tool callsTest each of the 6 core tools with sample dataVerify integration with MCP clients like Claude DesktopEnsure server handles errors gracefullyStep 7: Ensure Documentation is Complete
Create comprehensive documentation:
Write README.md with installation instructions, usage examples, and API referenceDocument all 6 tools with parameter descriptions and example responsesInclude setup instructions for MCP client integration (Claude Desktop, etc.)Update copilot-instructions.md with project completion statusDevelopment Guidelines
**Progress Tracking:**
Use available task management tools to track progress through the checklistMark each step complete with a brief summaryRead current status before starting each new step**Communication:**
Keep explanations concise and focusedAvoid verbose command outputsState skipped steps briefly**Development Rules:**
Use '.' as the working directory unless specified otherwiseAvoid adding media or external links unless explicitly requestedUse placeholders only when necessary with replacement notesThe project is already open in VS Code—don't suggest reopening**Folder Creation:**
Use current directory as project rootAlways use '.' argument for terminal commandsOnly create .vscode folder for tasks.json—no other folders unless explicitly requested**Extension Installation:**
Only install extensions specified by project setup requirementsNo additional extensions beyond what's explicitly needed**Project Content:**
Default to "Hello World" implementation if details aren't specifiedAvoid links, integrations, or media files unless explicitly requiredEnsure all components serve a clear purposePrompt for clarification on assumed features before implementation**Task Completion:**
Your task is complete when:
Project is successfully scaffolded and compiled without errorscopilot-instructions.md file exists in .github directoryREADME.md file exists and is up to dateUser has clear instructions to debug/launch the projectExample Usage
Once implemented, the MCP server provides these tools:
```typescript
// Get current MLB standings
get-standings { "season": 2024, "standingsTypes": "regularSeason" }
// Get team information
get-team-info { "teamId": 147 }
// Get player statistics
get-player-stats { "playerId": 660271, "season": 2024, "statGroup": "hitting" }
// Get game schedule
get-schedule { "teamId": 147, "startDate": "2024-04-01", "endDate": "2024-04-30" }
// Get live game data
get-live-game { "gamePk": 718142 }
// Search for players
search-players { "query": "Shohei Ohtani" }
```
Important Constraints
This is a TypeScript-based MCP server project—follow TypeScript best practicesThe MCP SDK requires specific server implementation patterns—follow the Model Context Protocol specificationMLB API rate limits may apply—implement appropriate request throttling if neededThe server communicates via stdio with MCP clientsAll tool responses must be valid JSON structuresReferences
Main MCP Repository: https://github.com/modelcontextprotocolTypeScript SDK: https://github.com/modelcontextprotocol/typescript-sdkMCP Documentation: https://modelcontextprotocol.io/