What is MCP
The Model Context Protocol (MCP) is an open standard for connecting AI agents to external tools and data sources.

TenantsDB exposes 26 tools through an MCP server. AI clients like Claude Desktop, Claude.ai, Cursor, and any MCP-compatible app can discover and call these tools once connected via OAuth. Tool calls are authenticated with OAuth access tokens and scoped to the project the user approved.

Learn more about MCP at modelcontextprotocol.io. TenantsDB implements the Streamable HTTP transport per the MCP specification.

Server URL
One endpoint. Every MCP client connects here.
MCP Endpoint
https://api.tenantsdb.com/mcp

Clients discover the OAuth endpoints via RFC 9728 Protected Resource Metadata:

Discovery
GET https://api.tenantsdb.com/.well-known/oauth-protected-resource

Authentication
Every tool call is authenticated with an OAuth 2.0 access token.

Clients include a Bearer token on every request:

HTTP Header
Authorization: Bearer tdb_oat_...

Tokens expire after 1 hour. MCP clients refresh them automatically using the refresh token they received during OAuth. See Build an Integration for the OAuth flow.


Tool Annotations
Each tool declares metadata that helps AI clients reason about safety and behavior.
AnnotationMeaning
ReadOnlyHint Tool does not modify any state. Safe to retry, safe to call without confirmation.
DestructiveHint Tool performs irreversible changes. Client should confirm with the user before calling.
OpenWorldHint Tool fetches data from the open internet. Results may be non-deterministic.

Workspaces
Tools for managing and inspecting workspaces.
READ list_workspaces
Returns all workspaces in the current project, including mode (tenant or control), database type, and creation date.
Input

No parameters.

Output
{
  "count": 2,
  "workspaces": [
    {
      "id": "orders",
      "name": "orders",
      "database": "PostgreSQL",
      "mode": "tenant",
      "version": "1.5",
      "created_at": "2026-04-06T06:56:20Z"
    }
  ]
}
READ get_workspace
Returns detailed info for one workspace, including the full schema with tables, columns, and constraints.
Input
FieldTypeDescription
workspace_id string required ID of the workspace.
Output
{
  "id": "orders",
  "database": "PostgreSQL",
  "mode": "tenant",
  "schema": {
    "tables": [
      {
        "name": "users",
        "columns": [
          { "name": "id", "data_type": "INTEGER", "constraint": "PRIMARY KEY" }
        ]
      }
    ]
  }
}
READ get_workspace_schema
Returns only the schema of a workspace. Same as get_workspace but without metadata. Useful when the AI just needs table structure.
Input
FieldTypeDescription
workspace_id string required ID of the workspace.
WRITE create_workspace
Creates a new workspace. Mode must be either tenant or control.
Input
FieldTypeDescription
namestringrequiredUnique workspace name within the project.
databasestringrequiredOne of: PostgreSQL, MySQL, MongoDB, Redis.
modestringrequiredEither tenant or control.
READ get_workspace_diff
Returns the list of pending schema changes (DDLs) in a tenant workspace that have not yet been deployed to tenants.
Input
FieldTypeDescription
workspace_idstringrequiredID of the tenant workspace.
WRITE query_workspace_dev
Runs a SQL or DDL query against the development workspace (not tenant data). Use this to design and test schema changes before deploying.
Input
FieldTypeDescription
workspace_idstringrequiredID of the workspace.
querystringrequiredSQL or DDL statement to execute.

Blueprints
Versioned schema snapshots that get deployed to tenants.
READ list_blueprints
Returns all blueprints in the project with their latest versions.
Input

No parameters.


