mcp-multi-db AGENTS.md

mcp-multi-db AGENTS.md is an instructions file for Codex, OpenCode from mahAnuj/mcp-multi-db. It costs 1,567 tokens per session, scanned B, original, ISC.

Repository instructions for an MCP server that connects coding agents to multiple databases. MCP is a standard way for an AI tool to call external services.

In plain words
What is it for?
Use them when installing dependencies, building or testing the TypeScript server, configuring databases, or debugging its JSON-RPC connection.
Why use it?
They document the commands, tests, configuration, architecture, and rules needed to change the server safely.

Instructions file for CodexOpenCode

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/mahanuj/mcp-multi-db/agents-md
Clone the repo
git clone --depth 1 https://github.com/mahAnuj/mcp-multi-db

Made for: Codex, OpenCode.

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-multi-db AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/mahanuj/mcp-multi-db/agents-md.svg)](https://agentmods.dev/instructions/mahanuj/mcp-multi-db/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/mahanuj/mcp-multi-db/agents-md"><img src="https://agentmods.dev/badge/instructions/mahanuj/mcp-multi-db/agents-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 1,567 This file is loaded in full into every session.
When invoked 1,567 The same file — it is already loaded in full.
Security scan B 1 finding. 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.01567 $0.01567
Opus 5 $0.00783 $0.00783
Sonnet 5 $0.00313 $0.00313
Haiku 4.5 $0.00157 $0.00157

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

Security

Grade B, and why

mcp-multi-db AGENTS.md scanned grade B with 1 finding 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 4d 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.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

npm run build # tsc -> build/, then chmod 755 build/index.js
AGENTS.md · 53 lines

How it starts

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

AGENTS.md

Guidance for AI coding agents working in this repository. Also useful to humans.

See CONTRIBUTING.md for the contributor workflow.

Commands

npm install           # install dependencies
npm run build         # tsc -> build/, then chmod 755 build/index.js
npm test              # runs build, then node:test suite in test/
node --test "test/**/*.test.ts"          # run tests without rebuilding
node --test test/validateReadOnly.test.ts # run a single test file

Tests use Node's built-in runner (node:test, no extra deps) and require Node ≥ 22.18 / 24 (native TypeScript execution). They import the compiled build/*.js — not src — because the source uses constructor parameter properties that Node's type-stripping can't run, so npm test builds first. There is no linter; TypeScript strict mode is the type/correctness gate. Always npm run build after changes — build/index.js is what the MCP client executes.

To run the server manually for debugging (it speaks MCP over stdio, so it waits for JSON-RPC on stdin):

MCP_DB_CONFIG=./databases.json node build/index.js

Architecture

Deeper reference docs (with diagrams) live in docs/docs/architecture.md for the component map + run_query lifecycle, docs/extending.md for adding an engine. Keep them in sync when the architecture changes.

A read-only MCP server (stdio transport) that exposes SQL queries over PostgreSQL, MySQL, and SQLite to MCP clients (e.g. Cursor). Layers, from entry point outward:

  • src/index.ts — wires everything: load config → build DatabaseRegistry → wrap in DatabaseServiceregisterTools → connect StdioServerTransport.
  • src/config.ts — loads/validates config via Zod. Reads MCP_DB_CONFIG (path to JSON file) first, else MCP_DATABASES (inline JSON). Accepts either { databases: [...] } or a bare array. Enforces unique ids.
  • src/tools/registerTools.ts — the 4 MCP tools (list_databases, list_tables, describe_table, run_query). Each is a thin wrapper that calls DatabaseService and returns the result JSON-stringified into a text content block. Tool input schemas are defined here with Zod.
  • src/services/databaseService.ts — orchestration layer. The only place the read-only SQL guard runs: runQuery calls clampQueryLimit + validateReadOnlySql before dispatching to an adapter. Resolves adapters via getSqlAdapter, which narrows on kind and rejects a non-SQL database_id with a clear error (the routing seam for future non-SQL families).
  • src/adapters/registry.ts — maps database_id → adapter instance (typed AnyDatabasePort), lazily constructing and caching adapters (and their connection pools) on first use.
  • src/adapters/{postgres,mysql,sqlite}.ts — per-engine implementations of SqlDatabasePort.
  • src/core/databasePort.ts — the thin DatabasePort base (id, type, kind, close) shared by every family, the DatabaseKind discriminant (currently just "sql"), and AnyDatabasePort (the union of all port families). Port-family model: relational engines share one SqlDatabasePort (kind: "sql") because they share a model; non-relational engines are intentionally not grouped under a "nosql" port — each would get its own port/family (e.g. a future MongoDbPort with kind: "mongodb"), its own read-only guard, and its own service, since they share no common vocabulary.
  • src/core/sqlDatabasePort.ts + src/core/types.ts — the SqlDatabasePort interface (extends DatabasePort) every SQL adapter implements, plus shared types. This is the seam: code above the adapters is engine-agnostic.

Read the full file on GitHub · 53 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. 4d ago First seen · 53 lines · 1,567 tokens per session scan B 92d5b7573914

Subscribe to this mod's changes

mcp-multi-db AGENTS.md is an instructions file published in the GitHub repository mahAnuj/mcp-multi-db (1 stars, last pushed 5d ago), licensed ISC. It adds 1,567 tokens to every session, about $0.0078 per session on Opus 5. A static security scan graded it B with 1 finding (asks for root). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.