|
| 1 | +# MCPHub CLI |
| 2 | + |
| 3 | +The MCPHub CLI is a command-line interface tool for managing Model Context Protocol (MCP) server configurations. It provides a user-friendly way to add, remove, monitor, and run MCP servers. |
| 4 | + |
| 5 | +## Installation |
| 6 | + |
| 7 | +The CLI is included with the MCPHub package. Install it using pip: |
| 8 | + |
| 9 | +```bash |
| 10 | +pip install mcphub |
| 11 | +``` |
| 12 | + |
| 13 | +## Available Commands |
| 14 | + |
| 15 | +### 1. Add a Server (`add`) |
| 16 | +Add a new MCP server from a GitHub repository to your local configuration. |
| 17 | + |
| 18 | +```bash |
| 19 | +mcphub add <repo_url> [mcp_name] |
| 20 | +``` |
| 21 | + |
| 22 | +Options: |
| 23 | +- `repo_url`: GitHub repository URL of the MCP server |
| 24 | +- `mcp_name` (optional): Custom name for the MCP server |
| 25 | +- `-n, --non-interactive`: Skip environment variable prompts |
| 26 | + |
| 27 | +Example: |
| 28 | +```bash |
| 29 | +mcphub add https://github.com/username/repo my-server |
| 30 | +``` |
| 31 | + |
| 32 | +### 2. Remove a Server (`remove`) |
| 33 | +Remove an MCP server configuration from your local config. |
| 34 | + |
| 35 | +```bash |
| 36 | +mcphub remove <mcp_name> |
| 37 | +``` |
| 38 | + |
| 39 | +Example: |
| 40 | +```bash |
| 41 | +mcphub remove my-server |
| 42 | +``` |
| 43 | + |
| 44 | +### 3. List Servers (`ps`) |
| 45 | +List all configured MCP servers with detailed process information. |
| 46 | + |
| 47 | +```bash |
| 48 | +mcphub ps |
| 49 | +``` |
| 50 | + |
| 51 | +Shows: |
| 52 | +- Server name |
| 53 | +- Status (running/not running) |
| 54 | +- Ports |
| 55 | +- Command |
| 56 | +- Creation time |
| 57 | +- Uptime |
| 58 | + |
| 59 | +### 4. Check Server Status (`status`) |
| 60 | +Show detailed status information for a specific MCP server. |
| 61 | + |
| 62 | +```bash |
| 63 | +mcphub status <mcp_name> |
| 64 | +``` |
| 65 | + |
| 66 | +Example: |
| 67 | +```bash |
| 68 | +mcphub status my-server |
| 69 | +``` |
| 70 | + |
| 71 | +### 5. Run a Server (`run`) |
| 72 | +Run a configured MCP server with optional SSE support. |
| 73 | + |
| 74 | +```bash |
| 75 | +mcphub run <mcp_name> [options] |
| 76 | +``` |
| 77 | + |
| 78 | +Options: |
| 79 | +- `--sse`: Enable Server-Sent Events support |
| 80 | +- `--port`: Port for SSE server (default: 3000) |
| 81 | +- `--base-url`: Base URL for SSE server (default: http://localhost:3000) |
| 82 | +- `--sse-path`: Path for SSE endpoint (default: /sse) |
| 83 | +- `--message-path`: Path for message endpoint (default: /message) |
| 84 | + |
| 85 | +Example: |
| 86 | +```bash |
| 87 | +mcphub run my-server --sse --port 3001 |
| 88 | +``` |
| 89 | + |
| 90 | +## Configuration File |
| 91 | + |
| 92 | +The CLI uses a `.mcphub.json` configuration file in your project directory. Here's an example structure: |
| 93 | + |
| 94 | +```json |
| 95 | +{ |
| 96 | + "mcpServers": { |
| 97 | + "server-name": { |
| 98 | + "package_name": "package-name", |
| 99 | + "command": "command-to-run", |
| 100 | + "args": ["arg1", "arg2"], |
| 101 | + "env": { |
| 102 | + "ENV_VAR": "value" |
| 103 | + }, |
| 104 | + "description": "Server description", |
| 105 | + "tags": ["tag1", "tag2"], |
| 106 | + "last_run": "timestamp" |
| 107 | + } |
| 108 | + } |
| 109 | +} |
| 110 | +``` |
| 111 | + |
| 112 | +## Features |
| 113 | + |
| 114 | +- Rich terminal interface with progress bars and colored output |
| 115 | +- Interactive prompts for configuration |
| 116 | +- Process management and monitoring |
| 117 | +- Server-Sent Events (SSE) support |
| 118 | +- Environment variable management |
| 119 | +- GitHub repository integration |
| 120 | +- Detailed status reporting |
| 121 | +- Process monitoring and management |
| 122 | + |
| 123 | +## Error Handling |
| 124 | + |
| 125 | +The CLI provides clear error messages and helpful suggestions when something goes wrong. Common error scenarios include: |
| 126 | + |
| 127 | +- Invalid GitHub repository URLs |
| 128 | +- Missing environment variables |
| 129 | +- Server configuration issues |
| 130 | +- Process management errors |
| 131 | + |
| 132 | +## Contributing |
| 133 | + |
| 134 | +To contribute to the CLI development: |
| 135 | + |
| 136 | +1. Fork the repository |
| 137 | +2. Create a feature branch |
| 138 | +3. Make your changes |
| 139 | +4. Add tests for new functionality |
| 140 | +5. Submit a pull request |
| 141 | + |
| 142 | +## License |
| 143 | + |
| 144 | +This project is licensed under the MIT License - see the LICENSE file for details. |
0 commit comments