{"id":50982789,"url":"https://github.com/phpgao/mysqlmcp","last_synced_at":"2026-06-19T16:04:11.192Z","repository":{"id":364945763,"uuid":"1269852432","full_name":"phpgao/mysqlmcp","owner":"phpgao","description":"MySQL MCP server — multi-instance MySQL access for AI assistants. SQL static analysis, read-only enforcement, dual transport.","archived":false,"fork":false,"pushed_at":"2026-06-15T07:22:11.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-15T08:24:06.679Z","etag":null,"topics":["ai","database","developer-tools","go","mcp","mcp-server","mysql","sql"],"latest_commit_sha":null,"homepage":"https://phpgao.github.io/mysqlmcp/","language":"Go","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/phpgao.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":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-06-15T06:48:46.000Z","updated_at":"2026-06-15T07:22:13.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/phpgao/mysqlmcp","commit_stats":null,"previous_names":["phpgao/mysqlmcp"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/phpgao/mysqlmcp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpgao%2Fmysqlmcp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpgao%2Fmysqlmcp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpgao%2Fmysqlmcp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpgao%2Fmysqlmcp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phpgao","download_url":"https://codeload.github.com/phpgao/mysqlmcp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpgao%2Fmysqlmcp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34538480,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-19T02:00:06.005Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["ai","database","developer-tools","go","mcp","mcp-server","mysql","sql"],"created_at":"2026-06-19T16:04:10.401Z","updated_at":"2026-06-19T16:04:11.184Z","avatar_url":"https://github.com/phpgao.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mysqlmcp\n\nMySQL MCP server — multi-instance MySQL access for AI assistants via MCP protocol.\n\n## Features\n\n- **Multi-instance**: Connect to multiple MySQL servers simultaneously\n- **Read-only enforcement**: Prevent write operations on production read replicas\n- **SQL static analysis**: Parse and validate SQL before execution\n- **Security**: LIMIT required on SELECT, single-statement only, timeout control\n- **Dual transport**: stdio (local) and HTTP (remote with Bearer token auth)\n- **Zero dependencies on model**: Works with any MCP-compatible client\n\n## Quick Start\n\n### Install\n\n```\ngo install github.com/phpgao/mysqlmcp@latest\n```\n\n### Configure\n\nCreate `config.yaml`:\n\n```yaml\ninstances:\n  - instance_id: \"local\"\n    dsn: \"root:password@tcp(127.0.0.1:3306)/mydb?charset=utf8mb4\u0026parseTime=true\"\n    environment: \"development\"\n    read_only: false\n```\n\n### Run (stdio mode)\n\nAdd to your MCP client config (`~/.codebuddy/mcp.json`):\n\n```json\n{\n  \"mcpServers\": {\n    \"mysqlmcp\": {\n      \"command\": \"mysqlmcp\",\n      \"args\": [\"-config\", \"/path/to/config.yaml\"]\n    }\n  }\n}\n```\n\n### Run (HTTP mode)\n\n```bash\n# Generate a secure token\nexport MYSQLMCP_TOKEN=\"your-secure-token\"\n\n# Start HTTP server\nmysqlmcp -transport http -port 8000\n```\n\nMCP client config (remote access):\n\n```json\n{\n  \"mcpServers\": {\n    \"mysqlmcp\": {\n      \"url\": \"http://localhost:8000/mcp\",\n      \"headers\": {\n        \"Authorization\": \"Bearer your-secure-token\"\n      }\n    }\n  }\n}\n```\n\n### Configuration Reference\n\n```yaml\nserver:\n  token: \"your-secret-http-token\"  # HTTP mode Bearer token\n  port: 8000\n\ndefaults:\n  timeout_seconds: 30    # Max query timeout\n  max_rows: 10000        # Max return rows\n\ninstances:\n  - instance_id: \"prod-readonly\"     # Unique ID for quick lookup\n    dsn: \"user:pass@tcp(host:3306)/db?charset=utf8mb4\u0026parseTime=true\"\n    environment: \"production\"\n    read_only: true                   # Rejects INSERT/UPDATE/DELETE\n    timeout_seconds: 30\n    max_rows: 1000\n\n  - instance_id: \"staging-rw\"\n    dsn: \"user:pass@tcp(host:3307)/db?charset=utf8mb4\u0026parseTime=true\"\n    environment: \"staging\"\n    read_only: false\n    timeout_seconds: 60\n    max_rows: 5000\n```\n\n## MCP Tools\n\n| Tool | Description |\n|------|-------------|\n| `list_instances` | List all configured instances with metadata |\n| `query` | Execute SQL (SELECT requires LIMIT, read-only enforced) |\n| `describe_table` | Show table schema (DESCRIBE) |\n| `explain_query` | Show execution plan (EXPLAIN) |\n\n## SQL Security\n\nEvery SQL statement goes through 4-layer validation:\n\n1. **Parse \u0026 Inject Detection**: SQL must parse cleanly, dangerous operations blocked (DROP DATABASE, etc.)\n2. **Single Statement**: Multiple statements separated by `;` are rejected\n3. **LIMIT Check**: SELECT must include a LIMIT clause, cannot exceed `max_rows`\n4. **Read-only Check**: Write operations (INSERT/UPDATE/DELETE) rejected on read-only instances\n\nPlus: **Query timeout** enforced per-instance, **row count** truncated at `max_rows`.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpgao%2Fmysqlmcp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphpgao%2Fmysqlmcp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpgao%2Fmysqlmcp/lists"}