valv

sh.valv由 valv.sh 發布v0.6.2更新於 Oct 24, 2026

Let coding agents query any SQL database safely. Read-only by default and scoped by your policies.

已驗證STDIO僅桌面資料庫開發者工具

概覽

AI 產生的概覽

本機 MCP 伺服器,讓編碼助理以預設唯讀、依策略限定的方式瀏覽並查詢 SQL 資料庫。

可以做什麼
  • 列出並搜尋所連資料庫所暴露的資料表與集合
  • 描述資源結構,讓助理了解其欄位
  • 在允許的資料表上執行查詢,模型無須撰寫 SQL
  • 透過資料表允許清單、排除清單或策略模組限制可見範圍,隱藏欄位並過濾資料列
  • 可選擇以 Streamable HTTP 取代 stdio 提供服務,並提供引導式安裝來寫入用戶端設定
適用情境
適合希望助理根據即時 PostgreSQL、MySQL、SQLite、CockroachDB、ClickHouse 或 MongoDB 資料庫回答問題,又不想把原始 SQL 或完整寫入權限交給它的情境。
執行需求
透過 npx 在本機執行(需要 Node.js)。需要 DATABASE_URL 連線字串;ClickHouse 或 MongoDB 的 URL 未指定資料庫時還需 VALV_DATABASE。選用變數:VALV_PROVIDER、VALV_TABLES、VALV_EXCLUDE、VALV_POLICY_FILE、VALV_CONTEXT、VALV_HTTP_PORT。需要能連線至該資料庫的網路。
安裝前請注意
DATABASE_URL 通常含有資料庫憑證,請使用最小權限帳號。未設定 VALV_POLICY_FILE 時伺服器對所有資料表唯讀開放,建議以 VALV_TABLES、VALV_EXCLUDE 或策略模組限定範圍。策略模組是可完全掌控存取權限的程式碼。查詢結果會傳送給模型供應商。init 指令會修改用戶端設定檔。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 valv,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

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

[npm] [license]

Guided setup

The fastest way in — it probes your database, lets you choose access, and writes the config:

bash
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):

json
{  "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:

json
"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:

json
"env": { "DATABASE_URL": "mongodb://localhost:27017", "VALV_DATABASE": "analytics" }

Configuration

All via environment variables:

VariableDescription
DATABASE_URLConnection string (required; or pass as the first CLI arg).
VALV_PROVIDERpostgresql | mysql | sqlite | mongodb | clickhouse. Inferred from the URL when omitted.
VALV_DATABASEDatabase name for ClickHouse or MongoDB.
VALV_TABLESComma-separated allow-list — only these tables are exposed.
VALV_EXCLUDEComma-separated deny-list, applied after the allow-list.
VALV_POLICY_FILEPath to a policy module (below) for tenant scoping / hidden fields.
VALV_CONTEXTJSON context the policy reads (e.g. {"tenant":{"id":"acme"}}).
VALV_HTTP_PORTServe 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:

js
// valv.policy.cjsmodule.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

來源:packages/mcp/README.md,提交 90d585d

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.6.2最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分