Skip to main content
Glama

FastMCP Demo Server

by apoojary94
simple_test.pyโ€ข2.8 kB
#!/usr/bin/env python3 """Simple test script for the GitHub MCP Server functions.""" import server import json def test_basic_functionality(): """Test basic functionality without MCP decorators.""" print("๐Ÿงช Testing Basic Functionality") print("=" * 50) # Test 1: Check if styles are available print("โœ… Available styles:") for style in server.ACCEPTED_STYLES: print(f" - {style}") # Test 2: Test style validation print(f"\nโœ… Total styles: {len(server.ACCEPTED_STYLES)}") # Test 3: Test URL parsing test_url = "https://raw.githubusercontent.com/microsoft/vscode/main/README.md" parsed = server.parse_github_url(test_url) print(f"\nโœ… URL parsing test:") print(f" URL: {test_url}") if parsed: print(f" Owner: {parsed['owner']}") print(f" Repo: {parsed['repo']}") print(f" Branch: {parsed['branch']}") print(f" File: {parsed['file_path']}") else: print(" โŒ Failed to parse URL") # Test 4: Test review generation sample_code = "def hello():\n print('Hello, World!')" review = server.generate_style_review(sample_code, "pirate") print(f"\nโœ… Review generation test (pirate style):") print(f" Preview: {review[:100]}...") print("\n" + "=" * 50) print("๐ŸŽ‰ Basic functionality tests passed!") def test_mcp_server_start(): """Test if the MCP server can start.""" print("\n๐Ÿงช Testing MCP Server Start") print("=" * 50) try: # Check if app is properly initialized print(f"โœ… App name: {server.app.name}") print(f"โœ… App description: {server.app.instructions}") # Check if tools are registered tools = getattr(server.app, '_tools', {}) print(f"โœ… Registered tools: {len(tools)}") for tool_name in tools: print(f" - {tool_name}") print("\nโœ… MCP server is properly initialized!") except Exception as e: print(f"โŒ MCP server initialization failed: {e}") print("\n" + "=" * 50) def main(): """Run simple tests.""" print("๐Ÿš€ Simple GitHub MCP Server Test") print("=" * 60) try: test_basic_functionality() test_mcp_server_start() print("\n๐ŸŽ‰ All tests completed!") print("\n๐Ÿ“‹ Ready for Cursor integration!") print("๐Ÿ’ก To test in Cursor:") print(" 1. Restart Cursor") print(" 2. Try: 'Download and review these files in pirate style: https://raw.githubusercontent.com/microsoft/vscode/main/README.md'") except Exception as e: print(f"โŒ Test failed: {e}") import traceback traceback.print_exc() if __name__ == "__main__": main()

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/apoojary94/mcp_hackathon'

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