Connect OpenCode to your database.
Use the OpenCode CLI and provider accounts already on your machine. Valv detects the CLI, gives it read-only tools for your databases, and shows every query and result in a desktop client.
Already have Valv? Go to the setup steps.
OpenCode handles the analysis. Valv handles the database connection.
Ask OpenCode inside Valv, with tables, charts, files, and the current selection beside the chat. Valv connects that chat to every database in the active workspace.
Use your existing provider logins.
Valv starts the local OpenCode CLI with its saved provider login. Pick from the models available to those accounts when you begin a chat. Usage stays with the provider you choose.
Existing provider login · no AI key in Valv
Ask about the data in front of you.
OpenCode can inspect the allowed schema, query live data, and use the table open in Valv. Its answers link back to the query result behind each finding.
Source: cancellation totals · 4 rows
Setup
From an installed OpenCode CLI to your first database answer.
You connect OpenCode to Valv, not directly to a database password. The setup takes place on your machine.
- 1
Install OpenCode and connect a provider.
Valv uses the local
opencodecommand and the provider logins saved by OpenCode. Check that the command is available before opening Valv.
OpenCode installation guideopencode --version - 2
Pick OpenCode in Valv.
Valv scans the same shell environment you use in a terminal. Pick OpenCode during onboarding. If you installed it afterwards, open Settings, Providers, then select Re-scan.
- 3
Add your database.
Paste a PostgreSQL, MySQL, or ClickHouse connection string, try the experimental MongoDB support, or choose a local SQLite file. You can test the connection before saving. Valv stores secrets with your OS keychain.
postgres://user:password@host:5432/database - 4
Review AI access, then ask.
Valv makes the schemas you selected available to OpenCode. Before the first question, hide any table or column it should not inspect. Then open Ask and choose OpenCode for the new chat.
Which customer segments grew fastest this quarter?
The database tools are read-only.
OpenCode can discover the allowed schema and compose structured queries. Valv validates each query before it reaches the database. OpenCode does not receive tools to insert, update, delete, or run raw SQL.
Hide data before OpenCode discovers it.
AI access is separate from your own access in Valv. Hide a whole table or individual columns such as email and card number. You can still open that data yourself in the read-only table viewer.
AI access
OpenCode inside Valv
Valv attaches database tools for each chat.
Valv starts OpenCode through ACP in build mode and passes it a temporary, authenticated connection to the current workspace. The connection is scoped to that chat, so there is no MCP file to maintain.
OpenCode starts in the workspace files folder. Valv uses a clean session with your saved provider login, without project configuration, plugins, external skills, or sharing.
Current workspace
Files and connected databases
Valv tools
Discover, query, cite
OpenCode and your database, answered
How do I connect OpenCode to a database?
Install OpenCode and connect a model provider, then open Valv Desktop. Valv detects the OpenCode CLI on your machine. Pick OpenCode as your agent, add a database, review its AI access, and ask your first question. You do not paste database credentials into OpenCode.
Do I need to configure MCP in OpenCode?
No, not for chat inside Valv. Valv starts OpenCode through the Agent Client Protocol and injects an authenticated MCP connection pinned to that chat's workspace. For agents you run outside Valv, the MCP Server page in Settings exposes whichever workspace is active while the app is open.
Which model does OpenCode use through Valv?
Valv lists the models available through the provider accounts connected to OpenCode. You choose a model when you start a chat, and usage stays with that model provider. Valv does not add a separate AI charge.
Can OpenCode write to my database?
No. The database tools Valv gives OpenCode are read-only. OpenCode can inspect the allowed schema and run structured queries, but it does not receive database write tools. Valv's own table viewer is read-only too, so nothing in Valv writes to your database.
Which databases work with OpenCode through Valv?
PostgreSQL, MySQL and MariaDB, SQLite, and ClickHouse are supported. MongoDB support is experimental. You can connect more than one database to the same workspace and ask OpenCode to work across them.
What data is sent to my model provider?
Valv keeps database credentials in your OS keychain and never sends them to OpenCode or a model provider. Valv queries the database from your machine. The allowed schema, your question, and the query results needed for the answer are processed by the model provider you selected, under that provider's settings and terms.
What OpenCode configuration does Valv use?
Valv keeps the provider login from your OpenCode installation, but starts a clean OpenCode session for its in-app chat. Project configuration, plugins, external skills, sharing, and automatic updates are disabled for that session.
Put OpenCode to work on your data.
Free for personal use, every feature included. Commercial use needs a seat at beta pricing. See pricing.