DocsReference
View as MarkdownMCP server
Connect Claude and other AI assistants to KeelDB through the remote MCP server to create, branch, inspect and query databases.
KeelDB runs a remote Model Context Protocol server. Connect an AI assistant to it and the assistant can list, create, branch, inspect and query your databases with the same rules as the REST API.
Endpoint and authentication
| URL | https://keeldb.com/api/mcp |
| Transport | Streamable HTTP, stateless (no session id). Responses are plain JSON. |
| Authentication | Authorization: Bearer keel_xxx with an API key |
| Rate limit | 120 requests per minute per key, bursts of 60, separate from the REST API budget |
The server acts on the API key's organization. Tool results are JSON text. When a tool fails (for example a limit is reached or the database isn't running), the result is marked as an error and the message explains why, so the assistant can tell you. An invalid argument is named in the message (Invalid input: name: Name must be at least 2 characters). The result's structured content carries the REST API's error with its HTTP status: a 4xx asks for different arguments, a 5xx for a retry.
Set up
Create a dedicated API key for each assistant under API keys in the console, for example "Claude Code on my laptop".
Claude Code
export KEELDB_API_KEY=keel_xxx
claude mcp add --transport http keeldb https://keeldb.com/api/mcp --header "Authorization: Bearer $KEELDB_API_KEY"Clients that support remote HTTP servers with headers
Most clients that can connect to remote MCP servers take a configuration like this:
{
"mcpServers": {
"keeldb": {
"type": "http",
"url": "https://keeldb.com/api/mcp",
"headers": {
"Authorization": "Bearer keel_xxx"
}
}
}
}Check your client's documentation for the file location and exact keys.
Clients that only start local servers
If your client can only launch local (stdio) servers, for example through claude_desktop_config.json in Claude Desktop, bridge to the remote server with mcp-remote:
{
"mcpServers": {
"keeldb": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://keeldb.com/api/mcp", "--header", "Authorization:${KEELDB_AUTH_HEADER}"],
"env": {
"KEELDB_AUTH_HEADER": "Bearer keel_xxx"
}
}
}
}Keeping the header value in an environment variable avoids problems with spaces inside args on some clients.
Tools
Database ids look like k7m2x9qa4pz1. Tools that return databases use the database object from the REST API. A tool that reads what a REST endpoint reads returns that endpoint's data with the same fields: regions, databases, branches, moves, snapshots, schedules, backups, jobs and extensions.
| Tool | What it does | Arguments |
|---|---|---|
list_plans | The catalog: Free, Launch, and every Dedicated size and topology with its price and whether it can be ordered now. Read-only. | None |
list_regions | Providers and locations, and whether each is available (as in List regions). Read-only. | None |
list_databases | All databases and branches in the organization. Read-only. | None |
get_database | Status, plan, hosts and storage of one database, with its move between plans as tier_move while one is under way and, on Free, free_usage (as in Get a database). Read-only. | id |
get_free_usage | Where the organization's Free databases stand against the Free limits this month (as in Get Free usage). Read-only. | |
create_database | Creates a database. Launch and Scale bill usage; Dedicated bills each node for every started hour, never more than its monthly node price in a calendar month, with extra storage, backup storage and egress billed on top. | name (2 to 48 characters), plan (free, launch, scale or dedicated, default free), size and topology (Dedicated only), region (default us-east, the region available today), postgres_version (18, 17 or 16, default 18) |
update_database | Renames, moves between plans, toggles the pooler, sets read replicas, the IP allowlist, a Launch database's autoscaling range, warm floor, scale to zero and what it does at the spend limit, deletion protection, protection (Launch and Dedicated), a branch's expiry, the slow query threshold of its logs or what a single-copy database does when its data center is lost. | id, and any of name, plan, size, topology, pooler_enabled, read_replicas (0 to 3), ip_allowlist (array, replaces the list), scale_to_zero_minutes (Launch, or null for always on), on_limit (Launch: hold_min or suspend), min_cu and max_cu (Launch: the autoscaling range; a new range restarts PostgreSQL once), warm_floor (Launch: true keeps a small warm instance while idle, false sleeps at once), deletion_protection, protected, expires_at, relocation (relocate or wait), slow_query_ms (100 to 60,000, or null for 1,000) (as in the REST API) |
move_database | Moves a database between Free or Launch and Dedicated, or back to Launch, with the same hostname. Says in its result whether a move started or the change applied in place (as in the REST API). | id, plan, size and topology (Dedicated only) |
get_tier_move | Progress of the latest move: state, estimated copy time, lag, switch-over and rollback window, or null when the database never moved. Read-only. | id |
cancel_tier_move | Cancels a move before its switch-over. Marked destructive. | id |
delete_database | Deletes a database. Marked destructive. Refused while deletion protection is on or the database is protected. | id, confirm_name (must equal the database's name) |
create_branch | Copies a database now, or as of a past moment within its restore window. | id, name (2 to 48 characters), at (optional ISO 8601 time), plan (optional), expires_at (optional, at most 30 days ahead) |
list_branches | Direct branches of a database. Read-only. | id |
get_connection_string | Connection URIs (direct, pooled, read-only) including the password. Logged in the audit log. | id |
run_sql | Runs SQL as the database owner: 30 second timeout, 500 rows per result. | id, sql, read_only (default true) |
get_insights | Slowest queries, table sizes, unused indexes, cache hit ratio and live sessions. Read-only. | id |
get_metrics | Database size, sessions and commits per second on the primary, one sample every 5 minutes while the database runs (see Metrics). Read-only. | id, range (1h, 24h, 3d, 7d, 14d or 30d, default 24h) |
get_logs | The database's PostgreSQL logs, newest first: errors and warnings, slow queries and sessions, including the SQL run with run_sql (application keeldb-sql; see PostgreSQL logs). Read-only. | id, and any of kind (array of error, slow_query, connection), since, until, min_duration_ms, search, limit (default 50), cursor |
get_compute_metrics | CPU and memory of the primary against its allocation, its cache hit ratio, sessions and commits per second, per minute up to per hour (see Metrics). Read replicas are not included. Read-only. | id, range (1h, 24h, 3d, 7d, 14d or 30d, default 24h) |
list_extensions | The extension catalog, or with id that database's catalog with each extension's status. Read-only. | id (optional) |
enable_extension | Has KeelDB install a managed extension (and what it requires) in a database; one that needs a preloaded library (pg_cron, TimescaleDB) restarts the database once. Check with list_extensions. | id, name (for example vector, postgis, pg_cron, timescaledb) |
disable_extension | Has KeelDB drop a managed extension. Refused while objects in the database use it. Marked destructive. | id, name |
list_backups | Backups with status and restore test results (as in List backups). Read-only. | id |
list_snapshots | A database's snapshots, newest first, with what each holds and its size. Read-only. | id |
create_snapshot | Takes a named snapshot, kept until deleted. Billed per GB-month on Launch and Dedicated. | id, name (1 to 63 characters) |
restore_snapshot | Restores a ready snapshot into a new branch or a new database, with its own hostname and password. | snapshot_id, target (branch or database), name (2 to 48 characters) |
delete_snapshot | Deletes a snapshot. Marked destructive. | snapshot_id, confirm_name (must equal the snapshot's name) |
get_backup_schedule | The daily, weekly and monthly snapshot schedules and their next runs. Read-only. | id |
set_backup_schedule | Launch and Dedicated: turns schedules on or off and sets how many snapshots each keeps. | id, and any of daily, weekly, monthly (each enabled, keep), hour_utc, weekday, month_day |
run_operation | Restarts, fails over, takes a backup or rotates the password. Returns job_id and status (as in Start an operation). | id, kind (restart, failover, backup or rotate_password) |
get_job | Status of an operation started with run_operation (the job object of Get a job). Read-only. | job_id |
The rules and limits are the REST API's: see Branching, Limits and Run a query.
Safety
- Deleting needs the exact name.
delete_databaseanddelete_snapshotonly delete whenconfirm_namematches the name; otherwise they returndeleted: falsewith the expected name. The server also tells assistants to get your explicit confirmation before calling destructive tools. Read what your assistant proposes before you approve it. - SQL is read-only by default.
run_sqlusesread_only: trueunless the assistant sets it tofalse. A read-only run takes one statement, in a read-only transaction that is never committed, on a read-only instance when the database has one, and that statement cannot lift it. The one exception is an extension that opens its own connection, such asdblink: what it does on that connection is outside the run. Approve writes deliberately. - Some tools disrupt running apps.
run_operationwithrotate_passwordmakes the old password stop working within seconds, andrestartorfailoverdrop connections (a restart of a single-copy database refuses new ones until it is back, usually within a minute). - Connection strings are secrets.
get_connection_stringreturns the password into the conversation. Avoid it when the assistant doesn't need to connect directly. - Use a dedicated API key. A key can do what its role and permissions allow, which can include deleting databases; give an assistant a key limited to what it needs (for example
db.readonly). Give each assistant its own key, so you can revoke it on its own and see its actions in the audit log, shown as "API key" and its name to owners, admins and developers, and as "API key" to billing members. - Mind the bill.
create_database,create_branchandrestore_snapshotcan start paid databases, which are billed hourly until deleted; snapshots and schedules add snapshot storage;protected: truekeeps a Launch database's compute on.