{"_id":"mysql-schema-lens","_rev":"2-7f6a314a2036d2cdb67f0bb47c54c679","name":"mysql-schema-lens","dist-tags":{"latest":"0.1.0"},"versions":{"0.0.0-stage":{"name":"mysql-schema-lens","version":"0.0.0-stage","_id":"mysql-schema-lens@0.0.0-stage","stub":true,"maintainers":[{"name":"prathammodi7681","email":"prathammodi17@gmail.com"}],"dist":{"shasum":"c87c35f18e77ee1798156d63061055b85852a4bb","tarball":"https://registry.npmjs.org/mysql-schema-lens/-/mysql-schema-lens-0.0.0-stage.tgz","fileCount":2,"integrity":"sha512-L38t2oZxmafBQ9FINLm3yo6FjaymVXk6I976YE3ThMmRAM8R61o7db/E3oaJcqmqe+Bpx9uMtpXpF5dzqpf/hA==","signatures":[{"sig":"MEYCIQCfBRxkT0laqQUGwhMNtC3ufofeAPH2pxGEKBvvl8b23AIhAIIaBWgIIDfcrkgCBJG/40IxSWacJBI6ztYoQLB+WBOu","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":339},"_npmUser":{"name":"prathammodi7681","email":"prathammodi17@gmail.com"},"description":"Temporary package placeholder for staged publishing","directories":{}},"0.1.0":{"_id":"mysql-schema-lens@0.1.0","bin":{"mysql-schema-lens":"dist/cli.js"},"bugs":{"url":"https://github.com/prathammodi12/mysql-schema-lens/issues"},"dist":{"shasum":"fe99a729a98152affaae6c5c7bcc8db7938b4f0d","tarball":"https://registry.npmjs.org/mysql-schema-lens/-/mysql-schema-lens-0.1.0.tgz","fileCount":15,"integrity":"sha512-qZYEU2EfBwiPWC9jmqh24vIb22aQv2w2jPPbifYxdbT2f30mcJKz+oXYhKSADM5XgGdDkYLSS0KV4XcBBj7FFQ==","signatures":[{"sig":"MEYCIQDS7qdIW9Pli2Akw/r10cv9d+sPWci4GGrPTtyYzhq0QgIhAJ9XfVNL/juRkPFtIm4CAgFxRAM9czA043jrBz1J/QBR","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDoSUDNZealfC1b26GQnmePLsDdrtUGuJZM5imX3tvNnAIgUiD1OOZa6xCTBoNMAiAuGneMiVhzWcLL7NvPMycOMmo="}],"unpackedSize":57353},"name":"mysql-schema-lens","type":"module","author":{"name":"Pratham Modi"},"engines":{"node":">=18"},"gitHead":"75c56afab2afc2f425c0832da74d6483a7f85344","license":"MIT","scripts":{"test":"vitest run","build":"npm run clean && tsc -p tsconfig.json","clean":"node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"","typecheck":"tsc --noEmit -p tsconfig.json","prepublishOnly":"npm run typecheck && npm test && npm run build"},"version":"0.1.0","_npmUser":{"name":"prathammodi7681","email":"prathammodi17@gmail.com"},"homepage":"https://github.com/prathammodi12/mysql-schema-lens#readme","keywords":["mysql","schema","information_schema","mcp","model-context-protocol","mcp-server","cli","ai-agents","database"],"repository":{"url":"git+https://github.com/prathammodi12/mysql-schema-lens.git","type":"git"},"_npmVersion":"11.6.2","description":"Local MySQL schema store for coding agents: cached, fingerprint-checked, served over MCP or a CLI.","directories":{},"maintainers":[{"name":"prathammodi7681","email":"prathammodi17@gmail.com"}],"_nodeVersion":"24.11.1","dependencies":{"zod":"3.25.76","mysql2":"3.24.5","@modelcontextprotocol/sdk":"1.32.1"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"3.2.7","typescript":"5.9.3","@types/node":"22.20.5"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mysql-schema-lens_0.1.0_1791463170883_0.6100662106820889"}}},"time":{"created":"2026-10-08T12:38:33.926Z","modified":"2026-10-08T12:39:31.168Z","0.0.0-stage":"2026-10-08T12:38:33.926Z","0.1.0":"2026-10-08T12:39:30.970Z"},"description":"Local MySQL schema store for coding agents: cached, fingerprint-checked, served over MCP or a CLI.","maintainers":[{"name":"prathammodi7681","email":"prathammodi17@gmail.com"}],"readme":"# mysql-schema-lens\n\n[![npm](https://img.shields.io/npm/v/mysql-schema-lens.svg)](https://www.npmjs.com/package/mysql-schema-lens)\n[![license](https://img.shields.io/npm/l/mysql-schema-lens.svg)](LICENSE)\n\nLocal MySQL schema store for coding agents. It snapshots `information_schema`\nonce, caches it on disk, and answers schema questions from the cache, over MCP\nor the command line. A MySQL counterpart of\n[schema-lens](https://github.com/JaydeepRamanuj/schema-lens), which is PostgreSQL-only.\n\n- **Fresh without being slow:** inside `ttlSeconds` the cache is used as is;\n  after that one fingerprint query decides whether the schema changed and only\n  then re-extracts.\n- **Works offline:** with the database down, the cached schema is served with a warning.\n- **Finds relationships that were never declared:** besides foreign keys it\n  infers links from column comments that name `table.column`, and from column\n  names (`request_item_id` -> `dms_issue_request_item_tab.id`, after stripping\n  the shared table prefix and a `_tab` suffix). Inferred links are always marked.\n- **Read-only:** it only runs `SELECT` on `information_schema`; it never reads table data.\n\n## Install\n\nRequires Node.js 18 or later.\n\n```bash\nnpm install -g mysql-schema-lens\n```\n\nOr run it without installing: `npx mysql-schema-lens <command>`.\n\n## Setup\n\nCreate `dbctx.config.json` from\n[`dbctx.config.json.example`](dbctx.config.json.example) (also shipped in the\npackage), keep it out of git, and point `DBCTX_CONFIG` at it (or put it in the\nworking directory or `~/.schema-lens/`). Passwords never go in the file: each profile names the\nenvironment variable that holds it (`passwordEnv`, default `DBCTX_MYSQL_PASSWORD`).\n\nThe account needs nothing beyond seeing the schema, e.g.:\n\n```sql\nCREATE USER 'schema_reader'@'%' IDENTIFIED BY '...';\nGRANT SELECT, SHOW VIEW ON myapp.* TO 'schema_reader'@'%';\n```\n\n(`SHOW VIEW` is needed for view definitions; routine bodies are not read.)\n\n## MCP\n\n```json\n\"dbctx\": {\n  \"command\": \"npx\",\n  \"args\": [\"-y\", \"mysql-schema-lens\", \"mcp-serve\"],\n  \"env\": {\n    \"DBCTX_CONFIG\": \"<path>/dbctx.config.json\",\n    \"DBCTX_MYSQL_PASSWORD\": \"<password>\"\n  }\n}\n```\n\nTools: `tables`, `describe`, `columns`, `constraints`, `related`, `find-column`,\n`find-common-columns`, `join-path`, `enums`, `search-schema`, `find-by-type`,\n`check-index`, `find-orphans`, `routines`, `triggers`, `status`, `refresh`.\nEach takes an optional `profile` and `format` (`compact`, `json`, `md`).\n\nWith a global install, `\"command\": \"mysql-schema-lens\", \"args\": [\"mcp-serve\"]`\nalso works and skips the `npx` lookup on start-up.\n\n## CLI\n\n```bash\nmysql-schema-lens refresh\nmysql-schema-lens describe dms_issue_request_item_tab\nmysql-schema-lens join-path dms_controlled_copy_tab dms_issue_request_tab\nmysql-schema-lens check-index dms_issue_request_tab company state\nmysql-schema-lens --help\n```\n\n## Development\n\n```bash\ngit clone https://github.com/prathammodi12/mysql-schema-lens.git\ncd mysql-schema-lens\nnpm install\nnpm run build\nnpm run typecheck\nnpm test\nnode dist/cli.js --help\n```\n\n## License\n\n[MIT](LICENSE) © Pratham Modi\n","readmeFilename":"README.md","homepage":"https://github.com/prathammodi12/mysql-schema-lens#readme","keywords":["mysql","schema","information_schema","mcp","model-context-protocol","mcp-server","cli","ai-agents","database"],"repository":{"url":"git+https://github.com/prathammodi12/mysql-schema-lens.git","type":"git"},"author":{"name":"Pratham Modi"},"bugs":{"url":"https://github.com/prathammodi12/mysql-schema-lens/issues"},"license":"MIT"}