Skip to main content
Glama

Modular MCP Server & Client

by jackmichaud
mcp.py1.26 kB
import subprocess import sys def execute_command(command): try: # Execute the command and capture output process = subprocess.Popen( command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True ) # Get output and errors output, errors = process.communicate() # Return both output and errors return { 'output': output, 'errors': errors, 'return_code': process.returncode } except Exception as e: return { 'output': '', 'errors': str(e), 'return_code': 1 } def main(): if len(sys.argv) < 2: print("Usage: python mcp.py <command>") sys.exit(1) # Combine all arguments into a single command command = ' '.join(sys.argv[1:]) # Execute the command result = execute_command(command) # Print output and errors if result['output']: print("Output:") print(result['output']) if result['errors']: print("Errors:") print(result['errors']) sys.exit(result['return_code']) 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/jackmichaud/modular-mcp'

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