{"id":31287872,"url":"https://github.com/ashwinjo/cyperf-ce-mcp-rest","last_synced_at":"2026-05-03T15:35:43.063Z","repository":{"id":316125954,"uuid":"1061580538","full_name":"ashwinjo/cyperf-ce-mcp-rest","owner":"ashwinjo","description":"Cyperf CE MCP REST API - Model Context Protocol server for Keysight Cyperf CE performance testing with streamable HTTP interface","archived":false,"fork":false,"pushed_at":"2025-09-22T19:47:19.000Z","size":75,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-22T21:23:10.383Z","etag":null,"topics":["cyperf","docker","fastapi","keysight","mcp","model-context-protocol","performance-testing","rest-api"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ashwinjo.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-22T05:44:23.000Z","updated_at":"2025-09-22T19:47:22.000Z","dependencies_parsed_at":"2025-09-22T21:23:12.964Z","dependency_job_id":null,"html_url":"https://github.com/ashwinjo/cyperf-ce-mcp-rest","commit_stats":null,"previous_names":["ashwinjo/cyperf-ce-mcp-rest"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/ashwinjo/cyperf-ce-mcp-rest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashwinjo%2Fcyperf-ce-mcp-rest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashwinjo%2Fcyperf-ce-mcp-rest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashwinjo%2Fcyperf-ce-mcp-rest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashwinjo%2Fcyperf-ce-mcp-rest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ashwinjo","download_url":"https://codeload.github.com/ashwinjo/cyperf-ce-mcp-rest/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashwinjo%2Fcyperf-ce-mcp-rest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32575113,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T06:36:36.687Z","status":"ssl_error","status_checked_at":"2026-05-03T06:36:09.306Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cyperf","docker","fastapi","keysight","mcp","model-context-protocol","performance-testing","rest-api"],"created_at":"2025-09-24T11:28:16.134Z","updated_at":"2026-05-03T15:35:43.036Z","avatar_url":"https://github.com/ashwinjo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# REST Powered Cyperf CE Controller\n\nA FastAPI-based web application to control Keysight Cyperf CE Client and Server Tests via SSH.\n\n---\n\n## Features\n\n- Start/stop Cyperf server and client remotely via REST API\n- SSH authentication via private key or username/password\n- Dockerized for easy deployment\n- Collects and returns test statistics\n\n---\n\n## Requirements\n\n- Python 3.11+\n- Docker (for containerized deployment)\n- Access to remote machines with Cyperf installed\n\n---\n\n## Environment Variables\n\nThe application is configured via environment variables (or a `.env` file):\n\n| Variable         | Description                                 | Example                        |\n|------------------|---------------------------------------------|--------------------------------|\n| SERVER_IP        | IP address of the Cyperf server             | `100.25.44.178`                |\n| CLIENT_IP        | IP address of the Cyperf client             | `34.218.246.113`               |\n| SSH_USERNAME     | SSH username for both server and client     | `ubuntu`                       |\n| SSH_KEY_PATH     | Path to SSH private key (inside container)  | `/home/ubuntu/vibecode.pem`    |\n| SSH_PASSWORD     | (Optional) SSH password for authentication  | `yourpassword`                 |\n\n- If `SSH_PASSWORD` is set, the app uses username/password authentication.\n- If not, it uses the SSH key at `SSH_KEY_PATH`.\n\n---\n\n## Local Development\n\n1. **Install dependencies:**\n   ```sh\n   pip install -r requirements.txt\n   ```\n\n2. **Create a `.env` file:**\n   ```\n   SERVER_IP=100.25.44.178\n   CLIENT_IP=34.218.246.113\n   SSH_USERNAME=ubuntu\n   SSH_KEY_PATH=/path/to/vibecode.pem\n   # SSH_PASSWORD=yourpassword  # Uncomment to use password auth\n   ```\n\n3. **Run the app:**\n   ```sh\n   uvicorn main:app --reload\n   ```\n\n---\n\n## Docker Usage\n\n### **Build the image:**\n```sh\ndocker build -t cyperf-app .\n```\n\n### **Run the container:**\n```sh\ndocker run -d -p 8000:8000 \\\n  -e SERVER_IP=100.25.44.178 \\\n  -e CLIENT_IP=34.218.246.113 \\\n  -e SSH_USERNAME=ubuntu \\\n  -e SSH_KEY_PATH=/home/ubuntu/vibecode.pem \\\n  -v /path/to/vibecode.pem:/home/ubuntu/vibecode.pem:ro \\\n  cyperf-app\n```\n- To use password authentication, add `-e SSH_PASSWORD=yourpassword` and omit the `-v`/`SSH_KEY_PATH` options.\n\n### **Using a `.env` file:**\n```sh\ndocker run -d -p 8000:8000 --env-file .env \\\n  -v /path/to/vibecode.pem:/home/ubuntu/vibecode.pem:ro \\\n  cyperf-app\n```\n\n---\n\n## API\n\n- The API is served at: `http://localhost:8000/api/`\n- Interactive docs: `http://localhost:8000/docs`\n\n---\n\n## SSH Authentication\n\n- **Key-based:** Mount your private key into the container and set `SSH_KEY_PATH`.\n- **Password-based:** Set `SSH_PASSWORD` (do not set `SSH_KEY_PATH`).\n\n---\n\n## MCP (Model Context Protocol) Support\n\nThis application now supports MCP (Model Context Protocol) for integration with MCP clients like Claude Desktop, Cursor, and other AI assistants.\n\n### **MCP Server Setup**\n\nThe MCP server wraps the FastAPI endpoints and exposes them as tools that can be used by MCP clients.\n\n#### **Available MCP Tools:**\n\n1. **start_cyperf_server** - Start a Cyperf CE server\n2. **start_cyperf_client** - Start a Cyperf CE client  \n3. **get_server_stats** - Get server statistics\n4. **get_client_stats** - Get client statistics\n5. **get_server_stats_image** - Get server stats as image\n6. **get_client_stats_image** - Get client stats as image\n7. **stop_server** - Stop all servers\n\n#### **Running with Docker Compose (MCP + FastAPI):**\n\n1. **Create environment file:**\n   ```bash\n   # .env file\n   SERVER_IP=100.25.44.178\n   CLIENT_IP=34.218.246.113\n   SSH_USERNAME=ubuntu\n   SSH_KEY_PATH=/home/ubuntu/vibecode.pem\n   SSH_KEY_HOST_PATH=/path/to/your/vibecode.pem\n   # SSH_PASSWORD=yourpassword  # Optional: for password auth\n   ```\n\n2. **Start both services:**\n   ```bash\n   docker-compose -f docker-compose.mcp.yml up -d\n   ```\n\n   This starts:\n   - FastAPI service on `http://localhost:8000`\n   - MCP server ready for stdio connection\n\n#### **Running MCP Server Standalone:**\n\n```bash\n# Build the image\ndocker build -f Dockerfile.mcp -t cyperf-mcp .\n\n# Run MCP server\ndocker run -it --rm \\\n  -e SERVER_IP=100.25.44.178 \\\n  -e CLIENT_IP=34.218.246.113 \\\n  -e SSH_USERNAME=ubuntu \\\n  -e SSH_KEY_PATH=/home/ubuntu/vibecode.pem \\\n  -v /path/to/vibecode.pem:/home/ubuntu/vibecode.pem:ro \\\n  cyperf-mcp mcp\n```\n\n#### **Using with MCP Clients:**\n\n##### **HTTP Streamable (Recommended):**\n\n**Option 1: SSE (Server-Sent Events) Server**\n\nThe dedicated SSE server provides the most robust streaming experience:\n\n```bash\n# Start your main FastAPI app first\nuvicorn main:app --host 0.0.0.0 --port 8000 \u0026\n\n# Start the MCP SSE server\npython mcp_sse_server.py --host 0.0.0.0 --port 8001\n```\n\n**Claude Desktop Configuration for SSE:**\n```json\n{\n  \"mcpServers\": {\n    \"cyperf-ce-controller\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@modelcontextprotocol/server-everything\"],\n      \"env\": {\n        \"MCP_SERVER_URL\": \"http://localhost:8001/sse\"\n      }\n    }\n  }\n}\n```\n\n**Option 2: Direct HTTP Endpoint**\n\nYour FastAPI app includes a `/api/mcp` endpoint for simple HTTP-based MCP:\n\n**Claude Desktop Configuration for HTTP:**\n```json\n{\n  \"mcpServers\": {\n    \"cyperf-ce-controller\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@modelcontextprotocol/server-everything\"],\n      \"env\": {\n        \"MCP_SERVER_URL\": \"http://localhost:8000/api/mcp\"\n      }\n    }\n  }\n}\n```\n\n##### **Direct stdio (Alternative):**\n\nAdd to your `claude_desktop_config.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"cyperf-ce-controller\": {\n      \"command\": \"docker\",\n      \"args\": [\n        \"run\", \"-i\", \"--rm\",\n        \"--env-file\", \"/path/to/.env\",\n        \"-v\", \"/path/to/vibecode.pem:/home/ubuntu/vibecode.pem:ro\",\n        \"cyperf-mcp\", \"mcp\"\n      ]\n    }\n  }\n}\n```\n\n##### **Direct Python Execution:**\n\n```bash\n# Make sure FastAPI is running first\nuvicorn main:app --host 0.0.0.0 --port 8000 \u0026\n\n# Run MCP server\npython mcp_server.py\n```\n\n#### **MCP Usage Examples:**\n\nOnce connected to an MCP client, you can:\n\n1. **Start a server test:**\n   ```\n   Use the start_cyperf_server tool with port 5202 and csv_stats enabled\n   ```\n\n2. **Connect a client:**\n   ```\n   Use start_cyperf_client with the test_id from server, server IP, and run for 120 seconds\n   ```\n\n3. **Get statistics:**\n   ```\n   Use get_server_stats or get_client_stats with the test_id\n   ```\n\n4. **Visualize data:**\n   ```\n   Use get_server_stats_image to get a visual table of the statistics\n   ```\n\n#### **Testing the MCP Endpoints:**\n\n**Testing the SSE Server:**\n\n```bash\n# Test SSE server health\ncurl http://localhost:8001/health\n\n# Test SSE endpoint (requires SSE client or tools like curl with --no-buffer)\ncurl -X POST http://localhost:8001/sse \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Accept: text/event-stream\" \\\n  -N \\\n  -d '{\n    \"jsonrpc\": \"2.0\",\n    \"id\": 1,\n    \"method\": \"tools/list\"\n  }'\n\n# If you get the \"Not Acceptable\" error, make sure to include the Accept header:\ncurl -X POST http://localhost:8001/sse \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Accept: text/event-stream\" \\\n  -N \\\n  -d '{\n    \"jsonrpc\": \"2.0\",\n    \"id\": 1,\n    \"method\": \"initialize\",\n    \"params\": {\n      \"protocolVersion\": \"2024-11-05\",\n      \"capabilities\": {},\n      \"clientInfo\": {\n        \"name\": \"test-client\",\n        \"version\": \"1.0.0\"\n      }\n    }\n  }'\n```\n\n**Testing the Direct HTTP Endpoint:**\n\nYou can test the MCP endpoint directly with curl:\n\n```bash\n# Test MCP initialization\ncurl -X POST http://localhost:8000/api/mcp \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"jsonrpc\": \"2.0\",\n    \"id\": 1,\n    \"method\": \"initialize\",\n    \"params\": {\n      \"protocolVersion\": \"2024-11-05\",\n      \"capabilities\": {},\n      \"clientInfo\": {\n        \"name\": \"test-client\",\n        \"version\": \"1.0.0\"\n      }\n    }\n  }'\n\n# List available tools\ncurl -X POST http://localhost:8000/api/mcp \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"jsonrpc\": \"2.0\",\n    \"id\": 2,\n    \"method\": \"tools/list\"\n  }'\n\n# Call a tool (start server)\ncurl -X POST http://localhost:8000/api/mcp \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"jsonrpc\": \"2.0\",\n    \"id\": 3,\n    \"method\": \"tools/call\",\n    \"params\": {\n      \"name\": \"start_cyperf_server\",\n      \"arguments\": {\n        \"port\": 5202,\n        \"csv_stats\": true\n      }\n    }\n  }'\n```\n\n---\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashwinjo%2Fcyperf-ce-mcp-rest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fashwinjo%2Fcyperf-ce-mcp-rest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashwinjo%2Fcyperf-ce-mcp-rest/lists"}