Skip to main content
Glama

MCP Agent Tracker

by Big0290
test_mcp_tools.pyโ€ข5.65 kB
#!/usr/bin/env python3 """ Test script to verify MCP tools are properly registered This helps debug why Cursor might not see the tools """ import sys import os # Add current directory to path sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) def test_mcp_tools(): """Test that MCP tools are properly registered""" print("๐Ÿงช Testing MCP Tool Registration...") try: # Import the main module from main import mcp, get_available_tools print(f"โœ… MCP server imported: {mcp}") print(f"๐Ÿ“ Server name: {mcp.name}") # Check available tools using the helper function tools = get_available_tools() print(f"๐Ÿ”ง Available tools: {len(tools) if isinstance(tools, dict) else 0}") if not tools: print("โŒ No tools found! This is the problem.") return False # List all tools with their details for tool_name, tool_info in tools.items(): print(f" ๐Ÿ“Œ {tool_name}:") if isinstance(tool_info, dict): print(f" Description: {tool_info.get('description', 'No description')}") print(f" Parameters: {tool_info.get('parameters', 'No parameters')}") else: print(f" Info: {tool_info}") print() # Test tool execution (if possible) print("๐Ÿงช Testing tool execution...") # Test the system status tool if 'get_system_status' in tools: print("โœ… get_system_status tool found") else: print("โŒ get_system_status tool not found") # Test the test conversation tracking tool if 'test_conversation_tracking' in tools: print("โœ… test_conversation_tracking tool found") else: print("โŒ test_conversation_tracking tool not found") # Test the weather tool if 'get_current_weather' in tools: print("โœ… get_current_weather tool found") else: print("โŒ get_current_weather tool not found") print("\n๐ŸŽ‰ MCP tools are properly registered!") return True except Exception as e: print(f"โŒ Error testing MCP tools: {e}") import traceback traceback.print_exc() return False def test_mcp_server_startup(): """Test that the MCP server can start properly""" print("\n๐Ÿš€ Testing MCP Server Startup...") try: from main import mcp, get_available_tools # Check if we can access the server object print(f"โœ… MCP server object accessible: {type(mcp)}") print(f"โœ… Server name: {mcp.name}") # Get available tools tools = get_available_tools() tool_names = list(tools.keys()) if isinstance(tools, dict) else [] print(f"โœ… Available tools: {tool_names}") # Test that the server has the right attributes if hasattr(mcp, 'run'): print("โœ… Server has 'run' method") else: print("โŒ Server missing 'run' method") # Check for tools-related attributes tools_attrs = [attr for attr in dir(mcp) if 'tool' in attr.lower()] if tools_attrs: print(f"โœ… Server has tools-related attributes: {tools_attrs}") else: print("โš ๏ธ Server has no obvious tools-related attributes") return True except Exception as e: print(f"โŒ Error testing MCP server startup: {e}") return False def test_tool_execution(): """Test that tools can actually be executed""" print("\n๐Ÿ”ง Testing Tool Execution...") try: from main import get_system_status, test_conversation_tracking # Test system status tool print("๐Ÿงช Testing get_system_status...") status_result = get_system_status() print(f"โœ… get_system_status result: {status_result[:100]}...") # Test conversation tracking tool print("๐Ÿงช Testing test_conversation_tracking...") tracking_result = test_conversation_tracking("Test from test script") print(f"โœ… test_conversation_tracking result: {tracking_result}") return True except Exception as e: print(f"โŒ Error testing tool execution: {e}") import traceback traceback.print_exc() return False if __name__ == "__main__": print("๐Ÿ” MCP Tools Registration Test") print("=" * 50) tools_ok = test_mcp_tools() startup_ok = test_mcp_server_startup() execution_ok = test_tool_execution() print("\n" + "=" * 50) if tools_ok and startup_ok and execution_ok: print("๐ŸŽฏ ALL TESTS PASSED!") print("โœ… MCP tools are properly registered") print("โœ… MCP server can start properly") print("โœ… Tools can be executed successfully") print("\n๐Ÿ’ก If Cursor still doesn't see the tools, check:") print(" 1. The .cursor/mcp.json configuration") print(" 2. That the MCP server is running") print(" 3. Cursor's MCP server connection") else: print("โŒ SOME TESTS FAILED!") if not tools_ok: print("โŒ MCP tools registration failed") if not startup_ok: print("โŒ MCP server startup failed") if not execution_ok: print("โŒ Tool execution failed") print("\n๐Ÿ”ง Please fix the issues above before using with Cursor") print("=" * 50)

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/Big0290/MCP'

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