{"_id":"@dhank77/mcp-universal-db","_rev":"3-7f7d673d13554e5756de9f35f2c9bea3","name":"@dhank77/mcp-universal-db","dist-tags":{"latest":"1.0.5"},"versions":{"1.0.1":{"name":"@dhank77/mcp-universal-db","version":"1.0.1","keywords":["mcp","database","mysql","postgresql"],"author":{"name":"M. Hamdani Ilham Latjoro"},"license":"MIT","_id":"@dhank77/mcp-universal-db@1.0.1","maintainers":[{"name":"dhank77","email":"d41113512@gmail.com"}],"homepage":"https://github.com/dhank77/mcp-universal-db#readme","bugs":{"url":"https://github.com/dhank77/mcp-universal-db/issues"},"dist":{"shasum":"110294d2fdecf1a060215257be9cca90d105821d","tarball":"https://registry.npmjs.org/@dhank77/mcp-universal-db/-/mcp-universal-db-1.0.1.tgz","fileCount":19,"integrity":"sha512-bIdmurtZgs3zilzSh7PtQr9Ia+8txzElAxjkluB3otkO9CVn/GKa87xmte4+t1b0g256ZhLFqSE110YBjUt9jg==","signatures":[{"sig":"MEUCIAN5wJv71q4tq71f1XlTMaH6nLkYTd1CDJnHwgOZfK6TAiEAucBUsix+cwDMLB9nGi9tHAoCP0DN7A7K5e07JzJ3N6Q=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":42514},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","gitHead":"1e160bfc1fef8ad342df81ff1afc94566771b414","scripts":{"dev":"tsx src/index.ts","test":"vitest","build":"tsc","start":"node dist/index.js","test:db":"vitest tests/db.test.ts","test:tools":"vitest tests/tools.test.ts","prepublishOnly":"npm run build"},"_npmUser":{"name":"dhank77","email":"d41113512@gmail.com"},"repository":{"url":"git+https://github.com/dhank77/mcp-universal-db.git","type":"git"},"_npmVersion":"10.9.2","description":"MCP universal database library","directories":{},"_nodeVersion":"22.17.1","dependencies":{"pg":"^8.13.1","dotenv":"^17.2.2","mysql2":"^3.11.4","@modelcontextprotocol/sdk":"^1.0.4"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","vitest":"^2.1.8","@types/pg":"^8.11.10","typescript":"^5.7.2","@types/node":"^22.10.2","@types/dotenv":"^6.1.1"},"_npmOperationalInternal":{"tmp":"tmp/mcp-universal-db_1.0.1_1756891108782_0.32093578530817","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@dhank77/mcp-universal-db","version":"1.0.3","keywords":["mcp","database","mysql","postgresql"],"author":{"name":"M. Hamdani Ilham Latjoro"},"license":"MIT","_id":"@dhank77/mcp-universal-db@1.0.3","maintainers":[{"name":"dhank77","email":"d41113512@gmail.com"}],"homepage":"https://github.com/dhank77/mcp-universal-db#readme","bugs":{"url":"https://github.com/dhank77/mcp-universal-db/issues"},"bin":{"mcp-universal-db":"dist/index.js"},"dist":{"shasum":"1e45f2cb520b6f9e1f86002255b7291ad3c60b2e","tarball":"https://registry.npmjs.org/@dhank77/mcp-universal-db/-/mcp-universal-db-1.0.3.tgz","fileCount":20,"integrity":"sha512-iXq2prlXDX9o70i6k5sCnSImTpXkpfLbxt+Gcu3JiV1uxs6fEhvL0A8X+L/LAhvo2cLVHj8DNSdzs3o+Tks9lQ==","signatures":[{"sig":"MEQCIHABgGTmrLVfYiEaavcXtAo0SnC+St1yUdvooYrZRzjSAiB62U1A8uqbJS0YVZpQUqY2AKtY12oG3PRtGz8MfhjdxQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":42832},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","gitHead":"04a9c1352323ef7e9be3912091ec7b7639d48db7","scripts":{"dev":"tsx src/index.ts","test":"vitest","build":"tsc && node scripts/add-shebang.js","start":"node dist/index.js","test:db":"vitest tests/db.test.ts","test:tools":"vitest tests/tools.test.ts","prepublishOnly":"npm run build"},"_npmUser":{"name":"dhank77","email":"d41113512@gmail.com"},"repository":{"url":"git+https://github.com/dhank77/mcp-universal-db.git","type":"git"},"_npmVersion":"10.9.2","description":"MCP universal database library","directories":{},"_nodeVersion":"22.17.1","dependencies":{"pg":"^8.13.1","dotenv":"^17.2.2","mysql2":"^3.11.4","@modelcontextprotocol/sdk":"^1.0.4"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","vitest":"^2.1.8","@types/pg":"^8.11.10","typescript":"^5.7.2","@types/node":"^22.10.2","@types/dotenv":"^6.1.1"},"_npmOperationalInternal":{"tmp":"tmp/mcp-universal-db_1.0.3_1756891509868_0.10520697465245266","host":"s3://npm-registry-packages-npm-production"}},"1.0.5":{"name":"@dhank77/mcp-universal-db","version":"1.0.5","description":"MCP universal database library","main":"dist/index.js","type":"module","scripts":{"build":"tsc && node scripts/add-shebang.js","prepublishOnly":"npm run build","start":"node dist/index.js","dev":"tsx src/index.ts","test":"vitest","test:db":"vitest tests/db.test.ts","test:tools":"vitest tests/tools.test.ts"},"bin":{"mcp-universal-db":"dist/index.js"},"types":"dist/index.d.ts","keywords":["mcp","database","mysql","postgresql"],"author":{"name":"M. Hamdani Ilham Latjoro"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/dhank77/mcp-universal-db.git"},"dependencies":{"@modelcontextprotocol/sdk":"^1.0.4","dotenv":"^17.2.2","mysql2":"^3.11.4","pg":"^8.13.1"},"devDependencies":{"@types/dotenv":"^6.1.1","@types/node":"^22.10.2","@types/pg":"^8.11.10","tsx":"^4.19.2","typescript":"^5.7.2","vitest":"^2.1.8"},"_id":"@dhank77/mcp-universal-db@1.0.5","gitHead":"9abad179d0259adae2b3690946bedcd4662a142c","bugs":{"url":"https://github.com/dhank77/mcp-universal-db/issues"},"homepage":"https://github.com/dhank77/mcp-universal-db#readme","_nodeVersion":"22.17.1","_npmVersion":"10.9.2","dist":{"integrity":"sha512-qUlGspUFgMa000hvj4iPXKnufQtOdNi1AWtQfP6D124GJlc8pgOld8NBnCNPCsJzrD+dxdrrwN3U8FTvjPySCw==","shasum":"661bb63b9003070d1e5ef3727b530f4b999bfd60","tarball":"https://registry.npmjs.org/@dhank77/mcp-universal-db/-/mcp-universal-db-1.0.5.tgz","fileCount":22,"unpackedSize":45107,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHyuZYdmsoKUi0POk1F4TU9n3VGaj+0vGvIXsoawANNHAiEA+vjs6V6wLp1M+aPEDWKv5thqbXUTAL7Hh1fjz8Pxvdc="}]},"_npmUser":{"name":"dhank77","email":"d41113512@gmail.com"},"directories":{},"maintainers":[{"name":"dhank77","email":"d41113512@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mcp-universal-db_1.0.5_1756894247422_0.8782596044115503"},"_hasShrinkwrap":false}},"time":{"created":"2025-09-03T09:18:28.666Z","modified":"2025-09-03T10:10:47.821Z","1.0.1":"2025-09-03T09:18:28.956Z","1.0.3":"2025-09-03T09:25:10.114Z","1.0.5":"2025-09-03T10:10:47.653Z"},"bugs":{"url":"https://github.com/dhank77/mcp-universal-db/issues"},"author":{"name":"M. Hamdani Ilham Latjoro"},"license":"MIT","homepage":"https://github.com/dhank77/mcp-universal-db#readme","keywords":["mcp","database","mysql","postgresql"],"repository":{"type":"git","url":"git+https://github.com/dhank77/mcp-universal-db.git"},"description":"MCP universal database library","maintainers":[{"name":"dhank77","email":"d41113512@gmail.com"}],"readme":"# MCP Universal Database Server\n\nA Model Context Protocol (MCP) server that provides universal database connectivity and operations. This server supports multiple database types and offers a comprehensive set of tools for database management.\n\n## Features\n\nThis MCP server provides the following tools for database operations:\n\n### 🔌 Connection Management\n- **connection**: Manage database connections with support for connect, disconnect, and status operations\n- Supports lazy connection initialization\n- Multi-database type support (MySQL, PostgreSQL, SQLite, etc.)\n\n### 📊 Data Operations\n\n#### Query Operations\n- **query**: Execute SELECT queries on the database\n  - Support for parameterized queries\n  - Safe SQL execution with prepared statements\n  - Flexible parameter binding\n\n#### CRUD Operations\n- **create**: Insert new records into tables\n  - Key-value pair data insertion\n  - Confirmation required for safety\n  \n- **update**: Update existing records in tables\n  - Conditional updates with WHERE clauses\n  - Key-value pair data updates\n  - Confirmation required for safety\n  \n- **delete**: Delete records from tables\n  - Conditional deletion with WHERE clauses\n  - Confirmation required for safety\n\n#### Schema Operations\n- **readSchema**: Read database schema information\n  - Get schema for specific tables or all tables\n  - Comprehensive table structure information\n\n## Configuration\n\nThe server supports multiple configuration formats through environment variables. Create a `.env` file based on the provided `.env.example`:\n\n### Format 1: DSN Direct\n```env\nDATABASE_URL=mysql://user:pass@localhost:3306/mydb\nSUPABASE_DB_URL=postgres://user:pass@db.supabase.co:5432/postgres\n```\n\n### Format 2: Laravel Style\n```env\nDB_CONNECTION=mysql\nDB_HOST=localhost\nDB_PORT=3306\nDB_DATABASE=laravel_db\nDB_USERNAME=laravel_user\nDB_PASSWORD=secret\n```\n\n### Format 3: WordPress Style\n```env\nDB_NAME=wordpress\nDB_USER=wp_user\nDB_PASS=wp_password\nDB_HOST=localhost\nDB_PORT=3306\n```\n\n### Format 4: Multi Database with Prefix\n```env\nDB1_CONNECTION=mysql\nDB1_HOST=localhost\nDB1_PORT=3306\nDB1_DATABASE=app1_db\nDB1_USERNAME=app1_user\nDB1_PASSWORD=app1_pass\n\nDB2_CONNECTION=postgres\nDB2_HOST=localhost\nDB2_PORT=5432\nDB2_DATABASE=app2_db\nDB2_USERNAME=app2_user\nDB2_PASSWORD=app2_pass\n```\n\n### Format 5: Docker Style\n```env\nMYSQL_HOST=localhost\nMYSQL_PORT=3306\nMYSQL_DATABASE=docker_mysql\nMYSQL_USER=mysql_user\nMYSQL_PASSWORD=mysql_pass\n\nPOSTGRES_HOST=localhost\nPOSTGRES_PORT=5432\nPOSTGRES_DB=docker_postgres\nPOSTGRES_USER=postgres_user\nPOSTGRES_PASSWORD=postgres_pass\n```\n\n### Format 6: Django Style\n```env\nDJANGO_DB_ENGINE=django.db.backends.postgresql\nDJANGO_DB_HOST=localhost\nDJANGO_DB_PORT=5432\nDJANGO_DB_NAME=django_db\nDJANGO_DB_USER=django_user\nDJANGO_DB_PASSWORD=django_pass\n```\n\n## MCP Client Configuration\n\nTo connect to this MCP server from an MCP-compatible client, add the following configuration:\n\n```json\n{\n  \"mcpServers\": {\n    \"dbmcp\": {\n      \"command\": \"npx\",\n      \"args\": [\n        \"-y\",\n        \"@dhank77/mcp-universal-db\",\n        \"--transport\",\n        \"stdio\"\n      ],\n      \"env\": {\n        \"DOTENV_CONFIG_PATH\": \"./.env\"\n      }\n    }\n  }\n}\n```\n\nMake sure your `.env` file is in the same directory as your MCP client configuration.\n\n## Installation\n\n1. Clone the repository\n2. Install dependencies:\n   ```bash\n   npm install\n   ```\n3. Build the project:\n   ```bash\n   npm run build\n   ```\n4. Configure your database connection in `.env` file\n5. Start the server:\n   ```bash\n   npm start\n   ```\n\n## Usage\n\nThis server is designed to work with MCP-compatible clients. The server communicates via stdio transport and provides all database operations through the MCP protocol.\n\n### Example Tool Calls\n\n#### Check Connection Status\n```json\n{\n  \"tool\": \"connection\",\n  \"params\": {\n    \"action\": \"status\"\n  }\n}\n```\n\n#### Execute a Query\n```json\n{\n  \"tool\": \"query\",\n  \"params\": {\n    \"sql\": \"SELECT * FROM users WHERE age > ?\",\n    \"params\": [18]\n  }\n}\n```\n\n#### Insert a Record\n```json\n{\n  \"tool\": \"create\",\n  \"params\": {\n    \"table\": \"users\",\n    \"data\": {\n      \"name\": \"John Doe\",\n      \"email\": \"john@example.com\",\n      \"age\": 25\n    },\n    \"confirm\": true\n  }\n}\n```\n\n#### Update Records\n```json\n{\n  \"tool\": \"update\",\n  \"params\": {\n    \"table\": \"users\",\n    \"data\": {\n      \"age\": 26\n    },\n    \"where\": {\n      \"id\": 1\n    },\n    \"confirm\": true\n  }\n}\n```\n\n#### Delete Records\n```json\n{\n  \"tool\": \"delete\",\n  \"params\": {\n    \"table\": \"users\",\n    \"where\": {\n      \"id\": 1\n    },\n    \"confirm\": true\n  }\n}\n```\n\n#### Read Schema\n```json\n{\n  \"tool\": \"readSchema\",\n  \"params\": {\n    \"table\": \"users\"\n  }\n}\n```\n\n## Safety Features\n\n- **Confirmation Required**: All destructive operations (create, update, delete) require explicit confirmation\n- **Parameterized Queries**: Support for prepared statements to prevent SQL injection\n- **Connection Management**: Proper connection lifecycle management\n- **Error Handling**: Comprehensive error handling and reporting\n\n## Supported Databases\n\n- MySQL\n- PostgreSQL\n- SQLite\n- And other databases supported by the underlying connection libraries\n\n## Development\n\n### Build\n```bash\nnpm run build\n```\n\n### Test\n```bash\nnpm test\n```\n\n### Development Mode\n```bash\nnpm run dev\n```\n\n## License\n\nMIT License","readmeFilename":"README.md"}