Skip to main content
Glama
demo.py•2.71 kB
#!/usr/bin/env python3 """ FastMCP Server Demonstration Shows how to start the server and list available tools """ import sys from pathlib import Path # Add the current directory to Python path sys.path.insert(0, str(Path(__file__).parent)) def main(): """Main demonstration function.""" print("šŸš€ FastMCP Multi-Tool Server") print("=" * 50) try: # Import the server module import server print(f"āœ“ Server initialized: {server.mcp.name}") # Get the list of available tools if hasattr(server.mcp, '_tools'): tools = list(server.mcp._tools.keys()) print(f"\nšŸ“‹ Available Tools ({len(tools)}):") print("-" * 30) tool_descriptions = { 'get_current_time': 'šŸ•’ Get current date and time', 'get_weather': 'šŸŒ¤ļø Get weather for any city', 'create_file': 'šŸ“ Create new files', 'read_file': 'šŸ“– Read file contents', 'list_directory': 'šŸ“ List directory contents', 'execute_command': 'šŸ’» Execute shell commands safely', 'search_files': 'šŸ” Search for text in files', 'calculate_expression': '🧮 Calculate mathematical expressions', 'get_system_info': 'āš™ļø Get system information', 'create_temporary_file': 'šŸ“„ Create temporary files' } for i, tool in enumerate(sorted(tools), 1): description = tool_descriptions.get(tool, 'šŸ”§ Utility tool') print(f"{i:2d}. {description}") print(f" Function: {tool}") print("\n" + "=" * 50) print("šŸŽÆ How to Use:") print("1. Start the server: python server.py") print("2. Configure Claude Desktop with the server") print("3. Use the tools through Claude's interface") print("\nšŸ“– Documentation:") print("See README.md for detailed setup and usage instructions") print("\nšŸ”§ Configuration:") print("- Environment file: .env") print("- Add OpenWeatherMap API key for weather functionality") return True except Exception as e: print(f"āŒ Error loading server: {e}") return False if __name__ == "__main__": success = main() if success: print("\nāœ… Server is ready to run!") print("\nTo start the server now, run:") print("python server.py") else: print("\nāŒ Server has issues. Check the error messages above.") sys.exit(0 if success else 1)

Latest Blog Posts

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/rt0120-Ramco/mcp-py'

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