Allows coding agents to query SQL and NoSQL databases safely using read-only tools and policy-based access control.
別名 valv-dev/valv, mcp, @valv/mcp
- スター
- 5
- ツール
- —
- ダウンロード数(30日間)
- —
- 最新バージョン
- 0.6.2
- 最終コミット
- 2026年10月2日
- ライセンス
- MIT
valv MCPとは
valvはMCPサーバーです。 Allows coding agents to query SQL and NoSQL databases safely using read-only tools and policy-based access control.
プロジェクトのREADMEから生成された概要
valv MCP server について
Querying live databases through coding agents without exposing raw SQL or risking data modification is what valv enables. Developers can connect this server to PostgreSQL, MySQL, SQLite, CockroachDB, ClickHouse, or MongoDB using a connection string. It functions as a read-only bridge that introspects your schema and provides four specific tools: list_resources, search_resources, describe_resource, and query.
Setup is handled via npx or manual configuration in files like .mcp.json for clients such as Claude Desktop, Claude Code, Cursor, or Codex. You can control access through environment variables like VALV_TABLES to allow-list specific tables or VALV_EXCLUDE to deny-list them. For more granular security, a policy file can hide specific columns or restrict row access based on a provided JSON context. This ensures the model only interacts with the data you explicitly permit while preventing it from ever seeing or executing raw SQL commands.
できること
- 1Secure database schema explorationAsk an AI agent to discover the structure and available tables within a production database.
- 2Restricted data retrievalInstruct an agent to fetch specific records while ensuring sensitive columns remain hidden from the model.
- 3Automated data reportingHave a coding agent transform database query results into interactive HTML charts and reports.
- 4Multi-tenant data isolationUse policy files to ensure an agent only accesses data belonging to a specific tenant or user.
プロジェクトの README から作成されています。すべてのユースケースは、その引用と照らし合わせて確認されています。
valv MCPのインストール方法
フォーマット検証日 2026年11月10日Claude Codeにvalv MCPをインストール
$ claude mcp add --env DATABASE_URL=<YOUR_DATABASE_URL> mcp -- npx -y @valv/mcpCursorにvalv MCPをインストール
~/.cursor/mcp.json
{
"mcpServers": {
"mcp": {
"command": "npx",
"args": [
"-y",
"@valv/mcp"
],
"env": {
"DATABASE_URL": "<YOUR_DATABASE_URL>"
}
}
}
}VS Codeにvalv MCPをインストール
.vscode/mcp.json
{
"servers": {
"mcp": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@valv/mcp"
],
"env": {
"DATABASE_URL": "<YOUR_DATABASE_URL>"
}
}
}
}Claude Desktopにvalv MCPをインストール
claude_desktop_config.json
{
"mcpServers": {
"mcp": {
"command": "npx",
"args": [
"-y",
"@valv/mcp"
],
"env": {
"DATABASE_URL": "<YOUR_DATABASE_URL>"
}
}
}
}Codexにvalv MCPをインストール
~/.codex/config.toml
[mcp_servers.mcp] command = "npx" args = ["-y", "@valv/mcp"] [mcp_servers.mcp.env] DATABASE_URL = "<YOUR_DATABASE_URL>"
Gemini CLIにvalv MCPをインストール
~/.gemini/settings.json
{
"mcpServers": {
"mcp": {
"command": "npx",
"args": [
"-y",
"@valv/mcp"
],
"env": {
"DATABASE_URL": "<YOUR_DATABASE_URL>"
}
}
}
}設定
DATABASE_URL必須シークレットDatabase connection string. PostgreSQL, MySQL, SQLite, CockroachDB, or a ClickHouse HTTP URL.
VALV_CONTEXTJSON context object the policy reads, e.g. {"tenant":{"id":"acme"}}.
VALV_DATABASEDatabase name. Required for ClickHouse, whose URL does not carry one.
VALV_EXCLUDEComma-separated deny-list of tables, applied after the allow-list.
VALV_HTTP_PORTServe over Streamable HTTP on this port instead of stdio.
VALV_POLICY_FILEPath to a policy module that takes full control of access. Without it, the server is read-only across all tables.
VALV_PROVIDERDatasource provider: postgresql, mysql, sqlite, or clickhouse. Inferred from DATABASE_URL when omitted.
VALV_TABLESComma-separated allow-list of tables. When set, only these are exposed to the agent.
| 名前 | 説明 | 種類 |
|---|---|---|
| DATABASE_URL | Database connection string. PostgreSQL, MySQL, SQLite, CockroachDB, or a ClickHouse HTTP URL. | 必須シークレット |
| VALV_CONTEXT | JSON context object the policy reads, e.g. {"tenant":{"id":"acme"}}. | |
| VALV_DATABASE | Database name. Required for ClickHouse, whose URL does not carry one. | |
| VALV_EXCLUDE | Comma-separated deny-list of tables, applied after the allow-list. | |
| VALV_HTTP_PORT | Serve over Streamable HTTP on this port instead of stdio. | |
| VALV_POLICY_FILE | Path to a policy module that takes full control of access. Without it, the server is read-only across all tables. | |
| VALV_PROVIDER | Datasource provider: postgresql, mysql, sqlite, or clickhouse. Inferred from DATABASE_URL when omitted. | |
| VALV_TABLES | Comma-separated allow-list of tables. When set, only these are exposed to the agent. |
自動チェック
実行日 2026年11月14日詳細レポート →自動チェックに合格しました。これはセキュリティ監査ではありません。コードを読み、サーバーに必要最小限のアクセス権を与えてください。 チェックの仕組み
- ソースリポジトリがリンクされており、アクセス可能valv-dev/valv is public and reachablegithub.com/valv-dev/valv ↗合格
- パッケージがこのリポジトリをソースとして示している@valv/mcp names valv-dev/valv as sourcenpmjs.com/package/@valv/mcp ↗合格
- ビルドの来歴(Sigstore 証明)No build attestation published for this release未チェック
- オープンソースライセンス (OSI)MITspdx.org/licenses/MIT.html ↗合格
- 過去1年以内にコミットまたはリリースありLast commit or release 2026-10-02github.com/valv-dev/valv ↗合格
- OpenSSF Scorecard未チェック
- パッケージ名が有名なパッケージに酷似していないNo popular package one edit away from @valv/mcp合格
- パッケージと依存関係に重大なアドバイザリがない130 resolved dependencies checked; no critical advisoryosv.dev ↗合格
- モデルへの隠れた指示がない0 tool descriptions and the README read; no override phrases, credential paths or hidden characters合格
- 破壊的なツールがラベル付けされている未チェック
- リモート endpoint が MCP ハンドシェイクに応答する未チェック
README
GitHubで見る@valv/mcp
Point it at a database URL. Your agent queries it safely. No SQL, no code.
A zero-config MCP server built on valv. Give it a connection string and it introspects your live schema, serves four tools (list_resources, search_resources, describe_resource, query) read-only by default, and enforces your policies — no SQL ever reaches the model, and it can only read what you allow.
Works with PostgreSQL, MySQL, SQLite, CockroachDB, ClickHouse, and MongoDB.
Guided setup
The fastest way in — it probes your database, lets you choose access, and writes the config:
npx @valv/mcp init
It takes either a connection string or individual fields (host, port, user, password, database), confirms the dialect, connects and shows your tables, then offers read-only / pick-tables / a policy-file stub. It then merges the server entry into the client of your choice — Claude Code, Claude Desktop, Cursor, or Codex — at project or global scope, leaving any existing config in place. Lastly it offers to install the valv skill, which teaches the agent how to query valv and turn results into interactive chart-report HTML files — as a skill for Claude Code (.claude/skills), Codex (.agents/skills), or Cursor (.cursor/skills), at project or global scope. Finally it can copy a kickstart prompt to your clipboard — paste it into your agent to explore the schema (seeding .valv/notes.md for future queries) and generate a single interactive valv-map.html overview of the database.
Manual setup
Add it to your .mcp.json (or Claude Desktop config):
{
"mcpServers": {
"db": {
"command": "npx",
"args": ["-y", "@valv/mcp"],
"env": { "DATABASE_URL": "postgresql://user:pass@localhost:5432/mydb" }
}
}
}
For ClickHouse, use its HTTP URL and a database name:
"env": { "DATABASE_URL": "http://localhost:8123", "VALV_DATABASE": "analytics" }
For MongoDB, use a standard connection string. Set VALV_DATABASE when the
URL does not select a database:
"env": { "DATABASE_URL": "mongodb://localhost:27017", "VALV_DATABASE": "analytics" }
Configuration
All via environment variables:
| Variable | Description |
|---|---|
DATABASE_URL |
Connection string (required; or pass as the first CLI arg). |
VALV_PROVIDER |
postgresql | mysql | sqlite | mongodb | clickhouse. Inferred from the URL when omitted. |
VALV_DATABASE |
Database name for ClickHouse or MongoDB. |
VALV_TABLES |
Comma-separated allow-list — only these tables are exposed. |
VALV_EXCLUDE |
Comma-separated deny-list, applied after the allow-list. |
VALV_POLICY_FILE |
Path to a policy module (below) for tenant scoping / hidden fields. |
VALV_CONTEXT |
JSON context the policy reads (e.g. {"tenant":{"id":"acme"}}). |
VALV_HTTP_PORT |
Serve over Streamable HTTP on this port instead of stdio. |
Policy file
Without one, access is read-only across all tables. To restrict what the agent can see — which tables, which columns — point VALV_POLICY_FILE at a module that receives the configured valv instance:
// valv.policy.cjs
module.exports = (valv) => {
valv.policy("orders", () => ({
read: true, // allow reads (or { column: value } to filter rows)
fields: { deny: ["internal_notes"] }, // hide columns from the agent
}))
// Tables without a policy are denied (deny-all).
}
Need per-request row scoping by tenant/user? That belongs in the app-controlled path, where your code supplies real identity per request — use @valv/mcp-sdk (or pass a fixed VALV_CONTEXT and read it in the policy here).
License
MIT
valv MCPのよくある質問
valv MCPをClaude Codeに追加するには
ターミナルでclaude mcp add --env DATABASE_URL=<YOUR_DATABASE_URL> mcp -- npx -y @valv/mcpを実行します。すべてのプロジェクトで利用するには--scope userを追加します。
valv MCPをCursorに追加するには
~/.cursor/mcp.jsonを開き、上記のインストールセクションに示すCursor設定を使ってmcpServersの下にサーバーを追加します。
Which databases are supported?
The server works with PostgreSQL, MySQL, SQLite, CockroachDB, ClickHouse, and MongoDB.
Is the database access read-only?
Yes, the server provides tools that are read-only by default to ensure safety.
How can I restrict which tables or columns an agent can see?
You can use a policy file to define specific access rules, such as allowing reads on certain tables or denying specific columns.
Can I use this with MongoDB?
Yes, you can use a standard connection string for MongoDB and set the VALV_DATABASE variable if the URL does not select a database.