{"_id":"@adversity/mcp-database","_rev":"6-9ac2acc89016cb3a40669bc620ed59c6","name":"@adversity/mcp-database","dist-tags":{"latest":"0.3.1"},"versions":{"0.1.0":{"name":"@adversity/mcp-database","version":"0.1.0","keywords":["mcp","model-context-protocol","database","postgres","mysql","mongodb","sqlite","sql","ai","llm","agent"],"author":"","license":"MIT","_id":"@adversity/mcp-database@0.1.0","maintainers":[{"name":"adversity","email":"zhangzeao50@gmail.com"}],"homepage":"https://github.com/ZeaoZhang/databse-mcp#readme","bugs":{"url":"https://github.com/ZeaoZhang/databse-mcp/issues"},"bin":{"mcp-database":"dist/bin/cli.js"},"dist":{"shasum":"39f0d2e89de62fdb812483ef29adfa3ffe6dbfa9","tarball":"https://registry.npmjs.org/@adversity/mcp-database/-/mcp-database-0.1.0.tgz","fileCount":9,"integrity":"sha512-LYCJvbQNCJONFMx5tcdn5IzrSc6avvnCvtxodrpvPiIc7a3OUzOYQHD8KWdgcz52l/xKPgG1p77ebugFotgFiw==","signatures":[{"sig":"MEUCIGtVwxh9JfKXnLn3w4uIm8O6Bqr/ZOxfJCao7bZixkn5AiEAoP/mLoFGYS6jsz+x2WuBU0a947KYjp36sbOA1ZkygFE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":149136},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","module":"dist/index.js","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"85329454a8d19cfd0e8f7065ffe73d630a4f7657","scripts":{"dev":"tsup --watch","lint":"eslint src --ext .ts","test":"vitest","build":"tsup","format":"prettier --write \"src/**/*.ts\"","prepare":"npm run build","typecheck":"tsc --noEmit","format:check":"prettier --check \"src/**/*.ts\"","test:coverage":"vitest --coverage","prepublishOnly":"npm run test && npm run build","publish:packages":"./scripts/publish-packages.sh","download:binaries":"./scripts/download-binaries.sh"},"_npmUser":{"name":"adversity","email":"zhangzeao50@gmail.com"},"repository":{"url":"git+https://github.com/ZeaoZhang/databse-mcp.git","type":"git"},"_npmVersion":"11.6.2","description":"MCP server for database operations with support for 40+ databases via genai-toolbox","directories":{},"_nodeVersion":"24.11.1","dependencies":{"zod":"^3.24.1","yaml":"^2.6.1","@modelcontextprotocol/sdk":"^1.0.4"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.5","eslint":"^9.17.0","vitest":"^2.1.8","prettier":"^3.4.2","typescript":"^5.7.2","@types/node":"^20.17.9","@typescript-eslint/parser":"^8.18.1","@typescript-eslint/eslint-plugin":"^8.18.1"},"optionalDependencies":{"@adversity/mcp-database-linux-x64":"0.1.0","@adversity/mcp-database-win32-x64":"0.1.0","@adversity/mcp-database-darwin-x64":"0.1.0","@adversity/mcp-database-darwin-arm64":"0.1.0"},"_npmOperationalInternal":{"tmp":"tmp/mcp-database_0.1.0_1764177655684_0.03373731535299962","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@adversity/mcp-database","version":"0.1.1","keywords":["mcp","model-context-protocol","database","postgres","mysql","mongodb","sqlite","sql","ai","llm","agent"],"author":"","license":"MIT","_id":"@adversity/mcp-database@0.1.1","maintainers":[{"name":"adversity","email":"zhangzeao50@gmail.com"}],"homepage":"https://github.com/ZeaoZhang/databse-mcp#readme","bugs":{"url":"https://github.com/ZeaoZhang/databse-mcp/issues"},"bin":{"mcp-database":"dist/bin/cli.js"},"dist":{"shasum":"2a3e188e84967f9f568333a3b2414dcc89998194","tarball":"https://registry.npmjs.org/@adversity/mcp-database/-/mcp-database-0.1.1.tgz","fileCount":9,"integrity":"sha512-wqK/vwGnc3D2v0BqJuLqatS12B4FDH+gUGG/X5S/M9clzYB5td4nC8ND4ILQ+AcC0g/TakW16z+C0xrNYG8KdQ==","signatures":[{"sig":"MEUCIQDFNZpUN2EXfq+fFtcfZdskr1D7A29vf8Nrjcuki9f5RgIgWU6RTkQDAKC+e9UOVF+vL7GYlpKtg+4tt0h2J/iWPy0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":149288},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","module":"dist/index.js","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"881554e0233a6250f69679cdbf2dd63f36abe787","scripts":{"dev":"tsup --watch","lint":"eslint src --ext .ts","test":"vitest","build":"tsup","format":"prettier --write \"src/**/*.ts\"","prepare":"npm run build","typecheck":"tsc --noEmit","format:check":"prettier --check \"src/**/*.ts\"","test:coverage":"vitest --coverage","prepublishOnly":"npm run test && npm run build","publish:packages":"./scripts/publish-packages.sh","download:binaries":"./scripts/download-binaries.sh"},"_npmUser":{"name":"adversity","email":"zhangzeao50@gmail.com"},"repository":{"url":"git+https://github.com/ZeaoZhang/databse-mcp.git","type":"git"},"_npmVersion":"11.6.2","description":"MCP server for database operations with support for 40+ databases via genai-toolbox","directories":{},"_nodeVersion":"24.11.1","dependencies":{"zod":"^3.24.1","yaml":"^2.6.1","@modelcontextprotocol/sdk":"^1.0.4"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.5","eslint":"^9.17.0","vitest":"^2.1.8","prettier":"^3.4.2","typescript":"^5.7.2","@types/node":"^20.17.9","@typescript-eslint/parser":"^8.18.1","@typescript-eslint/eslint-plugin":"^8.18.1"},"optionalDependencies":{"@adversity/mcp-database-linux-x64":"0.1.0","@adversity/mcp-database-win32-x64":"0.1.0","@adversity/mcp-database-darwin-x64":"0.1.0","@adversity/mcp-database-darwin-arm64":"0.1.0"},"_npmOperationalInternal":{"tmp":"tmp/mcp-database_0.1.1_1764178980379_0.5868090693673005","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@adversity/mcp-database","version":"0.2.0","keywords":["mcp","model-context-protocol","database","postgres","mysql","mongodb","sqlite","sql","ai","llm","agent"],"author":"","license":"MIT","_id":"@adversity/mcp-database@0.2.0","maintainers":[{"name":"adversity","email":"zhangzeao50@gmail.com"}],"homepage":"https://github.com/ZeaoZhang/databse-mcp#readme","bugs":{"url":"https://github.com/ZeaoZhang/databse-mcp/issues"},"bin":{"mcp-database":"dist/bin/cli.js"},"dist":{"shasum":"c8f6242b70ec43dc45fcc462f5cd92b5ca84231d","tarball":"https://registry.npmjs.org/@adversity/mcp-database/-/mcp-database-0.2.0.tgz","fileCount":9,"integrity":"sha512-6V6dKCUdED3uZQAdRSMNUG2K6Y8EvXsUe0wRryTWUV10XTGVxxbT6Q2UxgLYrdnNHOdcbbboC81TrAt5QNz+DQ==","signatures":[{"sig":"MEUCIQDq2uboxkeUNSfLcX9mWB+nbyse7AWx2T9v4oFxHMOJWgIgVHqsRTEN83fewnDs0iWNBJ0aJbj/IpGRkPCx677rhyw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":172148},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","module":"dist/index.js","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"53368d2c843801395f24bc4f6af7685e0305168c","scripts":{"dev":"tsup --watch","lint":"eslint src --ext .ts","test":"vitest","build":"tsup","format":"prettier --write \"src/**/*.ts\"","prepare":"npm run build","typecheck":"tsc --noEmit","format:check":"prettier --check \"src/**/*.ts\"","test:coverage":"vitest --coverage","prepublishOnly":"npm run test && npm run build","publish:packages":"./scripts/publish-packages.sh","download:binaries":"./scripts/download-binaries.sh"},"_npmUser":{"name":"adversity","email":"zhangzeao50@gmail.com"},"repository":{"url":"git+https://github.com/ZeaoZhang/databse-mcp.git","type":"git"},"_npmVersion":"11.6.2","description":"MCP server for database operations with support for 40+ databases via genai-toolbox","directories":{},"_nodeVersion":"24.11.1","dependencies":{"zod":"^3.24.1","yaml":"^2.6.1","@modelcontextprotocol/sdk":"^1.0.4"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.5","eslint":"^9.17.0","vitest":"^2.1.8","prettier":"^3.4.2","typescript":"^5.7.2","@types/node":"^20.17.9","@typescript-eslint/parser":"^8.18.1","@typescript-eslint/eslint-plugin":"^8.18.1"},"optionalDependencies":{"@adversity/mcp-database-linux-x64":"0.2.0","@adversity/mcp-database-win32-x64":"0.2.0","@adversity/mcp-database-darwin-x64":"0.2.0","@adversity/mcp-database-darwin-arm64":"0.2.0"},"_npmOperationalInternal":{"tmp":"tmp/mcp-database_0.2.0_1764576045844_0.16354999178923135","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@adversity/mcp-database","version":"0.2.1","keywords":["mcp","model-context-protocol","database","postgres","mysql","mongodb","sqlite","sql","ai","llm","agent"],"author":"","license":"MIT","_id":"@adversity/mcp-database@0.2.1","maintainers":[{"name":"adversity","email":"zhangzeao50@gmail.com"}],"homepage":"https://github.com/ZeaoZhang/databse-mcp#readme","bugs":{"url":"https://github.com/ZeaoZhang/databse-mcp/issues"},"bin":{"mcp-database":"dist/bin/cli.js"},"dist":{"shasum":"bed4da637fb84650fca6c8bf552f30d23772826f","tarball":"https://registry.npmjs.org/@adversity/mcp-database/-/mcp-database-0.2.1.tgz","fileCount":9,"integrity":"sha512-CmDHiaxQ5H1ka0r4Tpcwg32H1KoWzOcDEjENazQPCwZJ5TFmWqxL6uxpl6JU/0Z3Hhh+3YZiSbVwYjmd5porog==","signatures":[{"sig":"MEUCIQCP7shq0SGGG0HnTe6SM/8KBi+E1w8oqYg6x3MP1NpwOgIgGFppKdnGvaWZvo0dHQu+GiQu94IBpQ+jihmOSeu92gE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":171829},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","module":"dist/index.js","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"cc06b47495049a6cb857ee131e6e55faf199b9b2","scripts":{"dev":"tsup --watch","lint":"eslint src --ext .ts","test":"vitest","build":"tsup","format":"prettier --write \"src/**/*.ts\"","prepare":"npm run build","typecheck":"tsc --noEmit","format:check":"prettier --check \"src/**/*.ts\"","test:coverage":"vitest --coverage","prepublishOnly":"npm run test && npm run build","publish:packages":"./scripts/publish-packages.sh","download:binaries":"./scripts/download-binaries.sh"},"_npmUser":{"name":"adversity","email":"zhangzeao50@gmail.com"},"repository":{"url":"git+https://github.com/ZeaoZhang/databse-mcp.git","type":"git"},"_npmVersion":"11.6.2","description":"MCP server for database operations with support for 40+ databases via genai-toolbox","directories":{},"_nodeVersion":"24.11.1","dependencies":{"zod":"^3.24.1","yaml":"^2.6.1","@modelcontextprotocol/sdk":"^1.0.4"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.5","eslint":"^9.17.0","vitest":"^2.1.8","prettier":"^3.4.2","typescript":"^5.7.2","@types/node":"^20.17.9","@typescript-eslint/parser":"^8.18.1","@typescript-eslint/eslint-plugin":"^8.18.1"},"optionalDependencies":{"@adversity/mcp-database-linux-x64":"0.2.1","@adversity/mcp-database-win32-x64":"0.2.1","@adversity/mcp-database-darwin-x64":"0.2.1","@adversity/mcp-database-darwin-arm64":"0.2.1"},"_npmOperationalInternal":{"tmp":"tmp/mcp-database_0.2.1_1764643820940_0.5151070167327965","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@adversity/mcp-database","version":"0.3.0","keywords":["mcp","model-context-protocol","database","postgres","mysql","mongodb","sqlite","sql","ai","llm","agent"],"author":"","license":"MIT","_id":"@adversity/mcp-database@0.3.0","maintainers":[{"name":"adversity","email":"zhangzeao50@gmail.com"}],"homepage":"https://github.com/ZeaoZhang/databse-mcp#readme","bugs":{"url":"https://github.com/ZeaoZhang/databse-mcp/issues"},"bin":{"mcp-database":"dist/bin/cli.js"},"dist":{"shasum":"680db6dc7d65eb18b26b7f600da1eef2a8628a0a","tarball":"https://registry.npmjs.org/@adversity/mcp-database/-/mcp-database-0.3.0.tgz","fileCount":9,"integrity":"sha512-wOAjVI8PNdPjBSkYpjrSK6exh+tM4ZP33FPfMDRdqVXCfyvPFxE0lD59jOY7vbqzoQBc7h/MsCmJpq6eMMM3Xg==","signatures":[{"sig":"MEQCIERg2NOL+scKNjYMPeL5ms5btIzFLTwf7fgMLEb7QNsaAiAEEONI5nkE7158J7mpORRn++AVyNTH8Of6lz+UoyyIlg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":321106},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","module":"dist/index.js","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"cc06b47495049a6cb857ee131e6e55faf199b9b2","scripts":{"dev":"tsup --watch","lint":"eslint src --ext .ts","test":"vitest","build":"tsup","format":"prettier --write \"src/**/*.ts\"","prepare":"npm run build","typecheck":"tsc --noEmit","format:check":"prettier --check \"src/**/*.ts\"","test:coverage":"vitest --coverage","prepublishOnly":"npm run test && npm run build","publish:packages":"./scripts/publish-packages.sh","download:binaries":"./scripts/download-binaries.sh"},"_npmUser":{"name":"adversity","email":"zhangzeao50@gmail.com"},"repository":{"url":"git+https://github.com/ZeaoZhang/databse-mcp.git","type":"git"},"_npmVersion":"11.6.2","description":"MCP server for database operations with support for 40+ databases via genai-toolbox","directories":{},"_nodeVersion":"24.11.1","dependencies":{"zod":"^3.24.1","yaml":"^2.6.1","@modelcontextprotocol/sdk":"^1.0.4"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.5","eslint":"^9.17.0","vitest":"^2.1.8","prettier":"^3.4.2","typescript":"^5.7.2","@types/node":"^20.17.9","@typescript-eslint/parser":"^8.18.1","@typescript-eslint/eslint-plugin":"^8.18.1"},"optionalDependencies":{"@adversity/mcp-database-linux-x64":"0.3.0","@adversity/mcp-database-win32-x64":"0.3.0","@adversity/mcp-database-darwin-x64":"0.3.0","@adversity/mcp-database-darwin-arm64":"0.3.0"},"_npmOperationalInternal":{"tmp":"tmp/mcp-database_0.3.0_1764686145538_0.24764287698541176","host":"s3://npm-registry-packages-npm-production"}},"0.3.1":{"name":"@adversity/mcp-database","version":"0.3.1","description":"MCP server for database operations with support for 40+ databases via genai-toolbox","main":"dist/index.js","module":"dist/index.js","types":"dist/index.d.ts","type":"module","bin":{"mcp-database":"dist/bin/cli.js"},"exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"}},"scripts":{"build":"tsup","dev":"tsup --watch","test":"vitest","test:coverage":"vitest --coverage","lint":"eslint src","format":"prettier --write \"src/**/*.ts\"","format:check":"prettier --check \"src/**/*.ts\"","typecheck":"tsc --noEmit","prepare":"npm run build","prepublishOnly":"npm run test && npm run build","download:binaries":"./scripts/download-binaries.sh","publish:packages":"./scripts/publish-packages.sh"},"keywords":["mcp","model-context-protocol","database","postgres","mysql","mongodb","sqlite","sql","ai","llm","agent"],"author":"","license":"MIT","repository":{"type":"git","url":"git+https://github.com/ZeaoZhang/databse-mcp.git"},"bugs":{"url":"https://github.com/ZeaoZhang/databse-mcp/issues"},"homepage":"https://github.com/ZeaoZhang/databse-mcp#readme","engines":{"node":">=18.0.0"},"optionalDependencies":{"@adversity/mcp-database-darwin-arm64":"0.3.1","@adversity/mcp-database-darwin-x64":"0.3.1","@adversity/mcp-database-linux-x64":"0.3.1","@adversity/mcp-database-win32-x64":"0.3.1"},"dependencies":{"@modelcontextprotocol/sdk":"^1.0.4","yaml":"^2.6.1","zod":"^3.24.1"},"devDependencies":{"@eslint/js":"^9.39.1","@types/node":"^20.17.9","@typescript-eslint/eslint-plugin":"^8.18.1","@typescript-eslint/parser":"^8.18.1","eslint":"^9.17.0","prettier":"^3.4.2","tsup":"^8.3.5","typescript":"^5.7.2","typescript-eslint":"^8.48.1","vitest":"^4.0.15"},"gitHead":"cc06b47495049a6cb857ee131e6e55faf199b9b2","_id":"@adversity/mcp-database@0.3.1","_nodeVersion":"24.11.1","_npmVersion":"11.6.2","dist":{"integrity":"sha512-8HSVmH/Zan/2v2JpE9UTSZiuAFoWXZkiSEDA0XEMXvQfYC/4Wzt56y/Ljt2qEH0Vz0X1lliAkzTtJyRT0evdUA==","shasum":"6d469664e0e2264c25292368a7d8a97f1459489d","tarball":"https://registry.npmjs.org/@adversity/mcp-database/-/mcp-database-0.3.1.tgz","fileCount":9,"unpackedSize":313631,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIDmT3G8YePQfK6qK5TduNjyHyrykDrzCiKF6CzNxGaHKAiBS/Y7eUyCRj5CImxSpqg+RqvuH55SFppG463JCbzFxgA=="}]},"_npmUser":{"name":"adversity","email":"zhangzeao50@gmail.com"},"directories":{},"maintainers":[{"name":"adversity","email":"zhangzeao50@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mcp-database_0.3.1_1764914977955_0.8376608445132252"},"_hasShrinkwrap":false}},"time":{"created":"2025-11-26T17:20:55.553Z","modified":"2025-12-05T06:09:38.304Z","0.1.0":"2025-11-26T17:20:55.896Z","0.1.1":"2025-11-26T17:43:00.601Z","0.2.0":"2025-12-01T08:00:46.027Z","0.2.1":"2025-12-02T02:50:21.170Z","0.3.0":"2025-12-02T14:35:45.756Z","0.3.1":"2025-12-05T06:09:38.133Z"},"bugs":{"url":"https://github.com/ZeaoZhang/databse-mcp/issues"},"license":"MIT","homepage":"https://github.com/ZeaoZhang/databse-mcp#readme","keywords":["mcp","model-context-protocol","database","postgres","mysql","mongodb","sqlite","sql","ai","llm","agent"],"repository":{"type":"git","url":"git+https://github.com/ZeaoZhang/databse-mcp.git"},"description":"MCP server for database operations with support for 40+ databases via genai-toolbox","maintainers":[{"name":"adversity","email":"zhangzeao50@gmail.com"}],"readme":"# mcp-database\n\nA Node.js MCP (Model Context Protocol) server that provides database operations for AI assistants and agents. Supports 40+ databases through [genai-toolbox](https://github.com/googleapis/genai-toolbox).\n\n## Features\n\n- ✅ **Easy Installation**: Install via npm/npx - no manual binary downloads\n- ✅ **Universal Database Support**: PostgreSQL, MySQL, MongoDB, Redis, SQLite, and 35+ more\n- ✅ **Simple Configuration**: YAML config or environment variables\n- ✅ **MCP Standard**: Full MCP protocol implementation\n- ✅ **Production Ready**: Connection pooling, auth, and observability built-in\n\n## Installation\n\nInstall from npm and pick the bundle that fits your environment:\n\n- Core package (no bundled binaries, ~50KB): `npm install -g @adversity/mcp-database`\n- Platform-specific (includes binary for one OS/CPU, ~15MB):\n  - macOS ARM64: `npm install -g @adversity/mcp-database-darwin-arm64`\n  - macOS Intel: `npm install -g @adversity/mcp-database-darwin-x64`\n  - Linux x64: `npm install -g @adversity/mcp-database-linux-x64`\n  - Windows x64: `npm install -g @adversity/mcp-database-win32-x64`\n- No install: `npx @adversity/mcp-database --help`\n\n## Quick Start\n\n### Using Prebuilt Configurations\n\nThe easiest way to get started is with prebuilt database configurations:\n\n```bash\n# PostgreSQL\nDATABASE_HOST=localhost \\\nDATABASE_NAME=mydb \\\nDATABASE_USER=user \\\nDATABASE_PASSWORD=password \\\nnpx @adversity/mcp-database --prebuilt postgres\n\n# MySQL\nDATABASE_HOST=localhost \\\nDATABASE_NAME=mydb \\\nDATABASE_USER=root \\\nDATABASE_PASSWORD=password \\\nnpx @adversity/mcp-database --prebuilt mysql\n\n# SQLite (no credentials needed)\nDATABASE_NAME=./my-database.db \\\nnpx @adversity/mcp-database --prebuilt sqlite\n\n# MongoDB\nDATABASE_HOST=localhost \\\nDATABASE_NAME=mydb \\\nDATABASE_USER=user \\\nDATABASE_PASSWORD=password \\\nnpx @adversity/mcp-database --prebuilt mongodb\n```\n\n### Using Custom Configuration\n\nCreate a `tools.yaml` file:\n\n```yaml\nsources:\n  my-postgres:\n    kind: postgres\n    host: ${POSTGRES_HOST:localhost}\n    port: ${POSTGRES_PORT:5432}\n    database: ${POSTGRES_DATABASE:mydb}\n    user: ${POSTGRES_USER:postgres}\n    password: ${POSTGRES_PASSWORD}\n\ntools:\n  get_user_by_id:\n    kind: postgres-sql\n    source: my-postgres\n    description: Get user by ID\n    parameters:\n      - name: user_id\n        type: number\n        description: The user ID\n    statement: SELECT * FROM users WHERE id = $1;\n```\n\nRun with custom config:\n\n```bash\nmcp-database --config tools.yaml\n```\n\n### SQLite Built-in Introspection Tools (Recommended for AI)\n\nDesigned for AI to explore unknown databases without schema knowledge:\n\n```bash\nDATABASE_NAME=./your-database.db \\\nnpx @adversity/mcp-database --config prebuilt/sqlite-introspection.yaml\n```\n\n**15 Built-in Introspection Tools:**\n\n| Tool Set | Tool Name | Function |\n|----------|-----------|----------|\n| **Basic Exploration** | `sqlite_list_tables` | List all tables and views |\n| | `sqlite_describe_table` | View table structure (columns, types, keys) |\n| | `sqlite_list_columns` | List all column information |\n| | `sqlite_preview_table` | Preview first N rows of data |\n| | `sqlite_database_summary` | Complete database summary (tables, indexes, views) |\n| **Advanced Analysis** | `sqlite_list_indexes` | List all indexes |\n| | `sqlite_list_table_indexes` | View indexes for a specific table |\n| | `sqlite_describe_index` | View columns in an index |\n| | `sqlite_list_foreign_keys` | View foreign key relationships |\n| | `sqlite_get_table_schema` | Get table's CREATE statement |\n| **Statistics** | `sqlite_count_rows` | Count total rows in a table |\n| | `sqlite_table_stats` | Get statistics for all tables |\n| | `sqlite_database_info` | Database basic information |\n| | `sqlite_get_schema_version` | Get schema version number |\n\n**Typical AI Workflow:**\n```\n1. sqlite_list_tables → Discover users, orders, products tables\n2. sqlite_describe_table(\"users\") → Understand column structure\n3. sqlite_preview_table(\"users\", 5) → See actual data format\n4. sqlite_list_foreign_keys(\"orders\") → Understand table relationships\n5. Now AI can confidently construct complex queries!\n```\n\n**MCP Client Configuration Example:**\n```json\n{\n  \"mcpServers\": {\n    \"database\": {\n      \"command\": \"npx\",\n      \"args\": [\"@adversity/mcp-database\", \"--config\", \"prebuilt/sqlite-introspection.yaml\"],\n      \"env\": {\n        \"DATABASE_NAME\": \"./your-database.db\"\n      }\n    }\n  }\n}\n```\n\n### SQLite Custom YAML Example\n\n1. Copy the example: `cp tools.example.yaml tools.yaml`\n2. Verify sample database exists: `ls sample.sqlite`\n3. Run:\n   ```bash\n   DATABASE_NAME=$(pwd)/sample.sqlite \\\n   npx @adversity/mcp-database --config tools.yaml --verbose\n   ```\n4. The MCP client can access `sqlite_crud` toolset from `tools.example.yaml`:\n   - `sqlite_list_recent_users`: List recent 20 user records\n   - `sqlite_get_user_by_id`: Query by ID\n   - `sqlite_find_user_by_email`: Search by email\n   - `sqlite_create_user` / `sqlite_update_user_email` / `sqlite_delete_user`: Create/Update/Delete\n\nExample YAML snippet (from `tools.example.yaml`):\n\n```yaml\ntools:\n  sqlite_list_recent_users:\n    kind: sqlite-sql\n    source: my-sqlite\n    description: List recent 20 users ordered by creation time\n    statement: |\n      SELECT id, name, email, created_at\n      FROM users\n      ORDER BY datetime(created_at) DESC\n      LIMIT 20;\n\n  sqlite_create_user:\n    kind: sqlite-sql\n    source: my-sqlite\n    description: Create new user and return result\n    parameters:\n      - { name: name, type: string }\n      - { name: email, type: string }\n    statement: |\n      INSERT INTO users (name, email, created_at)\n      VALUES (?1, ?2, CURRENT_TIMESTAMP)\n      RETURNING id, name, email, created_at;\n\ntoolsets:\n  sqlite_crud:\n    - sqlite_list_recent_users\n    - sqlite_get_user_by_id\n    - sqlite_find_user_by_email\n    - sqlite_create_user\n    - sqlite_update_user_email\n    - sqlite_delete_user\n```\n\n### Unified Environment Variables and CLI Override\n\nAll prebuilt databases use simple, unified environment variables:\n\n- `DATABASE_HOST` - Database host (default: localhost)\n- `DATABASE_PORT` - Database port (default: depends on database type)\n- `DATABASE_NAME` - Database name\n- `DATABASE_USER` - Database user\n- `DATABASE_PASSWORD` - Database password\n\nYou can also override via CLI:\n\n```bash\nmcp-database --prebuilt postgres \\\n  --db-host prod-db.internal \\\n  --db-port 6543 \\\n  --db-name inventory \\\n  --db-user readonly\n```\n\n### 自定义 toolbox 端口\n\n默认使用 STDIO 模式，不占用 TCP 端口；当需要切换到 HTTP（例如调试或远程访问）时，可指定传输方式与端口：\n\n```bash\nnpx @adversity/mcp-database --prebuilt sqlite \\\n  --transport http \\\n  --toolbox-host 0.0.0.0 \\\n  --toolbox-port 5900\n```\n\n对应环境变量：\n\n| 变量 | 说明 |\n| --- | --- |\n| `MCP_TOOLBOX_TRANSPORT` | `stdio`（默认）或 `http` |\n| `MCP_TOOLBOX_HOST` | HTTP 监听地址，默认 `127.0.0.1` |\n| `MCP_TOOLBOX_PORT` | HTTP 端口，默认 `5000` |\n\nCLI 也保留 `--stdio`（布尔）用于兼容旧脚本；推荐使用 `--transport` 来切换模式。\n\n## MCP Integration\n\n### Claude Code / Claude Desktop\n\nAdd to your `.mcp.json` or `claude_desktop_config.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"database\": {\n      \"command\": \"npx\",\n      \"args\": [\"@adversity/mcp-database\", \"--prebuilt\", \"postgres\"],\n      \"env\": {\n        \"DATABASE_HOST\": \"localhost\",\n        \"DATABASE_PORT\": \"5432\",\n        \"DATABASE_NAME\": \"mydb\",\n        \"DATABASE_USER\": \"postgres\",\n        \"DATABASE_PASSWORD\": \"your-password\"\n      }\n    }\n  }\n}\n```\n\n### Cursor IDE\n\nCreate `.cursor/mcp.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"database\": {\n      \"command\": \"npx\",\n      \"args\": [\"@adversity/mcp-database\", \"--prebuilt\", \"mysql\"],\n      \"env\": {\n        \"DATABASE_HOST\": \"localhost\",\n        \"DATABASE_NAME\": \"mydb\",\n        \"DATABASE_USER\": \"root\",\n        \"DATABASE_PASSWORD\": \"your-password\"\n      }\n    }\n  }\n}\n```\n\n### VS Code (Copilot)\n\nCreate `.vscode/mcp.json`:\n\n```json\n{\n  \"servers\": {\n    \"database\": {\n      \"command\": \"npx\",\n      \"args\": [\"@adversity/mcp-database\", \"--prebuilt\", \"postgres\"],\n      \"env\": {\n        \"DATABASE_HOST\": \"localhost\",\n        \"DATABASE_NAME\": \"mydb\"\n      }\n    }\n  }\n}\n```\n\n### Windsurf\n\nConfigure via the Cascade assistant's MCP settings with the same JSON format as Cursor.\n\n## Supported Databases\n\n### Relational Databases\n- PostgreSQL\n- MySQL\n- SQL Server\n- SQLite\n- Oracle\n- Cloud SQL (Postgres, MySQL, SQL Server)\n- AlloyDB for PostgreSQL\n- Spanner\n- TiDB\n- OceanBase\n- YugabyteDB\n\n### NoSQL Databases\n- MongoDB\n- Redis\n- Valkey\n- Firestore\n- Bigtable\n- Cassandra\n- Couchbase\n- Neo4j\n- Dgraph\n\n### Analytics & Warehouses\n- BigQuery\n- ClickHouse\n- Trino\n- Serverless Spark\n- Elasticsearch\n- SingleStore\n\n### Cloud Services\n- Looker\n- MindsDB\n- Dataplex\n- Cloud Healthcare API\n- Cloud Monitoring\n\nSee [genai-toolbox documentation](https://googleapis.github.io/genai-toolbox/resources/sources/) for complete list and configuration details.\n\n## Available Tools\n\nWhen connected via MCP, the following tools are available to AI assistants:\n\n### `list_tables`\nList all tables in the database with their descriptions.\n\n**Example:**\n```\nShow me all tables in the database\n```\n\n### `execute_sql`\nExecute any SQL statement on the database.\n\n**Parameters:**\n- `sql` (string, required): The SQL statement to execute\n\n**Example:**\n```\nGet all users from the users table where age > 25\n```\n\n## Environment Variables\n\nAll database types use the same unified environment variables:\n\n- `DATABASE_HOST` - Database host (default: localhost)\n- `DATABASE_PORT` - Database port (default: varies by database type)\n  - PostgreSQL: 5432\n  - MySQL: 3306\n  - MongoDB: 27017\n  - Redis: 6379\n  - MSSQL: 1433\n- `DATABASE_NAME` - Database name or file path\n- `DATABASE_USER` - Database user\n- `DATABASE_PASSWORD` - Database password\n\nFor cloud services (Cloud SQL, AlloyDB, BigQuery, Spanner, Firestore), additional GCP-specific variables are required:\n- `GCP_PROJECT` - GCP project ID\n- `GCP_REGION` - GCP region (default: us-central1)\n- `CLOUD_SQL_INSTANCE` / `ALLOYDB_CLUSTER` / etc. - Service-specific identifiers\n\n## CLI Reference\n\n```bash\nmcp-database [OPTIONS]\n\nOPTIONS:\n  -c, --config <path>    Path to tools.yaml configuration file\n  -p, --prebuilt <type>  Use prebuilt config for database type\n      --db-host <value>  Override MCP_DATABASE_HOST（所有预置类型通用）\n      --db-port <value>  Override MCP_DATABASE_PORT\n      --db-name <value>  Override MCP_DATABASE_NAME（对应 database/schema）\n      --db-user <value>  Override MCP_DATABASE_USER\n      --db-password <value> Override MCP_DATABASE_PASSWORD\n      --transport <mode> Transport between wrapper 与 toolbox：`stdio`(默认) / `http`\n      --toolbox-host <value> 当 transport=http 时的监听地址（默认 127.0.0.1）\n      --toolbox-port <value> 当 transport=http 时的端口（默认 5000）\n      --stdio            Use stdio transport (default: true)\n  -v, --version          Print version\n  -h, --help             Print help\n      --verbose          Enable verbose logging\n\nPREBUILT TYPES:\n  postgres, mysql, sqlite, mongodb, redis, mssql,\n  cloud-sql-postgres, cloud-sql-mysql, alloydb-pg,\n  bigquery, spanner, firestore\n```\n\n## Programmatic Usage\n\nYou can also use mcp-database programmatically:\n\n```typescript\nimport { startServer, generatePrebuiltConfig } from '@adversity/mcp-database';\n\nconst config = generatePrebuiltConfig('postgres');\n\nconst server = await startServer({\n  binaryPath: '/path/to/toolbox',\n  config,\n  verbose: true,\n});\n\n// Server is now running\n```\n\n## Testing\n\nThe project includes comprehensive test coverage, especially for SQLite features:\n\n```bash\n# Run all tests\nnpm test\n\n# Run only SQLite tests\nnpm test -- sqlite\n\n# Run with coverage\nnpm run test:coverage\n```\n\n**SQLite Test Coverage:**\n- ✅ 63 test cases, 100% passing\n- ✅ Configuration loading and environment variable handling\n- ✅ 15 built-in introspection tools validation\n- ✅ CRUD operations and parameterized queries\n- ✅ Toolset integration tests\n\n## Development\n\n```bash\n# Install dependencies\nnpm install\n\n# Build\nnpm run build\n\n# Watch mode\nnpm run dev\n\n# Run tests\nnpm test\n\n# Lint\nnpm run lint\n\n# Format\nnpm run format\n```\n\n## How It Works\n\nThis package wraps the [genai-toolbox](https://github.com/googleapis/genai-toolbox) binary and exposes it as an MCP server:\n\n1. **Binary Management**: Automatically downloads the correct genai-toolbox binary for your platform\n2. **Configuration**: Generates or loads YAML configuration with environment variable substitution\n3. **MCP Protocol**: Implements MCP server protocol over stdio\n4. **Tool Execution**: Proxies tool calls to genai-toolbox subprocess\n\n## Requirements\n\n- Node.js 18 or higher\n- Internet connection (for initial binary download)\n- Database credentials for your target database\n\n## License\n\nMIT\n\n## Related Projects\n\n- [genai-toolbox](https://github.com/googleapis/genai-toolbox) - The underlying database connectivity engine\n- [Model Context Protocol](https://modelcontextprotocol.io/) - The protocol specification\n- [@modelcontextprotocol/sdk](https://github.com/modelcontextprotocol/sdk) - MCP SDK\n\n## Contributing\n\nContributions are welcome! Please open an issue or pull request.\n\n## Support\n\n- GitHub Issues: [Report bugs or request features](https://github.com/yourusername/mcp-database/issues)\n- Documentation: [genai-toolbox docs](https://googleapis.github.io/genai-toolbox/)\n","readmeFilename":"README.md"}