Skip to Content
DBVision

MCP Server & Clients

Connect Claude Code or Codex to DBVision's Streamable HTTP MCP server with OAuth 2.1, consent, and per-client grants.

DBVision exposes a remote MCP server at POST /mcp secured by OAuth 2.1 (Better Auth). External AI clients such as Claude Code and Codex can inspect schemas and run read-only queries according to each connection's AI data mode and per-client grant.

Prerequisites

  • Set BETTER_AUTH_URL to the public origin your browser and MCP client reach (for example https://dbvision.example.com or http://localhost:3000 locally), with scheme and host only. HTTPS is required outside loopback.
  • Restart DBVision after setting BETTER_AUTH_URL. When unset, DBVision does not serve /mcp or OAuth discovery routes.
  • Ensure you have a DBVision user account.

Connect Claude Code

claude mcp add --transport http dbvision https://dbvision.example.com/mcp
claude mcp login dbvision

Use --scope user to share across projects or --scope project to write to .mcp.json.

Connect Codex

codex mcp add dbvision --url https://dbvision.example.com/mcp
codex mcp login dbvision

For headless environments, pass --no-browser to codex mcp login dbvision, open the printed URL in a browser, and paste the callback URL back into the terminal. Codex supports both Client ID Metadata Documents (CIMD) and Dynamic Client Registration (DCR).

  1. An unauthenticated POST /mcp returns 401 with a WWW-Authenticate header pointing to /.well-known/oauth-protected-resource/mcp.
  2. The client identifies itself via CIMD or public DCR (with HTTPS or loopback HTTP redirect URIs).
  3. On the consent page, review the client name, redirect host, and requested permissions, and select which saved connections the client may access.
  4. DBVision enforces that per-user, per-client grant on every /mcp request.

Available MCP tools

ToolPurpose
list_connectionsLists authorized connections (id, name, engine).
list_tablesLists tables and views of a connection, optionally filtered by schema.
describe_tableReturns columns, primary key, indexes, and foreign keys of a table or view.
sample_rowsReads the first rows of a table or view (subject to AI data mode).
run_queryRuns one read-only SQL statement and returns up to 100 rows (subject to AI data mode).

Serialized row arrays are capped at 64 KiB (truncated is set when rows are omitted), and the HTTP request body is capped at 1 MiB.

AI data modes

Modesample_rowsrun_query
Schema only (default)Refused with data-mode-forbids-rowsColumn metadata, retained row count, and truncated flag; no row values
Sample rowsUp to 20 rowsUp to 20 rows
Query resultsUp to 20 rowsUp to 100 rows

Manage and revoke clients

Open Settings → MCP clients in DBVision to inspect authorized clients, their registration type, last-used timestamp, and granted connections, or to revoke a client's access immediately. Revocation deletes the grant, consent, and stored tokens in one transaction.

On this page