From 1b4a77fba97dc4500fd9a86a718beba1e6fce71a Mon Sep 17 00:00:00 2001 From: Evgeny Gamov Date: Tue, 16 Jun 2026 19:31:59 +0500 Subject: [PATCH] chore: relocate dbmole into packages/dbmole-mcp --- .../dbmole-mcp/.dockerignore | 0 Dockerfile => packages/dbmole-mcp/Dockerfile | 0 packages/dbmole-mcp/package.json | 38 +++++++++++++++++++ {src => packages/dbmole-mcp/src}/cli.ts | 0 .../dbmole-mcp/src}/config/registry.ts | 0 .../dbmole-mcp/src}/config/sources.ts | 0 .../dbmole-mcp/src}/config/store.ts | 0 .../dbmole-mcp/src}/config/types.ts | 0 {src => packages/dbmole-mcp/src}/db/driver.ts | 0 .../dbmole-mcp/src}/db/manager.ts | 0 {src => packages/dbmole-mcp/src}/db/mysql.ts | 0 .../dbmole-mcp/src}/db/postgres.ts | 0 .../dbmole-mcp/src}/db/sqlGuard.ts | 0 {src => packages/dbmole-mcp/src}/format.ts | 0 {src => packages/dbmole-mcp/src}/index.ts | 0 .../dbmole-mcp/src}/net/tunnel.ts | 0 {src => packages/dbmole-mcp/src}/server.ts | 0 .../dbmole-mcp/src}/tools/connections.ts | 0 .../dbmole-mcp/src}/tools/managed.ts | 0 .../dbmole-mcp/src}/tools/query.ts | 0 .../dbmole-mcp/src}/tools/respond.ts | 0 .../dbmole-mcp/src}/tools/schema.ts | 0 .../test}/integration/mysql.test.ts | 0 .../test}/integration/postgres.test.ts | 0 .../test}/integration/tunnel.test.ts | 0 .../dbmole-mcp/test}/unit/cli.test.ts | 0 .../test}/unit/config/registry.test.ts | 0 .../test}/unit/config/sources.test.ts | 0 .../test}/unit/config/store.test.ts | 0 .../test}/unit/config/types.test.ts | 0 .../dbmole-mcp/test}/unit/db/driver.test.ts | 0 .../dbmole-mcp/test}/unit/db/manager.test.ts | 0 .../dbmole-mcp/test}/unit/db/mysql.test.ts | 0 .../dbmole-mcp/test}/unit/db/postgres.test.ts | 0 .../dbmole-mcp/test}/unit/db/sqlGuard.test.ts | 0 .../dbmole-mcp/test}/unit/format.test.ts | 0 .../dbmole-mcp/test}/unit/helpers.ts | 0 .../dbmole-mcp/test}/unit/net/tunnel.test.ts | 0 .../dbmole-mcp/test}/unit/server.test.ts | 0 .../test}/unit/tools/connections.test.ts | 0 .../test}/unit/tools/managed.test.ts | 0 .../dbmole-mcp/test}/unit/tools/query.test.ts | 0 .../test}/unit/tools/schema.test.ts | 0 packages/dbmole-mcp/tsconfig.json | 4 ++ .../dbmole-mcp/tsup.config.ts | 0 packages/dbmole-mcp/vitest.config.ts | 13 +++++++ tsconfig.json | 14 ------- vitest.config.ts | 31 --------------- 48 files changed, 55 insertions(+), 45 deletions(-) rename .dockerignore => packages/dbmole-mcp/.dockerignore (100%) rename Dockerfile => packages/dbmole-mcp/Dockerfile (100%) create mode 100644 packages/dbmole-mcp/package.json rename {src => packages/dbmole-mcp/src}/cli.ts (100%) rename {src => packages/dbmole-mcp/src}/config/registry.ts (100%) rename {src => packages/dbmole-mcp/src}/config/sources.ts (100%) rename {src => packages/dbmole-mcp/src}/config/store.ts (100%) rename {src => packages/dbmole-mcp/src}/config/types.ts (100%) rename {src => packages/dbmole-mcp/src}/db/driver.ts (100%) rename {src => packages/dbmole-mcp/src}/db/manager.ts (100%) rename {src => packages/dbmole-mcp/src}/db/mysql.ts (100%) rename {src => packages/dbmole-mcp/src}/db/postgres.ts (100%) rename {src => packages/dbmole-mcp/src}/db/sqlGuard.ts (100%) rename {src => packages/dbmole-mcp/src}/format.ts (100%) rename {src => packages/dbmole-mcp/src}/index.ts (100%) rename {src => packages/dbmole-mcp/src}/net/tunnel.ts (100%) rename {src => packages/dbmole-mcp/src}/server.ts (100%) rename {src => packages/dbmole-mcp/src}/tools/connections.ts (100%) rename {src => packages/dbmole-mcp/src}/tools/managed.ts (100%) rename {src => packages/dbmole-mcp/src}/tools/query.ts (100%) rename {src => packages/dbmole-mcp/src}/tools/respond.ts (100%) rename {src => packages/dbmole-mcp/src}/tools/schema.ts (100%) rename {test => packages/dbmole-mcp/test}/integration/mysql.test.ts (100%) rename {test => packages/dbmole-mcp/test}/integration/postgres.test.ts (100%) rename {test => packages/dbmole-mcp/test}/integration/tunnel.test.ts (100%) rename {test => packages/dbmole-mcp/test}/unit/cli.test.ts (100%) rename {test => packages/dbmole-mcp/test}/unit/config/registry.test.ts (100%) rename {test => packages/dbmole-mcp/test}/unit/config/sources.test.ts (100%) rename {test => packages/dbmole-mcp/test}/unit/config/store.test.ts (100%) rename {test => packages/dbmole-mcp/test}/unit/config/types.test.ts (100%) rename {test => packages/dbmole-mcp/test}/unit/db/driver.test.ts (100%) rename {test => packages/dbmole-mcp/test}/unit/db/manager.test.ts (100%) rename {test => packages/dbmole-mcp/test}/unit/db/mysql.test.ts (100%) rename {test => packages/dbmole-mcp/test}/unit/db/postgres.test.ts (100%) rename {test => packages/dbmole-mcp/test}/unit/db/sqlGuard.test.ts (100%) rename {test => packages/dbmole-mcp/test}/unit/format.test.ts (100%) rename {test => packages/dbmole-mcp/test}/unit/helpers.ts (100%) rename {test => packages/dbmole-mcp/test}/unit/net/tunnel.test.ts (100%) rename {test => packages/dbmole-mcp/test}/unit/server.test.ts (100%) rename {test => packages/dbmole-mcp/test}/unit/tools/connections.test.ts (100%) rename {test => packages/dbmole-mcp/test}/unit/tools/managed.test.ts (100%) rename {test => packages/dbmole-mcp/test}/unit/tools/query.test.ts (100%) rename {test => packages/dbmole-mcp/test}/unit/tools/schema.test.ts (100%) create mode 100644 packages/dbmole-mcp/tsconfig.json rename tsup.config.ts => packages/dbmole-mcp/tsup.config.ts (100%) create mode 100644 packages/dbmole-mcp/vitest.config.ts delete mode 100644 tsconfig.json delete mode 100644 vitest.config.ts diff --git a/.dockerignore b/packages/dbmole-mcp/.dockerignore similarity index 100% rename from .dockerignore rename to packages/dbmole-mcp/.dockerignore diff --git a/Dockerfile b/packages/dbmole-mcp/Dockerfile similarity index 100% rename from Dockerfile rename to packages/dbmole-mcp/Dockerfile diff --git a/packages/dbmole-mcp/package.json b/packages/dbmole-mcp/package.json new file mode 100644 index 0000000..800943b --- /dev/null +++ b/packages/dbmole-mcp/package.json @@ -0,0 +1,38 @@ +{ + "name": "dbmole-mcp", + "version": "0.1.0", + "description": "MCP server for PostgreSQL and MySQL with named connections and SSH tunnels", + "license": "MIT", + "author": "smartass", + "repository": { + "type": "git", + "url": "git+https://git.smartass.pw/admin/dbmole-mcp.git" + }, + "homepage": "https://git.smartass.pw/admin/dbmole-mcp", + "keywords": ["mcp", "model-context-protocol", "postgres", "postgresql", "mysql", "ssh-tunnel", "database", "stdio"], + "type": "module", + "bin": { "dbmole-mcp": "dist/index.js" }, + "files": ["dist"], + "engines": { "node": ">=20" }, + "scripts": { + "build": "tsup", + "dev": "tsx src/index.ts", + "typecheck": "tsc --noEmit", + "test:unit": "vitest run", + "coverage": "vitest run --coverage", + "prepublishOnly": "tsc --noEmit && tsup" + }, + "dependencies": { + "@modelcontextprotocol/sdk": "^1.29.0", + "mysql2": "^3.22.5", + "pg": "^8.21.0", + "ssh2": "^1.17.0", + "zod": "^3.25.76" + }, + "devDependencies": { + "@types/pg": "^8.20.0", + "@types/ssh2": "^1.15.5", + "@testcontainers/mysql": "^11.14.0", + "@testcontainers/postgresql": "^11.14.0" + } +} diff --git a/src/cli.ts b/packages/dbmole-mcp/src/cli.ts similarity index 100% rename from src/cli.ts rename to packages/dbmole-mcp/src/cli.ts diff --git a/src/config/registry.ts b/packages/dbmole-mcp/src/config/registry.ts similarity index 100% rename from src/config/registry.ts rename to packages/dbmole-mcp/src/config/registry.ts diff --git a/src/config/sources.ts b/packages/dbmole-mcp/src/config/sources.ts similarity index 100% rename from src/config/sources.ts rename to packages/dbmole-mcp/src/config/sources.ts diff --git a/src/config/store.ts b/packages/dbmole-mcp/src/config/store.ts similarity index 100% rename from src/config/store.ts rename to packages/dbmole-mcp/src/config/store.ts diff --git a/src/config/types.ts b/packages/dbmole-mcp/src/config/types.ts similarity index 100% rename from src/config/types.ts rename to packages/dbmole-mcp/src/config/types.ts diff --git a/src/db/driver.ts b/packages/dbmole-mcp/src/db/driver.ts similarity index 100% rename from src/db/driver.ts rename to packages/dbmole-mcp/src/db/driver.ts diff --git a/src/db/manager.ts b/packages/dbmole-mcp/src/db/manager.ts similarity index 100% rename from src/db/manager.ts rename to packages/dbmole-mcp/src/db/manager.ts diff --git a/src/db/mysql.ts b/packages/dbmole-mcp/src/db/mysql.ts similarity index 100% rename from src/db/mysql.ts rename to packages/dbmole-mcp/src/db/mysql.ts diff --git a/src/db/postgres.ts b/packages/dbmole-mcp/src/db/postgres.ts similarity index 100% rename from src/db/postgres.ts rename to packages/dbmole-mcp/src/db/postgres.ts diff --git a/src/db/sqlGuard.ts b/packages/dbmole-mcp/src/db/sqlGuard.ts similarity index 100% rename from src/db/sqlGuard.ts rename to packages/dbmole-mcp/src/db/sqlGuard.ts diff --git a/src/format.ts b/packages/dbmole-mcp/src/format.ts similarity index 100% rename from src/format.ts rename to packages/dbmole-mcp/src/format.ts diff --git a/src/index.ts b/packages/dbmole-mcp/src/index.ts similarity index 100% rename from src/index.ts rename to packages/dbmole-mcp/src/index.ts diff --git a/src/net/tunnel.ts b/packages/dbmole-mcp/src/net/tunnel.ts similarity index 100% rename from src/net/tunnel.ts rename to packages/dbmole-mcp/src/net/tunnel.ts diff --git a/src/server.ts b/packages/dbmole-mcp/src/server.ts similarity index 100% rename from src/server.ts rename to packages/dbmole-mcp/src/server.ts diff --git a/src/tools/connections.ts b/packages/dbmole-mcp/src/tools/connections.ts similarity index 100% rename from src/tools/connections.ts rename to packages/dbmole-mcp/src/tools/connections.ts diff --git a/src/tools/managed.ts b/packages/dbmole-mcp/src/tools/managed.ts similarity index 100% rename from src/tools/managed.ts rename to packages/dbmole-mcp/src/tools/managed.ts diff --git a/src/tools/query.ts b/packages/dbmole-mcp/src/tools/query.ts similarity index 100% rename from src/tools/query.ts rename to packages/dbmole-mcp/src/tools/query.ts diff --git a/src/tools/respond.ts b/packages/dbmole-mcp/src/tools/respond.ts similarity index 100% rename from src/tools/respond.ts rename to packages/dbmole-mcp/src/tools/respond.ts diff --git a/src/tools/schema.ts b/packages/dbmole-mcp/src/tools/schema.ts similarity index 100% rename from src/tools/schema.ts rename to packages/dbmole-mcp/src/tools/schema.ts diff --git a/test/integration/mysql.test.ts b/packages/dbmole-mcp/test/integration/mysql.test.ts similarity index 100% rename from test/integration/mysql.test.ts rename to packages/dbmole-mcp/test/integration/mysql.test.ts diff --git a/test/integration/postgres.test.ts b/packages/dbmole-mcp/test/integration/postgres.test.ts similarity index 100% rename from test/integration/postgres.test.ts rename to packages/dbmole-mcp/test/integration/postgres.test.ts diff --git a/test/integration/tunnel.test.ts b/packages/dbmole-mcp/test/integration/tunnel.test.ts similarity index 100% rename from test/integration/tunnel.test.ts rename to packages/dbmole-mcp/test/integration/tunnel.test.ts diff --git a/test/unit/cli.test.ts b/packages/dbmole-mcp/test/unit/cli.test.ts similarity index 100% rename from test/unit/cli.test.ts rename to packages/dbmole-mcp/test/unit/cli.test.ts diff --git a/test/unit/config/registry.test.ts b/packages/dbmole-mcp/test/unit/config/registry.test.ts similarity index 100% rename from test/unit/config/registry.test.ts rename to packages/dbmole-mcp/test/unit/config/registry.test.ts diff --git a/test/unit/config/sources.test.ts b/packages/dbmole-mcp/test/unit/config/sources.test.ts similarity index 100% rename from test/unit/config/sources.test.ts rename to packages/dbmole-mcp/test/unit/config/sources.test.ts diff --git a/test/unit/config/store.test.ts b/packages/dbmole-mcp/test/unit/config/store.test.ts similarity index 100% rename from test/unit/config/store.test.ts rename to packages/dbmole-mcp/test/unit/config/store.test.ts diff --git a/test/unit/config/types.test.ts b/packages/dbmole-mcp/test/unit/config/types.test.ts similarity index 100% rename from test/unit/config/types.test.ts rename to packages/dbmole-mcp/test/unit/config/types.test.ts diff --git a/test/unit/db/driver.test.ts b/packages/dbmole-mcp/test/unit/db/driver.test.ts similarity index 100% rename from test/unit/db/driver.test.ts rename to packages/dbmole-mcp/test/unit/db/driver.test.ts diff --git a/test/unit/db/manager.test.ts b/packages/dbmole-mcp/test/unit/db/manager.test.ts similarity index 100% rename from test/unit/db/manager.test.ts rename to packages/dbmole-mcp/test/unit/db/manager.test.ts diff --git a/test/unit/db/mysql.test.ts b/packages/dbmole-mcp/test/unit/db/mysql.test.ts similarity index 100% rename from test/unit/db/mysql.test.ts rename to packages/dbmole-mcp/test/unit/db/mysql.test.ts diff --git a/test/unit/db/postgres.test.ts b/packages/dbmole-mcp/test/unit/db/postgres.test.ts similarity index 100% rename from test/unit/db/postgres.test.ts rename to packages/dbmole-mcp/test/unit/db/postgres.test.ts diff --git a/test/unit/db/sqlGuard.test.ts b/packages/dbmole-mcp/test/unit/db/sqlGuard.test.ts similarity index 100% rename from test/unit/db/sqlGuard.test.ts rename to packages/dbmole-mcp/test/unit/db/sqlGuard.test.ts diff --git a/test/unit/format.test.ts b/packages/dbmole-mcp/test/unit/format.test.ts similarity index 100% rename from test/unit/format.test.ts rename to packages/dbmole-mcp/test/unit/format.test.ts diff --git a/test/unit/helpers.ts b/packages/dbmole-mcp/test/unit/helpers.ts similarity index 100% rename from test/unit/helpers.ts rename to packages/dbmole-mcp/test/unit/helpers.ts diff --git a/test/unit/net/tunnel.test.ts b/packages/dbmole-mcp/test/unit/net/tunnel.test.ts similarity index 100% rename from test/unit/net/tunnel.test.ts rename to packages/dbmole-mcp/test/unit/net/tunnel.test.ts diff --git a/test/unit/server.test.ts b/packages/dbmole-mcp/test/unit/server.test.ts similarity index 100% rename from test/unit/server.test.ts rename to packages/dbmole-mcp/test/unit/server.test.ts diff --git a/test/unit/tools/connections.test.ts b/packages/dbmole-mcp/test/unit/tools/connections.test.ts similarity index 100% rename from test/unit/tools/connections.test.ts rename to packages/dbmole-mcp/test/unit/tools/connections.test.ts diff --git a/test/unit/tools/managed.test.ts b/packages/dbmole-mcp/test/unit/tools/managed.test.ts similarity index 100% rename from test/unit/tools/managed.test.ts rename to packages/dbmole-mcp/test/unit/tools/managed.test.ts diff --git a/test/unit/tools/query.test.ts b/packages/dbmole-mcp/test/unit/tools/query.test.ts similarity index 100% rename from test/unit/tools/query.test.ts rename to packages/dbmole-mcp/test/unit/tools/query.test.ts diff --git a/test/unit/tools/schema.test.ts b/packages/dbmole-mcp/test/unit/tools/schema.test.ts similarity index 100% rename from test/unit/tools/schema.test.ts rename to packages/dbmole-mcp/test/unit/tools/schema.test.ts diff --git a/packages/dbmole-mcp/tsconfig.json b/packages/dbmole-mcp/tsconfig.json new file mode 100644 index 0000000..03a0928 --- /dev/null +++ b/packages/dbmole-mcp/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../tsconfig.base.json", + "include": ["src", "test"] +} diff --git a/tsup.config.ts b/packages/dbmole-mcp/tsup.config.ts similarity index 100% rename from tsup.config.ts rename to packages/dbmole-mcp/tsup.config.ts diff --git a/packages/dbmole-mcp/vitest.config.ts b/packages/dbmole-mcp/vitest.config.ts new file mode 100644 index 0000000..f1fd33e --- /dev/null +++ b/packages/dbmole-mcp/vitest.config.ts @@ -0,0 +1,13 @@ +import { defineConfig } from 'vitest/config' + +export default defineConfig({ + test: { + include: ['test/unit/**/*.test.ts'], + coverage: { + provider: 'v8', + include: ['src/**'], + exclude: ['src/index.ts'], + thresholds: { lines: 90, functions: 90 } + } + } +}) diff --git a/tsconfig.json b/tsconfig.json deleted file mode 100644 index 3d3815c..0000000 --- a/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2022", - "module": "NodeNext", - "moduleResolution": "NodeNext", - "strict": true, - "skipLibCheck": true, - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "noEmit": true, - "types": ["node"] - }, - "include": ["src", "test"] -} diff --git a/vitest.config.ts b/vitest.config.ts deleted file mode 100644 index 50488e3..0000000 --- a/vitest.config.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { defineConfig } from 'vitest/config' - -export default defineConfig({ - test: { - projects: [ - { - test: { - name: 'unit', - include: ['test/unit/**/*.test.ts'] - } - }, - { - test: { - name: 'integration', - include: ['test/integration/**/*.test.ts'], - testTimeout: 120_000, - hookTimeout: 240_000 - } - } - ], - coverage: { - provider: 'v8', - include: ['src/**'], - exclude: ['src/index.ts'], - thresholds: { - lines: 90, - functions: 90 - } - } - } -})