mcp-database CLAUDE.md

mcp-database CLAUDE.md is an instructions file for coding agents from DiegoBulhoes/mcp-database. It costs 2,571 tokens per session, scanned A, original, Apache-2.0.

A set of development instructions for a multi-database MCP server, a tool that lets an agent work with databases. It covers PostgreSQL, MySQL, MariaDB, SQLite, MongoDB, and Redis, along with the project’s architecture, rules, setup, and tests.

In plain words
What is it for?
Use it when installing the project, running checks, testing with local or real databases, understanding its tools, or adding or changing a database tool.
Why use it?
It gives contributors one place to follow project rules and avoid breaking database support, test coverage, or the server’s design.

Instructions file

Install

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.

agentmods
npx agentmods add instructions/diegobulhoes/mcp-database/claude-md
Clone the repo
git clone --depth 1 https://github.com/DiegoBulhoes/mcp-database

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for mcp-database CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/diegobulhoes/mcp-database/claude-md.svg)](https://agentmods.dev/instructions/diegobulhoes/mcp-database/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/diegobulhoes/mcp-database/claude-md"><img src="https://agentmods.dev/badge/instructions/diegobulhoes/mcp-database/claude-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 2,571 This file is loaded in full into every session.
When invoked 2,571 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What 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.

ModelPer sessionOnce invoked
Fable 5 $0.02571 $0.02571
Opus 5 $0.01286 $0.01286
Sonnet 5 $0.00514 $0.00514
Haiku 4.5 $0.00257 $0.00257

Measured 3d ago against content hash 23c8e090d1b5, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

mcp-database 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 3d ago.

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.

CLAUDE.md · 110 lines

How it starts

The opening of the file, as written. The whole thing — 110 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CLAUDE.md

Multi-database MCP server (PostgreSQL, MySQL, MariaDB, SQLite, MongoDB, Redis) over stdio. Python 3.12, managed with uv.

  • References: docs/architecture.md (decisions, component map, request flow, failure modes, runbook), docs/tools.md (39 tools, per-engine support), docs/configuration.md, docs/connections.md (per-engine local/external examples), docs/examples/.
  • temp/ is gitignored scratch space
  • scripts/ holds standalone dev/build scripts (see scripts/README.md); never import from it in src/ or tests/.

Commands

make install            # uv sync
make lint               # ruff check + format check (must pass clean)
make fmt                # autofix + reformat
make test-unit          # fast: tests/unit + tests/e2e, no Docker
make test-integration   # real databases via testcontainers (requires Docker)
make test-cluster       # multi-node topologies incl. failure scenarios (crash/failover/quorum); own CI job, never in the coverage gate
make test               # full suite; 95% coverage gate; HTML report in temp/reports/coverage/
make up && make mongo-rs && make seed  # playground + seed data (pgvector pg; host ports: mysql 3306, mariadb 3307, mongo 27019, redis 6380; sqlite → temp/playground.db)
make atlas-local && make atlas-seed    # optional: mongodb-atlas-local (mongot) on port 27018
make evals              # one-shot agent evals via the logged-in claude CLI; reports in temp/reports/
make run                # run the server against the playground PostgreSQL
uv run pytest tests/unit/test_guard_sql.py -k name  # single test

Architecture

Full picture in docs/architecture.md. Map:

  • entry.py — env-only config, no CLI: one connection per instance (URI required); more databases = more MCP entries.
  • server.pybuild_server only: assembles FastMCP, applies TOOLS/DISABLE_TOOLS, lifespan closes pools (the only close hook).
  • tools/ — one module per risk class (schema.py, read.py, perf.py, write_admin.py) + params.py + context.py (ToolContext orchestrates validation, timeout, audit); perf.py's pure section-to-findings summarizers live in perf_summary.py. Prefix encodes risk: db_schema_/db_read_/db_perf_ never write; db_write_/db_admin_ are destructive and audited.
  • guard.py — all authorization and query validation, fail-closed. SQL via sqlglot (_DIALECTS); MongoDB and Redis via envelope allowlists (helpers/mongo_query.py, helpers/redis_query.py).
  • adapters/Adapter ABC + shared SQLAdapter in base.py; engine features declared in CAPABILITIES. Every engine is a package: the full engines (postgres/, mysql/, mongodb/, sqlite/, redis/) are split by area into mixins mirroring tools/ (schema.py/read.py/perf.py/write.py + optional _common.py, composed in __init__.py); mariadb/ holds only its MySQLAdapter overrides in __init__.py (no mixins — it inherits everything). Import path is unchanged (from .postgres import PostgresAdapter).
  • formatter.py — truncation, masking, compact, sanitize_error; audit.py — hash-chained JSONL shapes; helpers/sql_ast.py, mongo_query.py, connection_fields.py.

Read the full file on GitHub · 110 lines

Changes

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.

  1. 3d ago First seen · 110 lines · 2,571 tokens per session scan A 23c8e090d1b5

Subscribe to this mod's changes

mcp-database CLAUDE.md is an instructions file published in the GitHub repository DiegoBulhoes/mcp-database (0 stars, last pushed 18d ago), licensed Apache-2.0. It adds 2,571 tokens to every session, about $0.0129 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.

Related

Other instructions, from other repositories