{"_id":"mysql-mcp-server","_rev":"5-4edbf000ed65be48757d0afe52fa3bf1","name":"mysql-mcp-server","dist-tags":{"latest":"0.1.4"},"versions":{"0.1.0":{"name":"mysql-mcp-server","version":"0.1.0","keywords":["mcp","mysql","database","model-context-protocol","ai","llm"],"author":{"name":"Diogo Lucas","email":"dpflucas@gmail.com"},"license":"MIT","_id":"mysql-mcp-server@0.1.0","maintainers":[{"name":"dpflucas","email":"dpflucas@gmail.com"}],"homepage":"https://github.com/dpflucas/mysql-mcp-server#readme","bugs":{"url":"https://github.com/dpflucas/mysql-mcp-server/issues"},"bin":{"mysql-mcp-server":"build/index.js"},"dist":{"shasum":"a818565113e234ad94c7c1bf40a1c9e0f8cfaaae","tarball":"https://registry.npmjs.org/mysql-mcp-server/-/mysql-mcp-server-0.1.0.tgz","fileCount":7,"integrity":"sha512-rAeDn79BVZW719WnQA/nBLP+W24GwwYEH0wOlCszf6+s9fx6Uu83TMJTuResrlcyDpax6kyEdYiXN/4Rlwez5Q==","signatures":[{"sig":"MEQCICM0FhPKxqcL7O1ImS/gRZlwVU3IBs5OxWgzvl0UCX/RAiAPqc1tGy5TSDdzUtB466GfaJ4E80ritbzlmqSBYhL8YQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":19476},"type":"module","gitHead":"4bf75bc892c76d25350bdf4272f2d6420a6f9567","scripts":{"test":"npm run test:setup && npm run test:tools","build":"tsc && node -e \"require('fs').chmodSync('build/index.js', '755')\"","watch":"tsc --watch","prepare":"npm run build","inspector":"npx @modelcontextprotocol/inspector build/index.js","test:setup":"node test-setup.js","test:tools":"node test-tools.js"},"_npmUser":{"name":"dpflucas","email":"dpflucas@gmail.com"},"repository":{"url":"git+https://github.com/dpflucas/mysql-mcp-server.git","type":"git"},"_npmVersion":"10.9.2","description":"An MCP server that provides read-only access to MySQL databases.","directories":{},"_nodeVersion":"22.6.0","dependencies":{"mysql2":"^3.12.0","@modelcontextprotocol/sdk":"0.6.0"},"_hasShrinkwrap":false,"devDependencies":{"dotenv":"^16.4.7","typescript":"^5.3.3","@types/node":"^20.11.24"},"_npmOperationalInternal":{"tmp":"tmp/mysql-mcp-server_0.1.0_1741691692898_0.8234713086225027","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"mysql-mcp-server","version":"0.1.1","keywords":["mcp","mysql","database","model-context-protocol","ai","llm"],"author":{"name":"Diogo Lucas","email":"dpflucas@gmail.com"},"license":"MIT","_id":"mysql-mcp-server@0.1.1","maintainers":[{"name":"dpflucas","email":"dpflucas@gmail.com"}],"homepage":"https://github.com/dpflucas/mysql-mcp-server#readme","bugs":{"url":"https://github.com/dpflucas/mysql-mcp-server/issues"},"bin":{"mysql-mcp-server":"build/index.js"},"dist":{"shasum":"106673ca06360912f3b7700a4c31de59a8fe7e1d","tarball":"https://registry.npmjs.org/mysql-mcp-server/-/mysql-mcp-server-0.1.1.tgz","fileCount":7,"integrity":"sha512-Eu60VzxkdZS7m5lgpXq1ZrGNArWBdXvTqXt3ERR5uZekNIzj6QRheIul/W/WeXLjUb839QY4GWs+SpUdK5LxBg==","signatures":[{"sig":"MEYCIQCwRpjh2cxq0NT7H2OWYxZM4/7NBAK3Z06sabLgcyLFGAIhAO6t9ffU8vEXlnsO9usT9nKCRz75PQxtI1SZLD07mls9","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":20261},"type":"module","gitHead":"cf71f8ffc0d708645206f44675e1950fb8f75b7c","scripts":{"test":"npm run test:setup && npm run test:tools","build":"tsc && node -e \"require('fs').chmodSync('build/index.js', '755')\"","watch":"tsc --watch","prepare":"npm run build","inspector":"npx @modelcontextprotocol/inspector build/index.js","test:setup":"node test-setup.js","test:tools":"node test-tools.js"},"_npmUser":{"name":"dpflucas","email":"dpflucas@gmail.com"},"repository":{"url":"git+https://github.com/dpflucas/mysql-mcp-server.git","type":"git"},"_npmVersion":"10.9.2","description":"An MCP server that provides read-only access to MySQL databases.","directories":{},"_nodeVersion":"22.6.0","dependencies":{"mysql2":"^3.12.0","@modelcontextprotocol/sdk":"0.6.0"},"_hasShrinkwrap":false,"devDependencies":{"dotenv":"^16.4.7","typescript":"^5.3.3","@types/node":"^20.11.24"},"_npmOperationalInternal":{"tmp":"tmp/mysql-mcp-server_0.1.1_1741696066565_0.5062836346204345","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"mysql-mcp-server","version":"0.1.2","keywords":["mcp","mysql","database","model-context-protocol","ai","llm"],"author":{"name":"Diogo Lucas","email":"dpflucas@gmail.com"},"license":"MIT","_id":"mysql-mcp-server@0.1.2","maintainers":[{"name":"dpflucas","email":"dpflucas@gmail.com"}],"homepage":"https://github.com/dpflucas/mysql-mcp-server#readme","bugs":{"url":"https://github.com/dpflucas/mysql-mcp-server/issues"},"bin":{"mysql-mcp-server":"build/index.js"},"dist":{"shasum":"633f136f37874c7d792601cdbe60a85b8a5487e0","tarball":"https://registry.npmjs.org/mysql-mcp-server/-/mysql-mcp-server-0.1.2.tgz","fileCount":7,"integrity":"sha512-GW7eimaxkvv6hW5jK5o8s4ELIHukGVF1/IApu5QjVgvD86MZKP4IKkuPRfqpXpbcPqvk3il8So9cxkRl7zF2DQ==","signatures":[{"sig":"MEUCIBRB4++zoPVo1T6mNLaZ0FwDfKAhHlW/P6jUq0YNlfScAiEA+X2SPFCaOOdl0UXYl1mLo9xFIfyrWPpzWVeZCCaQ0TE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":20552},"type":"module","gitHead":"aa73d942dc7f2324b7d38fbd3f58593524ecab8f","scripts":{"test":"npm run test:setup && npm run test:tools","build":"tsc && node -e \"require('fs').chmodSync('build/index.js', '755')\"","watch":"tsc --watch","prepare":"npm run build","inspector":"npx @modelcontextprotocol/inspector build/index.js","test:setup":"node test-setup.js","test:tools":"node test-tools.js"},"_npmUser":{"name":"dpflucas","email":"dpflucas@gmail.com"},"repository":{"url":"git+https://github.com/dpflucas/mysql-mcp-server.git","type":"git"},"_npmVersion":"10.9.2","description":"An MCP server that provides read-only access to MySQL databases.","directories":{},"_nodeVersion":"22.6.0","dependencies":{"mysql2":"^3.12.0","@modelcontextprotocol/sdk":"0.6.0"},"_hasShrinkwrap":false,"devDependencies":{"dotenv":"^16.4.7","typescript":"^5.3.3","@types/node":"^20.11.24"},"_npmOperationalInternal":{"tmp":"tmp/mysql-mcp-server_0.1.2_1744888802966_0.23184561143613425","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"mysql-mcp-server","version":"0.1.3","keywords":["mcp","mysql","database","model-context-protocol","ai","llm"],"author":{"name":"Diogo Lucas","email":"dpflucas@gmail.com"},"license":"MIT","_id":"mysql-mcp-server@0.1.3","maintainers":[{"name":"dpflucas","email":"dpflucas@gmail.com"}],"homepage":"https://github.com/dpflucas/mysql-mcp-server#readme","bugs":{"url":"https://github.com/dpflucas/mysql-mcp-server/issues"},"bin":{"mysql-mcp-server":"build/index.js"},"dist":{"shasum":"ba1ca3fb0a659fa9efa5a57afafdbddccc8ff344","tarball":"https://registry.npmjs.org/mysql-mcp-server/-/mysql-mcp-server-0.1.3.tgz","fileCount":7,"integrity":"sha512-6gCcKi5U3tvzI7Uiqvzx2uSbTwGkEeMSGACfZ2OXb/9zVBBTWKDxBeTvkuzV8CaojbWBH7R+KU94t9oJ9Kon/Q==","signatures":[{"sig":"MEUCIQCBkNchJnI+AtZ/94JWWfXTexCCrdaN5LyMxxUt64ynIQIgcxjd0Ee33nLOevXrTJTnd2oYHsY/EtgZNTIIHwHUR90=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":24210},"type":"module","gitHead":"fe67cde3b3614d4e69515cb3170cb11740931b97","scripts":{"test":"npm run test:setup && npm run test:tools","build":"tsc && node -e \"require('fs').chmodSync('build/index.js', '755')\"","watch":"tsc --watch","prepare":"npm run build","inspector":"npx @modelcontextprotocol/inspector build/index.js","test:setup":"node test-setup.js","test:tools":"node test-tools.js"},"_npmUser":{"name":"dpflucas","email":"dpflucas@gmail.com"},"repository":{"url":"git+https://github.com/dpflucas/mysql-mcp-server.git","type":"git"},"_npmVersion":"10.9.2","description":"An MCP server that provides read-only access to MySQL databases.","directories":{},"_nodeVersion":"22.6.0","dependencies":{"mysql2":"^3.12.0","@modelcontextprotocol/sdk":"0.6.0"},"_hasShrinkwrap":false,"devDependencies":{"dotenv":"^16.4.7","typescript":"^5.3.3","@types/node":"^20.11.24"},"_npmOperationalInternal":{"tmp":"tmp/mysql-mcp-server_0.1.3_1745317444033_0.35477244303298394","host":"s3://npm-registry-packages-npm-production"}},"0.1.4":{"_id":"mysql-mcp-server@0.1.4","bin":{"mysql-mcp-server":"build/index.js"},"bugs":{"url":"https://github.com/dpflucas/mysql-mcp-server/issues"},"dist":{"shasum":"c2e855fc5d88b1c35031946b8210dd1717d20f91","tarball":"https://registry.npmjs.org/mysql-mcp-server/-/mysql-mcp-server-0.1.4.tgz","fileCount":7,"integrity":"sha512-69KyhreCstfZG17ND8jAV6utaCjWg9Lmr4U0EKj3QQ7nv8n+AeWjnHTqlZRZwGY1IYTWE+1HA0BgD3Zbvi/9jg==","signatures":[{"sig":"MEUCIGkXAnBXGR0DxfnCS1MNkEmZS7t22ZFJg/1tpYtajPbaAiEAto++LvpXvZV+yXGjUvwfAKcFdcAYAN/+hp/+pUO10co=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCu0DAsXvvvwevFle0jJHf7Ncs8vuLorpd+bmJxaQ6ZiAIgIW2Gg+Hc3FRxg2AvHaaJmrKbN7YWXbQNQ3UA1gYW9xs="}],"unpackedSize":24343},"name":"mysql-mcp-server","type":"module","author":{"name":"Diogo Lucas","email":"dpflucas@gmail.com"},"gitHead":"d4e3c3dc2130990ee3e676ca06cd6e3668ec39c2","license":"MIT","scripts":{"test":"npm run test:validators && npm run test:setup && npm run test:tools","build":"tsc && node -e \"require('fs').chmodSync('build/index.js', '755')\"","watch":"tsc --watch","prepare":"npm run build","inspector":"npx @modelcontextprotocol/inspector build/index.js","test:setup":"node test-setup.js","test:tools":"node test-tools.js","test:validators":"npm run build && node test-validators.js"},"version":"0.1.4","_npmUser":{"name":"dpflucas","email":"dpflucas@gmail.com"},"homepage":"https://github.com/dpflucas/mysql-mcp-server#readme","keywords":["mcp","mysql","database","model-context-protocol","ai","llm"],"repository":{"url":"git+https://github.com/dpflucas/mysql-mcp-server.git","type":"git"},"_npmVersion":"11.19.1","description":"An MCP server that provides read-only access to MySQL databases.","directories":{},"maintainers":[{"name":"dpflucas","email":"dpflucas@gmail.com"}],"_nodeVersion":"26.8.2","dependencies":{"mysql2":"^3.24.4","@modelcontextprotocol/sdk":"^1.30.0"},"_hasShrinkwrap":false,"devDependencies":{"dotenv":"^16.4.7","typescript":"^5.3.3","@types/node":"^20.11.24"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mysql-mcp-server_0.1.4_1790087970673_0.33609965204786896"}}},"time":{"created":"2025-03-11T11:14:52.897Z","modified":"2026-09-22T14:39:30.939Z","0.1.0":"2025-03-11T11:14:53.103Z","0.1.1":"2025-03-11T12:27:46.784Z","0.1.2":"2025-04-17T11:20:03.159Z","0.1.3":"2025-04-22T10:24:04.198Z","0.1.4":"2026-09-22T14:39:30.772Z"},"bugs":{"url":"https://github.com/dpflucas/mysql-mcp-server/issues"},"author":{"name":"Diogo Lucas","email":"dpflucas@gmail.com"},"license":"MIT","homepage":"https://github.com/dpflucas/mysql-mcp-server#readme","keywords":["mcp","mysql","database","model-context-protocol","ai","llm"],"repository":{"url":"git+https://github.com/dpflucas/mysql-mcp-server.git","type":"git"},"description":"An MCP server that provides read-only access to MySQL databases.","maintainers":[{"name":"dpflucas","email":"dpflucas@gmail.com"}],"readme":"<a href=\"https://glama.ai/mcp/servers/@dpflucas/mysql-mcp-server\">\n  <img width=\"380\" height=\"200\" src=\"https://glama.ai/mcp/servers/@dpflucas/mysql-mcp-server/badge\" alt=\"mysql-mcp-server MCP server\" />\n</a>\n\n[![npm version](https://img.shields.io/npm/v/mysql-mcp-server?color=blue)](https://www.npmjs.com/package/mysql-mcp-server)\n\n\n# MySQL Database Access MCP Server\n\nThis MCP server provides read-only access to MySQL databases. It allows you to:\n\n- List available databases\n- List tables in a database\n- Describe table schemas\n- Execute read-only SQL queries\n\n## Security Features\n\n- **Read-only access**: Only SELECT, SHOW, DESCRIBE, and EXPLAIN statements are allowed; file-capable `SELECT INTO` and `LOAD_FILE` forms are rejected\n- **Query validation**: Prevents SQL injection and blocks any data modification attempts\n- **Query timeout**: Prevents long-running queries from consuming resources\n- **Row limit**: Prevents excessive data return\n- **Exact large numbers**: BIGINT and DECIMAL values are returned as strings to prevent precision loss\n\n## Installation\n\n### 1. Install using one of these methods:\n\n#### Install from NPM\n\n```bash\n# Install globally\nnpm install -g mysql-mcp-server\n\n# Or install locally in your project\nnpm install mysql-mcp-server\n```\n\n#### Build from Source\n\n```bash\n# Clone the repository\ngit clone https://github.com/dpflucas/mysql-mcp-server.git\ncd mysql-mcp-server\n\n# Install dependencies and build\nnpm install\nnpm run build\n```\n\n### 2. Configure environment variables\n\nThe server requires the following environment variables:\n\n- `MYSQL_HOST`: Database server hostname\n- `MYSQL_PORT`: Database server port (default: 3306)\n- `MYSQL_USER`: Database username\n- `MYSQL_PASSWORD`: Database password (optional, but recommended for secure connections)\n- `MYSQL_DATABASE`: Default database name (optional)\n\n### 3. Add to MCP settings\n\nAdd the following configuration to your MCP settings file:\n\nIf you installed via npm (Option 1):\n```json\n{\n  \"mcpServers\": {\n    \"mysql\": {\n      \"command\": \"npx\",\n      \"args\": [\"mysql-mcp-server\"],\n      \"env\": {\n        \"MYSQL_HOST\": \"your-mysql-host\",\n        \"MYSQL_PORT\": \"3306\",\n        \"MYSQL_USER\": \"your-mysql-user\",\n        \"MYSQL_PASSWORD\": \"your-mysql-password\",\n        \"MYSQL_DATABASE\": \"your-default-database\"\n      },\n      \"disabled\": false,\n      \"autoApprove\": []\n    }\n  }\n}\n```\n\nIf you built from source (Option 2):\n```json\n{\n  \"mcpServers\": {\n    \"mysql\": {\n      \"command\": \"node\",\n      \"args\": [\"/path/to/mysql-mcp-server/build/index.js\"],\n      \"env\": {\n        \"MYSQL_HOST\": \"your-mysql-host\",\n        \"MYSQL_PORT\": \"3306\",\n        \"MYSQL_USER\": \"your-mysql-user\",\n        \"MYSQL_PASSWORD\": \"your-mysql-password\",\n        \"MYSQL_DATABASE\": \"your-default-database\"\n      },\n      \"disabled\": false,\n      \"autoApprove\": []\n    }\n  }\n}\n```\n\n## Available Tools\n\n### list_databases\n\nLists all accessible databases on the MySQL server.\n\n**Parameters**: None\n\n**Example**:\n```json\n{\n  \"server_name\": \"mysql\",\n  \"tool_name\": \"list_databases\",\n  \"arguments\": {}\n}\n```\n\n### list_tables\n\nLists all tables in a specified database.\n\n**Parameters**:\n- `database` (optional): Database name (uses default if not specified)\n\n**Example**:\n```json\n{\n  \"server_name\": \"mysql\",\n  \"tool_name\": \"list_tables\",\n  \"arguments\": {\n    \"database\": \"my_database\"\n  }\n}\n```\n\n### describe_table\n\nShows the schema for a specific table.\n\n**Parameters**:\n- `database` (optional): Database name (uses default if not specified)\n- `table` (required): Table name\n\n**Example**:\n```json\n{\n  \"server_name\": \"mysql\",\n  \"tool_name\": \"describe_table\",\n  \"arguments\": {\n    \"database\": \"my_database\",\n    \"table\": \"my_table\"\n  }\n}\n```\n\n### execute_query\n\nExecutes a read-only SQL query.\n\n**Parameters**:\n- `query` (required): SQL query (only SELECT, SHOW, DESCRIBE, and EXPLAIN statements are allowed)\n- `database` (optional): Database name (uses default if not specified)\n\n**Example**:\n```json\n{\n  \"server_name\": \"mysql\",\n  \"tool_name\": \"execute_query\",\n  \"arguments\": {\n    \"database\": \"my_database\",\n    \"query\": \"SELECT * FROM my_table LIMIT 10\"\n  }\n}\n```\n\n## Advanced Connection Pool Configuration\n\nFor more control over the MySQL connection pool behavior, you can configure additional parameters:\n\n```json\n{\n  \"mcpServers\": {\n    \"mysql\": {\n      \"command\": \"npx\",\n      \"args\": [\"mysql-mcp-server\"],\n      \"env\": {\n        \"MYSQL_HOST\": \"your-mysql-host\",\n        \"MYSQL_PORT\": \"3306\",\n        \"MYSQL_USER\": \"your-mysql-user\",\n        \"MYSQL_PASSWORD\": \"your-mysql-password\",\n        \"MYSQL_DATABASE\": \"your-default-database\",\n        \n        \"MYSQL_CONNECTION_LIMIT\": \"10\",\n        \"MYSQL_QUEUE_LIMIT\": \"0\",\n        \"MYSQL_CONNECT_TIMEOUT\": \"10000\",\n        \"MYSQL_IDLE_TIMEOUT\": \"60000\",\n        \"MYSQL_MAX_IDLE\": \"10\"\n      },\n      \"disabled\": false,\n      \"autoApprove\": []\n    }\n  }\n}\n```\n\nThese advanced options allow you to:\n\n- `MYSQL_CONNECTION_LIMIT`: Control the maximum number of connections in the pool (default: 10)\n- `MYSQL_QUEUE_LIMIT`: Set the maximum number of connection requests to queue (default: 0, unlimited)\n- `MYSQL_CONNECT_TIMEOUT`: Adjust the connection timeout in milliseconds (default: 10000)\n- `MYSQL_IDLE_TIMEOUT`: Configure how long a connection can be idle before being released (in milliseconds)\n- `MYSQL_MAX_IDLE`: Set the maximum number of idle connections to keep in the pool\n\n\n## Testing\n\nThe server includes test scripts to verify functionality with your MySQL setup:\n\n### 1. Setup Test Database\n\nThis script creates a test database, table, and sample data:\n\n```bash\n# Set your MySQL credentials as environment variables\nexport MYSQL_HOST=localhost\nexport MYSQL_PORT=3306\nexport MYSQL_USER=your_username\nexport MYSQL_PASSWORD=your_password\n\n# Run the setup script\nnpm run test:setup\n```\n\n### 2. Test MCP Tools\n\nThis script tests each of the MCP tools against the test database:\n\n```bash\n# Set your MySQL credentials as environment variables\nexport MYSQL_HOST=localhost\nexport MYSQL_PORT=3306\nexport MYSQL_USER=your_username\nexport MYSQL_PASSWORD=your_password\nexport MYSQL_DATABASE=mcp_test_db\n\n# Run the tools test script\nnpm run test:tools\n```\n\n### 3. Run All Tests\n\nTo run both setup and tool tests:\n\n```bash\n# Set your MySQL credentials as environment variables\nexport MYSQL_HOST=localhost\nexport MYSQL_PORT=3306\nexport MYSQL_USER=your_username\nexport MYSQL_PASSWORD=your_password\n\n# Run all tests\nnpm test\n```\n\n## Troubleshooting\n\nIf you encounter issues:\n\n1. Check the server logs for error messages\n2. Verify your MySQL credentials and connection details\n3. Ensure your MySQL user has appropriate permissions\n4. Check that your query is read-only and properly formatted\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](../LICENSE) file for details.\n","readmeFilename":"README.md"}