valv MCP server
Let coding agents query any SQL database safely. Read-only by default and scoped by your policies.
5 stars30 downloads/wk
Reviews
Write oneNobody has reviewed valv yet.
If you have run it, two minutes of your experience saves the next person an afternoon.
valv tools
No tool declarations could be read from the package source. They show once the server is installed.
Public scan report
scanner v0.1.9 · 2026-09-24 · same rubric, same numbers if you re-run it
- Code scan11 source files scanned25/25
- –Live reliabilityno gateway calls yet and no remote to proben/a
- –Tool poisoningtools not inspected (local package is not executed); not countedn/a
- Auth qualitystatic API keys via environment variables6/15
- Maintenancelast push 13 days ago15/15
- Maintainer identitynamespace and repository owner differ; website matches verified namespace6/10
What the publisher says
From the valv repository's README, as published. We do not edit it. Read it on GitHub
valv
Let agents query your database. Just not all of it.
valv gives an agent structured tools to read your database — and, opt-in, to write to it. The model emits a structured query (or insert/update/delete) — never a native database command — and valv validates it against your schema, scopes it to the current user with policies you write in code, compiles it for your database, and runs it.
The model's query is treated as fully untrusted. It can't read a column you hid, a row the user isn't allowed to see, call a function you didn't allow, write a column you didn't permit, or escape its tenant on a write. Valv rebuilds and checks the query on the server before it reaches the database adapter.
const valv = await createValv(client, { schema: "introspect", defaultPolicy: "deny-all" })
valv.policy("orders", (ctx) => ({
read: { tenant_id: ctx.tenant.id }, // every read is scoped to this tenant
fields: { deny: ["internal_notes"] }, // this column never reaches the model
}))
const tools = await valv.tools.aisdk(ctx) // hand to your agent — it queries safelyTwo ways to use it
- In your app. Configure valv in code, write policies against your request context, and hand the tools to your agent — Vercel AI SDK, Anthropic, OpenAI, or Gemini. Or expose those same tools over MCP with @valv/mcp-sdk, scoped per request.
- With a coding agent. Point @valv/mcp at a database and a tool like Claude Code queries it safely — no code required.
Quick start
Install an adapter for your database (it pulls in @valv/core):
npm i @valv/clickhouse @clickhouse/client # ClickHouse
# or
npm i @valv/prisma @prisma/client # Postgres / MySQL / SQLite
# or
npm i @valv/mongodb mongodb # MongoDBWire it up — connect, write a policy, hand the tools to an agent:
import { createValv } from "@valv/clickhouse"
import { generateText, stepCountIs } from "ai"
// 1. Connect — introspect the live schema (or pass a hand-defined one).
const valv = await createValv(client, { schema: "introspect", defaultPolicy: "deny-all" })
// 2. Policy — what this caller may read, resolved from your context.
valv.policy("orders", (ctx) => ({ read: { tenant_id: ctx.tenant.id } }))
// 3. Tools — bound to the request's context, formatted for your provider.
const ctx = { user: { id: "u1", role: "analyst" }, tenant: { id: "acme" } }
const { text } = await generateText({
model,
system: await valv.instructions(ctx), // how to drive the tools + the caller's resources
tools: await valv.tools.aisdk(ctx),
stopWhen: stepCountIs(6),
prompt: "What's our revenue per order status this month?",
})The agent gets four tools — listresources, searchresources, describe_resource, and query — discovers your schema, and runs a query. valv scopes it to acme, compiles it to ClickHouse SQL, runs it, and hands back rows.
What the agent can express
One query tool covers the whole read surface. The grammar is Prisma-idiomatic — a shape models already know cold — and desugars server-side into a checked query:
Shortened. The full README is on GitHub.
Nothing above is checked by us. What we check is on the safety report.
Install directly
Runs npx -y @valv/mcp on your machine. Read the scan report first; the gateway never runs local packages.
claude mcp add mcp -- npx -y @valv/mcp
valv: common questions
- Is valv MCP server safe?
- Mostly: it is graded B (80/100). Read the valv safety report
- How do I install valv?
- It runs on your machine. Copy the Claude Code, Claude Desktop or Cursor config from the install section.
- Does valv need an API key?
- Yes. The registry entry asks for
DATABASE_URL. - Is valv maintained?
- The last commit was 13 days ago (2026-09-11). The latest release is v0.6.2.
- What can I use instead of valv?
- Servers from other publishers that do the same job: DBHub MCP server, LINQ to DB MCP server and Magic Cloud MCP server. Compare all valv alternatives.
Alternatives to valv
Same job from other publishers: the closest match first, then the best rated.
- DBHubToken-efficient database MCP server for PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, SQLitenot reviewedWidely usedA
- LINQ to DBInspect database schemas and execute SQL queries across multiple database providers with LINQ to DB.not reviewedEstablishedA
Magic CloudGenerate secured CRUD APIs over your database, run SQL, manage files, tasks and a headless browsernot reviewedEstablishedA- InfrawiseLive AWS, database & Kafka infrastructure context for AI coding assistants via MCP.not reviewedGrowingA
- MakoExplore your databases, validate SQL, and build & publish data apps in your Mako workspace.not reviewedGrowingA