Skip to main content
Glama

MCP-Ables

by mfakbar127
mcpables-main.py2.98 kB
#!/usr/bin/env python3 """ MCP-Ables: Convert YAML tool definitions into MCP servers Usage: python mcpables-main.py <yaml-path> Examples: python mcpables-main.py examples/nuclei.yaml python mcpables-main.py examples/ """ import sys import argparse from pathlib import Path from mcpables.yaml_parser import YAMLParser from mcpables.mcp_generator import MCPGenerator def main(): """Main entry point for MCP-Ables""" parser = argparse.ArgumentParser( description='Convert YAML tool definitions into MCP servers', formatter_class=argparse.RawDescriptionHelpFormatter, epilog=""" Examples: # Single file python mcpables-main.py examples/nuclei.yaml # Directory (scans recursively for .yaml/.yml files) python mcpables-main.py examples/ This will load tools from YAML files, generate an MCP server, and start serving all tools for AI agents like Claude Code to use. """ ) parser.add_argument( 'yaml_path', type=str, help='Path to a YAML file or directory containing YAML files' ) parser.add_argument( '--timeout', type=int, default=30, help='Default command timeout in seconds (default: 30)' ) args = parser.parse_args() # Validate path exists path = Path(args.yaml_path) if not path.exists(): print(f"Error: Path not found: {args.yaml_path}", file=sys.stderr) sys.exit(1) try: # Load tools from file or directory if path.is_file(): print(f"Loading tools from file: {args.yaml_path}") tool_specs = YAMLParser.parse_file(str(path)) elif path.is_dir(): print(f"Scanning directory for YAML files: {args.yaml_path}") tool_specs = YAMLParser.parse_directory(str(path)) else: print(f"Error: Path is neither a file nor a directory: {args.yaml_path}", file=sys.stderr) sys.exit(1) # Display loaded tools print(f"\n✓ Loaded {len(tool_specs)} tool(s):") for tool_spec in tool_specs: print(f" - {tool_spec.name}: {tool_spec.description}") # Generate MCP server print("\nGenerating MCP server...") generator = MCPGenerator(tool_specs) mcp_server = generator.create_server() print(f"✓ MCP server 'mcpables' created with {len(tool_specs)} tool(s)") print(f"\nStarting server...") print("Ready to accept requests from AI agents.\n") # Start the server (FastMCP handles the async runtime) mcp_server.run() except ValueError as e: print(f"Error: {e}", file=sys.stderr) sys.exit(1) except KeyboardInterrupt: print("\n\nShutting down...") sys.exit(0) except Exception as e: print(f"Unexpected error: {e}", file=sys.stderr) import traceback traceback.print_exc() sys.exit(1) 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/mfakbar127/MCP-Ables'

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