Skip to main content
Glama

MCP Template

test_server.py1.62 kB
""" Integration tests for MCP server. """ import pytest from mcp_template.app import create_app from mcp_template.core.server import MCPServer @pytest.mark.integration def test_app_creation(test_settings): """Test that application can be created with settings.""" app = create_app(test_settings) assert app is not None assert app.settings.server.name == "test-server" assert app.server is not None @pytest.mark.integration def test_server_initialization(test_settings): """Test server initialization.""" server = MCPServer(test_settings) assert server is not None assert server.settings.server.name == "test-server" assert server._running is False @pytest.mark.integration def test_component_registration(test_settings): """Test that components are registered correctly.""" app = create_app(test_settings) # Check that tools are registered assert "example_calculator" in app.server._tool_handlers assert "example_search" in app.server._tool_handlers # Check that resources are registered assert "example_config" in app.server._resource_handlers assert "example_status" in app.server._resource_handlers # Check that prompts are registered assert "example_prompt" in app.server._prompt_handlers @pytest.mark.integration @pytest.mark.asyncio async def test_health_check(test_settings): """Test server health check.""" server = MCPServer(test_settings) health = await server.health_check() assert health["status"] == "healthy" assert health["server"]["name"] == "test-server" assert "checks" in health

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/riteshsonawala/mcp-template'

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