Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add instructions/cocaxcode/database-mcp/claude-mdgit clone --depth 1 https://github.com/cocaxcode/database-mcpWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.01678 | $0.01678 |
| Opus 5 | $0.00839 | $0.00839 |
| Sonnet 5 | $0.00336 | $0.00336 |
| Haiku 4.5 | $0.00168 | $0.00168 |
Grade A, and why
database-mcp CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 126 lines — stays where its author put it; the contents beside it link to each section on GitHub.
CLAUDE.md — @cocaxcode/database-mcp
Project Overview
MCP server for database connectivity. Multi-DB (PostgreSQL, MySQL, SQLite), connection management, schema introspection, query execution with rollback and history, database dump/restore. 27 tools, 163 tests.
Token-optimized query results (v0.3+)
execute_query, execute_mutation, explain_query accept optional params that cut context tokens 60-95%:
verbosity: 'minimal' | 'normal' | 'full'(default'normal')only_columns: string[]— client-side column projectionmax_cell_bytes: number(default 500) — per-cell byte cap for'normal'max_rows_in_response: number— row cap beyond SQL LIMITinclude_schema_context: boolean— skip schema trail when known
Every compressed result includes call_id. Use inspect_last_query({ call_id }) to recover the full result without re-executing the SQL (preserves DB load). Ring buffer 20 + ~/.database-mcp/last-queries/ with 1h TTL.
Cell truncation preserves table structure: truncated cells get a …(+NB) suffix. Much better than the old global 25KB truncation that cut trailing rows.
Stack
- TypeScript 5.x (strict mode, ESM)
- @modelcontextprotocol/sdk 1.27.x (unified package)
- Zod 3.25+ for schema validation
- Vitest for testing (InMemoryTransport + SQLite :memory:)
- tsup for building (ESM output with shebang)
- Drivers: postgres, mysql2, sql.js (optional peer deps, dynamic import)
Architecture
src/
├── index.ts # Entry point (shebang + StdioServerTransport, --dsn flag)
├── server.ts # createServer(storageDir?, projectDir?) factory
├── tools/ # MCP tool registration (one file per group)
│ ├── connection.ts # conn_create/list/get/set/switch/rename/delete/duplicate/test/project_list/project_clear/export/import (13)
│ ├── schema.ts # search_schema (1)
│ ├── query.ts # execute_query/execute_mutation/explain_query (3)
│ ├── rollback.ts # rollback_list/rollback_apply (2)
│ ├── history.ts # history_list/history_clear (2)
│ ├── config.ts # config_get/config_set (2)
│ └── dump.ts # db_dump/db_restore/db_dump_list (3)
├── resources/
│ └── schema.ts # MCP Resources: db://schema, db://tables/{tableName}/schema
├── services/ # Business logic with DB interaction
│ ├── connection-manager.ts # Lazy connect, driver caching, getActiveDriver()
│ ├── schema-introspector.ts # Multi-dialect schema queries (3 detail levels)
│ ├── query-executor.ts # Read (LIMIT injection), mutation (mode check), explain
│ ├── rollback-manager.ts # Pre-mutation snapshots, reverse SQL generation
│ ├── history-logger.ts # Per-project query history (5000 max)
│ └── dump-manager.ts # Database dump/restore (SQL generation, multi-dialect)
├── drivers/ # Database adapters (dynamic import)
│ ├── interface.ts # DatabaseDriver interface
│ ├── sqlite.ts # sql.js adapter (:memory: + file)
│ ├── postgres.ts # postgres.js adapter (DSN or config)
│ ├── mysql.ts # mysql2/promise adapter (DSN or config)
│ └── registry.ts # resolveDriver() factory
├── lib/ # Pure logic (no DB dependency)
│ ├── types.ts # All TypeScript interfaces
│ ├── sanitize.ts # sanitizeName() for connection names
│ └── storage.ts # JSON file storage in ~/.database-mcp/
├── utils/
│ ├── sql-classifier.ts # classifySql() → read/write/ddl
│ ├── sql-parser-light.ts # extractTableAndWhere() for rollback
│ ├── result-formatter.ts # formatQueryResult() with 25KB truncation
│ ├── gitignore-checker.ts # Add .database-mcp/ to .gitignore
│ └── project-storage.ts # Lazy mkdir of {projectDir}/.database-mcp/ + gitignore
├── types/ # Module declarations for optional deps
│ ├── sql.js.d.ts
│ ├── postgres.d.ts
│ └── mysql2.d.ts
└── __tests__/
├── helpers.ts # createTestClient() with InMemoryTransport
└── *.test.ts # 10 test files, 88 tests
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- yesterday First seen · 126 lines · 1,678 tokens per session scan A f4f61d8516cb
database-mcp CLAUDE.md is an instructions file published in the GitHub repository cocaxcode/database-mcp (2 stars, last pushed 6d ago), licensed MIT. It adds 1,678 tokens to every session, about $0.0084 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other instructions, from other repositories
codex AGENTS.md
AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.
buildNext
Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).
next.js AGENTS.md
Instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.
vscode oss-third-party-notices.instructions.md
Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).
spec-kit AGENTS.md
Instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.
langchain AGENTS.md
Instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.