Tenants
Isolated databases for your customers. One tenant per customer.
READ list_tenants
Returns all tenants, optionally filtered by blueprint.
Input
FieldTypeDescription
blueprintstringoptionalFilter by blueprint name.
READ get_tenant
Returns full tenant details including status, isolation level, databases, and recovery info.
Input
FieldTypeDescription
tenant_idstringrequiredTenant identifier.
WRITE create_tenant
Creates a new tenant and provisions its databases from the specified blueprints.
Input
FieldTypeDescription
tenant_idstringrequiredUnique tenant identifier.
databasesarrayrequiredList of database configurations. Each must include blueprint and optional isolation_level (1 or 2).
WRITE suspend_tenant
Blocks all queries to a tenant. Data is preserved. Reversible with resume_tenant.
Input
FieldTypeDescription
tenant_idstringrequiredTenant to suspend.
WRITE resume_tenant
Restores query access to a suspended tenant.
Input
FieldTypeDescription
tenant_idstringrequiredTenant to resume.
WRITE create_backup
Triggers an on-demand backup for a tenant.
Input
FieldTypeDescription
tenant_idstringrequiredTenant to back up.
READ list_backups
Returns all backups for a tenant with timestamps, sizes, and storage paths.
Input
FieldTypeDescription
tenant_idstringrequiredTenant identifier.
READ get_tenant_logs
Returns recent query logs for a tenant. Useful for debugging and auditing.
Input
FieldTypeDescription
tenant_idstringrequiredTenant identifier.
limitintegeroptionalMax entries to return (default 100).
READ get_tenant_metrics
Returns query volume, latency, and error counts for a tenant.
Input
FieldTypeDescription
tenant_idstringrequiredTenant identifier.

Deployments
Deploying blueprint changes to tenants.
READ list_deployments
Returns recent deployments across all blueprints.
Input

No parameters.

READ get_deployment_status
Returns detailed status for one deployment job, including per-tenant progress.
Input
FieldTypeDescription
deployment_idstringrequiredID returned by deploy_blueprint.
WRITE deploy_blueprint
Deploys the current version of a blueprint to one or more tenants. Returns a deployment job ID for progress tracking.
Input
FieldTypeDescription
blueprint_namestringrequiredName of the blueprint to deploy.
tenant_idsarrayoptionalSpecific tenants. If omitted, deploys to all tenants running this blueprint.
versionstringoptionalSpecific version. Defaults to latest.

Data Queries
Query tenant data. DDL statements are blocked automatically.
WRITE query_tenant
Runs a query against one tenant's isolated database. Works for PostgreSQL, MySQL, MongoDB, and Redis.
Input
FieldTypeDescription
blueprintstringrequiredBlueprint name (identifies which database type).
tenant_idstringrequiredTarget tenant.
querystringrequiredSQL, MongoDB command, or Redis command.
Example
Input
{
  "blueprint": "orders",
  "tenant_id": "acme",
  "query": "SELECT id, email, name FROM users WHERE role = 'admin' LIMIT 5"
}
WRITE query_all_tenants
Runs the same query across every tenant in a blueprint. Returns per-tenant results in one response. Useful for cross-tenant reporting.
Input
FieldTypeDescription
blueprintstringrequiredBlueprint to query across.
querystringrequiredQuery to run on every tenant.

READ search_tenant
Keyword search across one tenant's data.
Input
FieldTypeDescription
blueprintstringrequiredBlueprint name.
tenant_idstringrequiredTarget tenant.
querystringrequiredSearch query.
READ search_all_tenants
Keyword search across every tenant in a blueprint.
Input
FieldTypeDescription
blueprintstringrequiredBlueprint name.
querystringrequiredSearch query.
READ ai_search_tenant
Semantic (vector) search across one tenant's data.
Input
FieldTypeDescription
blueprintstringrequiredBlueprint name.
tenant_idstringrequiredTarget tenant.
querystringrequiredNatural language query.
READ ai_search_all_tenants
Semantic search across every tenant in a blueprint.
Input
FieldTypeDescription
blueprintstringrequiredBlueprint name.
querystringrequiredNatural language query.

Docs
Search the TenantsDB documentation.
READ search_docs
Searches the TenantsDB docs live from docs.tenantsdb.com. Useful for answering questions about TenantsDB itself, not about your data.
Input
FieldTypeDescription
querystringrequiredKeywords to search the docs for.
limitintegeroptionalMax results (default 3).
This tool has the OpenWorldHint annotation since it fetches data from the web.