{"_id":"@arvoretech/mysql-mcp","_rev":"10-5cd302c6dc5c4eb8484da66ee0dddea9","name":"@arvoretech/mysql-mcp","dist-tags":{"latest":"1.0.4"},"versions":{"1.0.0":{"name":"@arvoretech/mysql-mcp","version":"1.0.0","keywords":["mcp","mysql","database","llm","ai","arvore"],"author":{"name":"Arvore"},"license":"MIT","_id":"@arvoretech/mysql-mcp@1.0.0","maintainers":[{"name":"joao.barros.arvore","email":"joao.barros@arvore.com.br"}],"homepage":"https://github.com/arvoreeducacao/arvore-mcp-servers#readme","bugs":{"url":"https://github.com/arvoreeducacao/arvore-mcp-servers/issues"},"bin":{"mysql-mcp":"dist/index.js"},"dist":{"shasum":"ca15f21e151cf3cc65eda59f9e7a1f57dfed597f","tarball":"https://registry.npmjs.org/@arvoretech/mysql-mcp/-/mysql-mcp-1.0.0.tgz","fileCount":32,"integrity":"sha512-WpeTW9e3RNSbYwdmyuF6oD8LoubB2iujd2EO2V/6HzZI5ZercX4YP7xofWzZt3ksJ3saFzeh3tkLVjk5W9rmfA==","signatures":[{"sig":"MEYCIQCYJRK/7133fmT14U+y901aMgPZCYYFO3d5Ct+vKDm8egIhAL5wXBUV2o/YtWMQfMLz1q3F8+qYiRCR6RrpDnIJE0kb","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":72714},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","gitHead":"61639fec2e249e20cedc5e85cd11be86cdd10e7f","scripts":{"dev":"tsx src/index.ts","lint":"eslint src/**/*.ts","test":"vitest","build":"tsc","start":"node dist/index.js","lint:fix":"eslint src/**/*.ts --fix","test:cov":"vitest --coverage"},"_npmUser":{"name":"joao.barros.arvore","email":"joao.barros@arvore.com.br"},"repository":{"url":"git+https://github.com/arvoreeducacao/arvore-mcp-servers.git","type":"git","directory":"packages/mysql"},"_npmVersion":"10.8.2","description":"MySQL MCP Server for read-only database operations","directories":{},"_nodeVersion":"20.19.5","dependencies":{"zod":"^3.22.4","mysql2":"^3.6.5","@modelcontextprotocol/sdk":"^1.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/mysql-mcp_1.0.0_1761862099147_0.226624348908411","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@arvoretech/mysql-mcp","version":"1.0.1","keywords":["mcp","mysql","database","llm","ai","arvore"],"author":{"name":"Arvore"},"license":"MIT","_id":"@arvoretech/mysql-mcp@1.0.1","maintainers":[{"name":"joao.barros.arvore","email":"joao.barros@arvore.com.br"}],"homepage":"https://github.com/arvoreeducacao/arvore-mcp-servers#readme","bugs":{"url":"https://github.com/arvoreeducacao/arvore-mcp-servers/issues"},"bin":{"mysql-mcp":"dist/index.js"},"dist":{"shasum":"9c8d4f9a076e23eb87989892200d63f7417d30cc","tarball":"https://registry.npmjs.org/@arvoretech/mysql-mcp/-/mysql-mcp-1.0.1.tgz","fileCount":32,"integrity":"sha512-ahvRG73ZEfcsp6F2l1XnBy0NPKCAcAiOkcYsKpX11llCmLZjhGMKEha6s6LcocISMaFFO4W/K/ET+RWQxD0+xQ==","signatures":[{"sig":"MEUCIQDe3OGCCX3HJ7QTOKEOyld/0RFb3JzyykKfFJEeLt9vBwIgbrH9ysl/3RL8/oYFwSBmnU8LALjXbN551Gf2UM1ieAE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":72560},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","gitHead":"276708ed1d3a23092cdecb40c6d5fb736ab09f9e","scripts":{"dev":"tsx src/index.ts","lint":"eslint src/**/*.ts","test":"vitest","build":"tsc","start":"node dist/index.js","lint:fix":"eslint src/**/*.ts --fix","test:cov":"vitest --coverage"},"_npmUser":{"name":"joao.barros.arvore","email":"joao.barros@arvore.com.br"},"repository":{"url":"git+https://github.com/arvoreeducacao/arvore-mcp-servers.git","type":"git","directory":"packages/mysql"},"_npmVersion":"10.8.2","description":"MySQL MCP Server for read-only database operations","directories":{},"_nodeVersion":"20.19.5","dependencies":{"zod":"^3.22.4","mysql2":"^3.6.5","@modelcontextprotocol/sdk":"^1.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/mysql-mcp_1.0.1_1761865975807_0.013466367608522267","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@arvoretech/mysql-mcp","version":"1.0.2","keywords":["mcp","mysql","database","llm","ai","arvore"],"author":{"name":"Arvore"},"license":"MIT","_id":"@arvoretech/mysql-mcp@1.0.2","maintainers":[{"name":"joao.barros.arvore","email":"joao.barros@arvore.com.br"}],"homepage":"https://github.com/arvoreeducacao/arvore-mcp-servers#readme","bugs":{"url":"https://github.com/arvoreeducacao/arvore-mcp-servers/issues"},"bin":{"mysql-mcp":"dist/index.js"},"dist":{"shasum":"008e7eaa19607624546818c47e8cc3dc052919f7","tarball":"https://registry.npmjs.org/@arvoretech/mysql-mcp/-/mysql-mcp-1.0.2.tgz","fileCount":32,"integrity":"sha512-OIgf4RUCd85Ln9Z6pHes/xE/TIiHVEBeTCkljL92cQehSE+TLwupwcL5s8vbvAcIr+wT2wq7kPPT2frD20fRAA==","signatures":[{"sig":"MEYCIQCEnKFDdqKOSUD4tpDWevOIl+zJ7PaMDjJspR1vFwRsQAIhAOD7GhX97JbXhx33c1eD44WfEm3Gmsk8kLgsMq6SnrlK","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":72560},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","gitHead":"e693015587b0573f63473530d3e6c99616ec66ec","scripts":{"dev":"tsx src/index.ts","lint":"eslint src/**/*.ts","test":"vitest","build":"tsc","start":"node dist/index.js","lint:fix":"eslint src/**/*.ts --fix","test:cov":"vitest --coverage"},"_npmUser":{"name":"joao.barros.arvore","email":"joao.barros@arvore.com.br"},"repository":{"url":"git+https://github.com/arvoreeducacao/arvore-mcp-servers.git","type":"git","directory":"packages/mysql"},"_npmVersion":"10.8.2","description":"MySQL MCP Server for read-only database operations","directories":{},"_nodeVersion":"20.19.5","dependencies":{"zod":"^3.22.4","mysql2":"^3.6.5","@modelcontextprotocol/sdk":"^1.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/mysql-mcp_1.0.2_1761866072796_0.5525905417498067","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@arvoretech/mysql-mcp","version":"1.0.3","keywords":["mcp","mysql","database","llm","ai","arvore"],"author":{"name":"Arvore"},"license":"MIT","_id":"@arvoretech/mysql-mcp@1.0.3","maintainers":[{"name":"joao.barros.arvore","email":"joao.barros@arvore.com.br"}],"homepage":"https://github.com/arvoreeducacao/arvore-mcp-servers#readme","bugs":{"url":"https://github.com/arvoreeducacao/arvore-mcp-servers/issues"},"bin":{"mysql-mcp":"dist/index.js"},"dist":{"shasum":"54e38a7f6627d1cd8b7fb62f26be081c00114792","tarball":"https://registry.npmjs.org/@arvoretech/mysql-mcp/-/mysql-mcp-1.0.3.tgz","fileCount":32,"integrity":"sha512-QG+gCYVh/pbYmH54MWMoX13sN+I4zF9F0kRhfvMS37c7kviJfIK7aMtn6afccuXwLhnekHmtHoDx7TmBmOplNA==","signatures":[{"sig":"MEUCIF07nA4BF4pqOzlYyOjDNc6aI6CYV19oOafJo3CPzt8PAiEAgSeG5qKXl7Mn+djLoXryHIeLgCbz4fTxQbjnbKOF7g8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":76711},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","gitHead":"785fcfad7173cfe2c9a5e5adb489fb45aba57e03","scripts":{"dev":"tsx src/index.ts","lint":"eslint src/**/*.ts","test":"vitest","build":"tsc","start":"node dist/index.js","lint:fix":"eslint src/**/*.ts --fix","test:cov":"vitest --coverage"},"_npmUser":{"name":"joao.barros.arvore","email":"joao.barros@arvore.com.br"},"repository":{"url":"git+https://github.com/arvoreeducacao/arvore-mcp-servers.git","type":"git","directory":"packages/mysql"},"_npmVersion":"10.8.2","description":"MySQL MCP Server for read-only database operations","directories":{},"_nodeVersion":"20.19.5","dependencies":{"zod":"^3.22.4","mysql2":"^3.6.5","@modelcontextprotocol/sdk":"^1.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/mysql-mcp_1.0.3_1761866217398_0.3285512461608693","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@arvoretech/mysql-mcp","version":"1.0.4","keywords":["mcp","mysql","database","llm","ai","arvore"],"author":{"name":"Arvore"},"license":"MIT","_id":"@arvoretech/mysql-mcp@1.0.4","maintainers":[{"name":"joao.barros.arvore","email":"joao.barros@arvore.com.br"}],"homepage":"https://github.com/arvoreeducacao/arvore-mcp-servers#readme","bugs":{"url":"https://github.com/arvoreeducacao/arvore-mcp-servers/issues"},"bin":{"mysql-mcp":"dist/index.js"},"dist":{"shasum":"20c18a1c488eed6295f5c5b843fb931b4c2658c0","tarball":"https://registry.npmjs.org/@arvoretech/mysql-mcp/-/mysql-mcp-1.0.4.tgz","fileCount":32,"integrity":"sha512-guv5LrDTVUSbl1GMBErgLofeTPSQEl4W6zUpXBnIoyYYfHuxXYJc3LLKe0i7jkRM49ptHwvv+LKzIozSEDKzXw==","signatures":[{"sig":"MEYCIQDp4JGlfdNBjRTFrQmeFUy/4MJvvWl7PPhr/AIc8UFgmwIhANxnCT2PZFRyN5GH3h24Qkq20T0krnIejUit2k8FxGVC","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":72682},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","gitHead":"db1ba069f2c6b9075ec771ddd8680ddbc1de7748","scripts":{"dev":"tsx src/index.ts","lint":"eslint src/**/*.ts","test":"vitest","build":"tsc","start":"node dist/index.js","lint:fix":"eslint src/**/*.ts --fix","test:cov":"vitest --coverage"},"_npmUser":{"name":"joao.barros.arvore","email":"joao.barros@arvore.com.br"},"repository":{"url":"git+https://github.com/arvoreeducacao/arvore-mcp-servers.git","type":"git","directory":"packages/mysql"},"_npmVersion":"10.8.2","description":"MySQL MCP Server for read-only database operations","directories":{},"_nodeVersion":"20.19.5","dependencies":{"zod":"^3.22.4","mysql2":"^3.6.5","@modelcontextprotocol/sdk":"^1.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/mysql-mcp_1.0.4_1761866499661_0.30268833620647184","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2025-10-30T22:08:19.088Z","modified":"2026-06-16T21:13:18.736Z","1.0.0":"2025-10-30T22:08:19.470Z","1.0.1":"2025-10-30T23:12:56.086Z","1.0.2":"2025-10-30T23:14:33.002Z","1.0.3":"2025-10-30T23:16:57.592Z","1.0.4":"2025-10-30T23:21:39.849Z"},"bugs":{"url":"https://github.com/arvoreeducacao/arvore-mcp-servers/issues"},"author":{"name":"Arvore"},"license":"MIT","homepage":"https://github.com/arvoreeducacao/arvore-mcp-servers#readme","keywords":["mcp","mysql","database","llm","ai","arvore"],"repository":{"url":"git+https://github.com/arvoreeducacao/arvore-mcp-servers.git","type":"git","directory":"packages/mysql"},"description":"MySQL MCP Server for read-only database operations","maintainers":[{"email":"joao.barros@arvore.com.br","name":"joao.barros.arvore"},{"email":"rafasouza@protonmail.com","name":"rafsouza"},{"email":"pedro.adas@gmail.com","name":"pedro.adas"},{"email":"guilhermebscontact@gmail.com","name":"guilhermebs"},{"email":"ricardorbxx1@gmail.com","name":"ricardoraposorfox"},{"email":"jvgcunha2002@gmail.com","name":"jott4"},{"email":"vitor.piovezan@arvore.com.br","name":"vitor.piovezan"}],"readme":"# MySQL MCP Server\n\n[![Install MCP Server](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=mysql-mcp&registry=https://npm.pkg.github.com&packageName=@arvoretech/mysql-mcp)\n\nA Model Context Protocol (MCP) server implementation for MySQL that enables read-only database operations through a standardized protocol for integration with LLMs and AI tools.\n\n## Features\n\n- ✅ **Read-only**: Executes only SELECT, SHOW, DESCRIBE and EXPLAIN queries\n- 🔒 **Secure**: Validates queries to prevent write operations\n- 🚀 **Fast**: Direct MySQL connection using mysql2\n- 📡 **MCP Protocol**: Communication via stdio transport\n- 🛠️ **TypeScript**: Fully typed with Zod validation\n- 🌍 **Environment Configuration**: Easy setup via environment variables\n\n## Installation\n\n```bash\nnpm install -g @arvoretech/mysql-mcp --registry=https://npm.pkg.github.com\n```\n\nOr configure your `.npmrc`:\n\n```bash\necho \"@arvoretech:registry=https://npm.pkg.github.com\" >> ~/.npmrc\nnpm install -g @arvoretech/mysql-mcp\n```\n\n## Configuration\n\nThe server is configured via environment variables:\n\n```bash\nexport MYSQL_HOST=localhost\nexport MYSQL_PORT=3306\nexport MYSQL_USER=root\nexport MYSQL_PASSWORD=secret\nexport MYSQL_DATABASE=mydb\nexport MYSQL_SSL=false\nexport MYSQL_CONNECTION_TIMEOUT=30000\n```\n\n## Usage\n\n```bash\n# Development\npnpm dev\n\n# Production\nnode dist/index.js\n```\n\n## Available MCP Tools\n\n### `read_query`\n\nExecutes SELECT queries on the MySQL database.\n\n**Parameters:**\n\n- `query` (string): SQL SELECT statement\n\n**Example:**\n\n```json\n{\n  \"query\": \"SELECT * FROM users LIMIT 10\"\n}\n```\n\n### `list_tables`\n\nLists all tables in the current database.\n\n**Parameters:** None\n\n### `describe_table`\n\nGets structure and schema information for a specific table.\n\n**Parameters:**\n\n- `tableName` (string): Name of the table\n\n### `show_databases`\n\nLists all available databases on the MySQL server.\n\n**Parameters:** None\n\n## Programmatic Usage\n\n```typescript\nimport { MySQLMCPServer } from \"mysql-mcp-server\";\n\nconst server = new MySQLMCPServer({\n  host: \"localhost\",\n  port: 3306,\n  user: \"root\",\n  password: \"secret\",\n  database: \"mydb\",\n  ssl: false,\n  connectionTimeout: 30000,\n});\n\n// Setup graceful shutdown\nserver.setupGracefulShutdown();\n\n// Start server\nawait server.start();\n```\n\n## Claude Desktop Integration\n\nAdd to your Claude Desktop configuration file (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):\n\n```json\n{\n  \"mcpServers\": {\n    \"mysql\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@arvoretech/mysql-mcp\"],\n      \"env\": {\n        \"MYSQL_HOST\": \"localhost\",\n        \"MYSQL_PORT\": \"3306\",\n        \"MYSQL_USER\": \"root\",\n        \"MYSQL_PASSWORD\": \"secret\",\n        \"MYSQL_DATABASE\": \"mydb\",\n        \"MYSQL_SSL\": \"false\",\n        \"MYSQL_CONNECTION_TIMEOUT\": \"30000\"\n      }\n    }\n  }\n}\n```\n\n## Security\n\n- **Query validation**: Only read operations are allowed\n- **Parameter escaping**: Uses prepared statements when possible\n- **Connection timeout**: Prevents hanging connections\n- **Error handling**: MySQL errors are caught and handled appropriately\n\n## Development\n\n```bash\n# Install dependencies\npnpm install\n\n# Run in development mode\npnpm dev\n\n# Build\npnpm build\n\n# Linting\npnpm lint\npnpm lint:fix\n```\n\n## Architecture\n\n- **`MySQLConnection`**: Manages MySQL connection\n- **`MySQLMCPTools`**: Implements MCP tools\n- **`MySQLMCPServer`**: Main MCP server with stdio transport\n- **Validation**: Uses Zod for type and parameter validation\n\n## Connection Management\n\nThe server uses a **connection-per-query** approach for optimal reliability:\n\n- **Fresh connections**: Each query opens and closes its own connection\n- **No persistent connections**: Prevents timeout and stale connection issues\n- **Automatic cleanup**: Connections are always properly closed after each operation\n- **Improved stability**: Eliminates bugs caused by long-running connections\n\n## Limitations\n\n- Read-only operations only (SELECT, SHOW, DESCRIBE, EXPLAIN)\n- Connection-per-query (no connection pooling)\n- MySQL only (not PostgreSQL, SQLite, etc.)\n- Stdio transport only (no HTTP/WebSocket)\n","readmeFilename":"README.md"}