db-mcp AGENTS.md

db-mcp AGENTS.md is an instructions file for Codex, OpenCode from hc-hyun/db-mcp. It costs 2,576 tokens per session, scanned A, original, MIT.

Repository instructions for postgres-mcp, a service that lets an agent ask questions in natural language, generate SQL, and run one parameterized PostgreSQL query against a selected data source. PostgreSQL is a relational database system, and SQL is the language commonly used to query it.

In plain words
What is it for?
Use them when changing postgres-mcp, especially its contracts, architecture, service boundaries, deployment files, or database-query behavior.
Why use it?
They tell an agent which project documents to read, what the service is allowed to do, and which files or generated data it must not treat as work targets.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: reads ~/.codex or $CODEX_HOME, but also the file is AGENTS.md. Also seen: positional $N argument; mentions AGENTS.md; mentions Codex.

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

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

README.md
[![agentmods](https://agentmods.dev/badge/instructions/hc-hyun/db-mcp/agents-md.svg)](https://agentmods.dev/instructions/hc-hyun/db-mcp/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/hc-hyun/db-mcp/agents-md"><img src="https://agentmods.dev/badge/instructions/hc-hyun/db-mcp/agents-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 2,576 This file is loaded in full into every session.
When invoked 2,576 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.1 $0.02576 $0.02576
Opus 5 $0.01288 $0.01288
Sonnet 5 $0.00515 $0.00515
Haiku 4.5 $0.00258 $0.00258

Measured 5d ago against content hash 9db45cdd93de, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

db-mcp AGENTS.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 5d 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.

AGENTS.md · 251 lines

How it starts

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

AGENTS.md

Scope

This file applies to the entire repository. If a more specific AGENTS.md is added under a subdirectory, its instructions supplement and take precedence within that subtree.

Understand the Project First

postgres-mcp is a small text-to-SQL backend that exposes multiple PostgreSQL data sources through one stateless Streamable HTTP MCP endpoint. The MCP host's AI interprets natural language and generates SQL. This server exposes the real database catalog and executes one parameterized PostgreSQL statement against one selected data source inside a constrained transaction.

Before making changes, read the following in order as relevant to the task:

  1. README.md: external contracts, configuration, and usage
  2. docs/service-boundaries.md: what the service does and does not own
  3. docs/architecture-v0.4.0.md: component responsibilities and operational invariants
  4. docs/code-story-ko.md: the end-to-end flow of one request
  5. For deployment changes only: docs/deployment.md, Dockerfile, and deploy/k8s/postgres-mcp.yaml

Do not treat the local .env, generated dist/ artifacts, .runtime/ logs, or cache directories as work targets.

Fixed Product Boundaries

The following are intentional product invariants. Do not add options or compatibility paths for them unless the requirements explicitly change.

  • The public MCP surface consists of exactly two tools: search_objects and execute_sql.
  • The server does not provide a separate MCP prompt, a general-purpose REST API, or a web UI.
  • The executable is postgres-mcp. The transport is stateless Streamable HTTP, the path is /mcp, and responses are JSON.
  • Database configuration comes only from the TOML file referenced by POSTGRES_MCP_CONFIG. The process does not load .env implicitly or fall back to CLI arguments or DSN environment variables.
  • TOML contains host, port, database, execution policies, and the names of credential environment variables. Usernames and passwords are read from the environment and must not appear in public results or representations.
  • PostgreSQL is the only supported database. Do not introduce a common driver, adapter, or backend layer until a real second database requirement exists.
  • One SQL statement runs against exactly one data source. Cross-source joins and transactions are outside this service's responsibility.
  • Each source creates its pool lazily on first use. Concurrent first access to the same source is serialized by one lock. A connection that fails to initialize is not stored in the registry.
  • MCP requests are stateless, but the process owns and reuses pools until shutdown.
  • /healthz reports process liveness. /readyz reports that configuration has loaded and the server can accept requests. Readiness must not preconnect to every database.
  • Safe defaults include read-only transactions, prepared statements, $1-style parameters, row limits, and statement and connection timeouts.
  • PostgreSQL permissions, TLS, and user authentication belong to PostgreSQL and the gateway or ingress. Application settings do not replace those controls.

Read the full file on GitHub · 251 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. 5d ago First seen · 251 lines · 2,576 tokens per session scan A 9db45cdd93de

Subscribe to this mod's changes

db-mcp AGENTS.md is an instructions file published in the GitHub repository hc-hyun/db-mcp (0 stars, last pushed 1mo ago), licensed MIT. It adds 2,576 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.