Skip to main content
Glama

Generalized MCP Server

by sarptandoven
test_github.py1.57 kB
import json import pytest from unittest import mock import grpc from src.server import MCPServicer from src.generated import mcp_pb2 @pytest.fixture def servicer(): return MCPServicer() def test_github_get_user(servicer): """Test GitHub user retrieval with mock.""" with mock.patch('github.MainClass.Github') as mock_github: mock_instance = mock_github.return_value mock_user = mock.MagicMock() mock_user.name = "Test User" mock_user.login = "testuser" mock_instance.get_user.return_value = mock_user req = mcp_pb2.InvokeRequest( fq_name="github.MainClass.Github.get_user", json_args='{"args": ["testuser"]}' ) resp = servicer.Invoke(req, grpc.ServicerContext()) result = json.loads(resp.json_result) assert "Test User" in str(result) def test_github_get_repo(servicer): """Test GitHub repository access with mock.""" with mock.patch('github.MainClass.Github') as mock_github: mock_instance = mock_github.return_value mock_repo = mock.MagicMock() mock_repo.name = "test-repo" mock_repo.full_name = "owner/test-repo" mock_instance.get_repo.return_value = mock_repo req = mcp_pb2.InvokeRequest( fq_name="github.MainClass.Github.get_repo", json_args='{"args": ["owner/test-repo"]}' ) resp = servicer.Invoke(req, grpc.ServicerContext()) result = json.loads(resp.json_result) assert "test-repo" in str(result)

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/sarptandoven/generalized-mcp-converter'

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