Skip to main content
Glama
etweisberg

MLB Stats MCP Server

by etweisberg
test_infra.py1.13 kB
""" Infrastructure tests for the MCP client with the baseball server. """ from pathlib import Path import pytest from mcp import ClientSession from mcp.client.stdio import StdioServerParameters, stdio_client def simplify_session_setup(): """Helper to create server params for tests.""" server_path = Path(__file__).parent.parent / "server.py" return StdioServerParameters(command="python", args=[str(server_path)], env=None) @pytest.mark.asyncio async def test_client_connection(): """Test connecting to the MCP server and checking available tools.""" params = simplify_session_setup() async with stdio_client(params) as (read_stream, write_stream): async with ClientSession(read_stream, write_stream) as session: await session.initialize() response = await session.list_tools() tools = response.tools tool_names = [tool.name for tool in tools] required_tools = ["get_schedule", "lookup_player", "get_standings"] for tool in required_tools: assert tool in tool_names, f"Missing required tool: {tool}"

Latest Blog Posts

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/etweisberg/mlb-mcp'

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