Skip to main content
Glama

MLB Stats MCP Server

by jdguggs10
test-worker.jsโ€ข1.89 kB
#!/usr/bin/env node /** * Simple test script to validate the MLB Stats MCP Worker * Run with: node test-worker.js <worker-url> */ const WORKER_URL = process.argv[2] || 'http://localhost:8787'; const testCases = [ { name: "Get Teams", payload: { command: "getTeamInfo", params: { queryParams: { season: "2024", sportId: "1" } } } }, { name: "Get Aaron Judge Player Info", payload: { command: "getPlayerInfo", params: { pathParams: { playerId: "592450" } } } }, { name: "Invalid Command Test", payload: { command: "invalidCommand", params: {} } } ]; async function runTest(testCase) { console.log(`\n๐Ÿงช Running test: ${testCase.name}`); console.log(`๐Ÿ“ค Request: ${JSON.stringify(testCase.payload, null, 2)}`); try { const response = await fetch(WORKER_URL, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(testCase.payload) }); const result = await response.json(); console.log(`๐Ÿ“ฅ Response Status: ${response.status}`); console.log(`๐Ÿ“ฅ Response: ${JSON.stringify(result, null, 2).substring(0, 500)}...`); if (response.ok) { console.log(`โœ… Test passed: ${testCase.name}`); } else { console.log(`โŒ Test failed: ${testCase.name}`); } } catch (error) { console.log(`๐Ÿ’ฅ Test error: ${testCase.name} - ${error.message}`); } } async function main() { console.log(`๐Ÿš€ Testing MLB Stats MCP Worker at: ${WORKER_URL}`); for (const testCase of testCases) { await runTest(testCase); await new Promise(resolve => setTimeout(resolve, 1000)); // Wait 1s between tests } console.log('\n๐Ÿ All tests completed!'); } main().catch(console.error);

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jdguggs10/mlbstats-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server