Dory Docs
Reference

MCP / Agent Access

Dory exposes an MCP endpoint so external AI agents can safely read Dory connections, inspect schema, read saved queries, inspect monitoring summaries, run limited read-only SQL, and build analysis context.

Use cases

  • Query Dory connections from Codex, Claude, or another MCP-capable client.
  • Search tables, views, and columns before writing SQL.
  • Read table structure, DDL, statistics, and previews.
  • Run read-only SQL with bounded result size.
  • Build analysis context or chart recommendations from query results.
  • Read database monitoring summaries where supported.

Create an access token

  1. Open Dory settings.
  2. Go to Agent Access.
  3. Enter a token name such as Codex or Claude Desktop.
  4. Create the token.
  5. Copy the full token. It is only shown once.

Tokens use the dory_mcp_ prefix. If you lose the full token, revoke it and create a new one.

Default scopes

New tokens include the following read and analysis scopes:

ScopeCapability
connections:readRead connection, database, and table metadata.
query:readPreview tables and run read-only SQL.
analysis:runBuild result context, chart profiles, and analysis actions.
schema:readSearch schema and read table profiles.
saved_queries:readRead saved queries.
monitoring:readRead monitoring summaries and slow or failed query samples.

MCP tools do not return database passwords or connection secrets.

Codex CLI example

export DORY_MCP_TOKEN="dory_mcp_xxx"
codex mcp add dory --url https://your-dory.example.com/api/mcp --bearer-token-env-var DORY_MCP_TOKEN
codex mcp list

Use a separate token for each client and revoke tokens that are no longer needed.

Generic MCP JSON example

{
  "mcpServers": {
    "dory": {
      "type": "http",
      "url": "https://your-dory.example.com/api/mcp",
      "headers": {
        "Authorization": "Bearer ${DORY_MCP_TOKEN}"
      }
    }
  }
}

Available tools

ToolPurpose
dory_list_connectionsList visible Dory connections.
dory_list_databasesList databases for a connection.
dory_list_tablesList tables and views for a database.
dory_describe_tableRead columns, types, and table metadata.
dory_get_database_summaryBuild a high-level database summary.
dory_get_table_profileRead table profile and statistics.
dory_search_schemaSearch schema by table, view, or column name.
dory_list_saved_queriesList saved queries available to the token.
dory_get_saved_queryRead one saved query.
dory_get_monitoring_summaryRead monitoring summaries where supported.
dory_preview_tablePreview rows from a table.
dory_run_readonly_sqlExecute read-only SQL with row limits.
dory_build_result_contextConvert result data into agent-friendly context.
dory_build_chart_profileBuild chart suggestions from result shape.
dory_run_analysisRun a higher-level analysis action.

dory_run_readonly_sql rejects write statements and limits returned rows. Database-level read-only credentials are still recommended for production data.

Agent workflow

  1. Use dory_list_connections to choose the right connection.
  2. Use dory_list_databases and dory_list_tables to locate relevant objects.
  3. Use dory_describe_table or dory_search_schema before writing SQL.
  4. Use dory_preview_table for small row samples.
  5. Use dory_run_readonly_sql for reviewed SELECT queries.
  6. Use dory_build_result_context or dory_build_chart_profile to summarize results.

Security guidance

  • Create one token per client so audit and revocation are simple.
  • Do not commit tokens to source control.
  • Store tokens in environment variables or the client secret store.
  • Revoke tokens when a client, laptop, or teammate no longer needs access.
  • Use read-only database users for production connections.
  • Treat schema names and sample rows as sensitive if they reveal customer or business data.

Troubleshooting

SymptomLikely causeFix
MCP client returns 401Missing or invalid token.Recreate the token and update the client environment.
Client cannot list connectionsToken is missing connections:read or user has no access.Create a token from the right Dory account and organization.
SQL is rejectedStatement is not read-only or contains unsupported syntax.Use a plain SELECT query and remove write operations.
Too few rows returnedMCP row limits are applied.Aggregate in SQL or narrow the query before requesting more rows.
Client cannot connectURL is wrong or Dory is not reachable from the client.Verify the /api/mcp URL in a reachable environment.

On this page