Skip to main content
Glama

https://github.com/sammcj/mcp-package-version

by sammcj
package handlers_test import ( "testing" ) // TestMCPToolResponse validates that tool responses adhere to the MCP protocol specification func TestMCPToolResponse(t *testing.T) { // Skip test in CI since it makes remote API calls t.Skip("Skipping tests that make remote API calls") // Define handlers to test (commented out for now) /* // Create a logger for testing logger := logrus.New() logger.SetLevel(logrus.DebugLevel) // Create a shared cache for testing sharedCache := &sync.Map{} // Define test cases for different handlers testCases := []struct { name string handler interface{} args map[string]interface{} assertFn func(t *testing.T, result *mcp.CallToolResult) }{ { name: "DockerHandler", handler: handlers.NewDockerHandler(logger, sharedCache), args: map[string]interface{}{ "image": "debian", "registry": "dockerhub", "limit": float64(2), }, assertFn: func(t *testing.T, result *mcp.CallToolResult) { validateDockerResult(t, result) }, }, { name: "PythonHandler", handler: handlers.NewPythonHandler(logger, sharedCache), args: map[string]interface{}{ "requirements": []interface{}{"requests==2.25.1", "flask>=2.0.0"}, }, assertFn: func(t *testing.T, result *mcp.CallToolResult) { validatePythonResult(t, result) }, }, { name: "NPMHandler", handler: handlers.NewNpmHandler(logger, sharedCache), args: map[string]interface{}{ "dependencies": map[string]interface{}{ "express": "^4.17.1", "lodash": "^4.17.21", }, }, assertFn: func(t *testing.T, result *mcp.CallToolResult) { validateNPMResult(t, result) }, }, } // Run the test cases for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { // Get the appropriate method based on handler type var result *mcp.CallToolResult var err error switch h := tc.handler.(type) { case *handlers.DockerHandler: result, err = h.GetLatestVersion(context.Background(), tc.args) case *handlers.PythonHandler: result, err = h.GetLatestVersionFromRequirements(context.Background(), tc.args) case *handlers.NpmHandler: result, err = h.GetLatestVersion(context.Background(), tc.args) default: t.Fatalf("Unknown handler type: %T", tc.handler) } // Validate the result require.NoError(t, err) require.NotNil(t, result, "Result should not be nil") // Validate that the result adheres to MCP protocol standards validateMCPToolResult(t, result) // Run handler-specific validations tc.assertFn(t, 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/sammcj/mcp-package-version'

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