{"id":45918269,"url":"https://github.com/actstorms/mcp-mysql-server","last_synced_at":"2026-02-28T08:02:52.254Z","repository":{"id":285983855,"uuid":"959981684","full_name":"actstorms/mcp-mysql-server","owner":"actstorms","description":null,"archived":false,"fork":false,"pushed_at":"2025-04-03T17:05:25.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-08T20:57:20.194Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/actstorms.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}},"created_at":"2025-04-03T17:03:35.000Z","updated_at":"2025-04-03T17:05:28.000Z","dependencies_parsed_at":"2025-04-03T18:22:41.311Z","dependency_job_id":"55903f0a-fc77-4211-86e6-501aaee1babd","html_url":"https://github.com/actstorms/mcp-mysql-server","commit_stats":null,"previous_names":["actstorms/mcp-mysql-server"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/actstorms/mcp-mysql-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actstorms%2Fmcp-mysql-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actstorms%2Fmcp-mysql-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actstorms%2Fmcp-mysql-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actstorms%2Fmcp-mysql-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/actstorms","download_url":"https://codeload.github.com/actstorms/mcp-mysql-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actstorms%2Fmcp-mysql-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29927926,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T19:37:42.220Z","status":"online","status_checked_at":"2026-02-28T02:00:07.010Z","response_time":90,"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":[],"created_at":"2026-02-28T08:02:51.717Z","updated_at":"2026-02-28T08:02:52.247Z","avatar_url":"https://github.com/actstorms.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MySQL MCP Server\n\nVersion: 0.1.0\n\nA Model Context Protocol (MCP) server for interacting with a MySQL database. This server allows MCP clients (like AI assistants) to query and modify data in a configured MySQL database.\n\n## Features\n\n*   Connects to a MySQL database using standard connection parameters.\n*   Provides MCP tools for executing SQL queries and statements.\n*   Supports read-only queries (`SELECT`, `SHOW`, `DESCRIBE`).\n*   Supports write operations (`INSERT`, `UPDATE`, `DELETE`) via separate tools, gated by an environment variable (`MYSQL_ALLOW_WRITE_OPS`).\n*   Communicates over standard input/output (stdio).\n\n## Installation\n\n```bash\n# Install as a project dependency (recommended for use within another project)\nnpm install\n\n# Or, if intended as a standalone global tool:\n# 1. Build the project:\n#    npm run build\n# 2. Link it globally:\n#    npm link \n#    (or use `npm install -g .` if publishing)\n```\n\n## Configuration\n\nThis server requires the following environment variables to be set for database connection:\n\n*   `MYSQL_HOST`: The hostname or IP address of your MySQL server.\n*   `MYSQL_USER`: The username for connecting to the database.\n*   `MYSQL_PASSWORD`: The password for the specified user.\n*   `MYSQL_DATABASE`: The name of the database to connect to.\n*   `MYSQL_PORT`: (Optional) The port number for the MySQL server (defaults to 3306).\n*   `MYSQL_ALLOW_WRITE_OPS`: (Optional) Set to `true` to enable the `insert`, `update`, and `delete` tools. Defaults to `false` (write operations disabled). **Warning:** Enabling write operations allows the MCP client to modify your database. Use with caution.\n\nThese variables need to be available in the environment where the server process is launched. How you set them depends on your operating system and how you run the server (e.g., `.env` file, system environment variables, shell export).\n\n## Usage\n\nOnce configured and built (`npm run build`), you can run the server:\n\n```bash\n# If linked globally\nmysql-server\n\n# Or run directly using node\nnode build/index.js \n```\n\nThe server will start and print `MySQL MCP server running on stdio` to stderr, then listen for MCP requests on standard input/output. You would typically configure your MCP client (e.g., an AI assistant integration) to connect to this server process.\n\n## Available Tools\n\nThe server exposes the following tools for use by MCP clients:\n\n### 1. `query`\n\n*   **Description:** Executes a read-only SQL query (SELECT, SHOW, DESCRIBE) against the configured database.\n*   **Input Schema:**\n    ```json\n    {\n      \"type\": \"object\",\n      \"properties\": {\n        \"sql\": {\n          \"type\": \"string\",\n          \"description\": \"The read-only SQL query (SELECT, SHOW, DESCRIBE) to execute.\"\n        }\n      },\n      \"required\": [\"sql\"]\n    }\n    ```\n*   **Output:** Returns the query results as a JSON string within the MCP response `content`. Returns an error if the query is not read-only or if there's a database error.\n\n### 2. `insert`\n\n*   **Description:** Executes an INSERT SQL statement. **Requires `MYSQL_ALLOW_WRITE_OPS` to be set to `true`.**\n*   **Input Schema:**\n    ```json\n    {\n      \"type\": \"object\",\n      \"properties\": {\n        \"sql\": {\n          \"type\": \"string\",\n          \"description\": \"The INSERT SQL statement to execute.\"\n        }\n      },\n      \"required\": [\"sql\"]\n    }\n    ```\n*   **Output:** Returns a success message including affected rows and insert ID (if applicable), or an error message if the operation fails or write operations are disabled.\n\n### 3. `update`\n\n*   **Description:** Executes an UPDATE SQL statement. **Requires `MYSQL_ALLOW_WRITE_OPS` to be set to `true`.**\n*   **Input Schema:**\n    ```json\n    {\n      \"type\": \"object\",\n      \"properties\": {\n        \"sql\": {\n          \"type\": \"string\",\n          \"description\": \"The UPDATE SQL statement to execute.\"\n        }\n      },\n      \"required\": [\"sql\"]\n    }\n    ```\n*   **Output:** Returns a success message including affected rows, or an error message if the operation fails or write operations are disabled.\n\n### 4. `delete`\n\n*   **Description:** Executes a DELETE SQL statement. **Requires `MYSQL_ALLOW_WRITE_OPS` to be set to `true`.**\n*   **Input Schema:**\n    ```json\n    {\n      \"type\": \"object\",\n      \"properties\": {\n        \"sql\": {\n          \"type\": \"string\",\n          \"description\": \"The DELETE SQL statement to execute.\"\n        }\n      },\n      \"required\": [\"sql\"]\n    }\n    ```\n*   **Output:** Returns a success message including affected rows, or an error message if the operation fails or write operations are disabled.\n\n## Development\n\nTo work on the server code:\n\n1.  **Clone the repository:** (If applicable)\n    ```bash\n    # git clone \u003crepository-url\u003e\n    # cd mysql-server\n    ```\n2.  **Install dependencies:**\n    ```bash\n    npm install\n    ```\n3.  **Build the code:** (Compiles TypeScript to JavaScript in `build/`)\n    ```bash\n    npm run build\n    ```\n4.  **Watch for changes:** (Automatically recompiles on changes)\n    ```bash\n    npm run watch\n    ```\n5.  **Run the MCP Inspector:** (For testing/debugging the server locally)\n    ```bash\n    # Make sure you have built the code first\n    npm run inspector \n    ```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Factstorms%2Fmcp-mysql-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Factstorms%2Fmcp-mysql-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Factstorms%2Fmcp-mysql-server/lists"}