Mode Analytics MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Mode Analytics MCP Server fetch the latest results for the Weekly Revenue report"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Mode Analytics MCP Server
An MCP server that lets you browse reports, manage queries, and fetch results from Mode Analytics from any MCP-compatible AI assistant or agent.
Tools
Tool | Description |
| List all database connections in the workspace |
| List all spaces (collections) |
| List reports in a given space (archived ones hidden unless |
| Search for reports by name or description across all spaces (client-side; archived ones hidden unless |
| Get report details including its SQL queries and who wrote each one |
| List recent runs for a report (state, timestamps) |
| Fetch results from a specific or latest report run |
| Create a new report in a space, optionally with initial queries |
| Update a report's name, description, or move it to a different space |
| Archive (hide) a report — reversible |
| Restore an archived report |
| Permanently delete a report (preview first, then confirm). Off unless |
| Add a SQL query to an existing report |
| Update a query's SQL, name, or data source |
| Permanently delete a query (preview first, then confirm). Off unless |
Related MCP server: Looker MCP Server
Setup
1. Get Mode API credentials
Use a Member API key (recommended). Create your own under Workspace Settings > Personal > My API Keys and save the token and secret. Member keys respect your own Mode permissions, so the agent can only see and change what you can. If you can't create one, a Workspace admin needs to enable them under Workspace Settings > Features > API Keys > Member keys.
Mode also offers Workspace API tokens, created by admins under Workspace Settings > Privacy & Security > API. These act with admin access to the whole Workspace, so only use one if you need that — see Limitations / Safety below. (Older personal API tokens can no longer be created, but existing ones keep working.)
Both kinds of key expire after 90 days by default. When yours expires, the server reports "Authentication failed"; create a new key and update your MCP config.
2. Install uv
The server is launched with uvx, which comes with uv. Install it with brew install uv or curl -LsSf https://astral.sh/uv/install.sh | sh.
3. Add the server to your MCP client
The server runs over stdio via uvx mode-mcp. Add it to your MCP client's config; most clients use this mcpServers shape:
{
"mcpServers": {
"mode-analytics": {
"command": "uvx",
"args": ["mode-mcp"],
"env": {
"MODE_WORKSPACE": "your-workspace-name",
"MODE_API_TOKEN": "${MODE_API_TOKEN}",
"MODE_API_SECRET": "${MODE_API_SECRET}"
}
}
}
}uvx installs the package from PyPI on first run and reuses that version afterwards. To pick up new releases automatically, use "args": ["mode-mcp@latest"] instead.
The ${MODE_API_TOKEN} / ${MODE_API_SECRET} references are expanded from your shell environment by clients that support it, so no secrets land in the config file. Set them wherever you keep shell secrets, e.g. in ~/.zshrc:
export MODE_API_TOKEN="..."
export MODE_API_SECRET="..."Env var syntax differs by client
Some clients expand ${VAR}, some use another syntax (e.g. ${env:VAR}), and some don't expand references at all; check your client's docs. If a reference isn't expanded, the server stops at startup with an error naming the variable, rather than failing later with a confusing authentication error.
Environment Variables
Variable | Required | Description |
| Yes | Your Workspace's username, as in |
| Yes | API token (from a Member API key, ideally) |
| Yes | API secret |
| No | Set to |
| No | Set to |
| No | Comma-separated tool names to disable, e.g. |
Choosing which tools are available
Disabled tools are never registered, so the agent doesn't see them at all.
Default: everything except the two delete tools. The agent can browse, author, and archive, but can't permanently delete anything.
Allow deletes: add
"MODE_ENABLE_DELETES": "true"toenv.Read-only: add
"MODE_READ_ONLY": "true"to only allow browsing and fetching results.Anything else: list tool names in
MODE_DISABLED_TOOLS.
A misspelled tool name in MODE_DISABLED_TOOLS stops the server with an error rather than silently leaving the tool enabled.
Limitations / Safety
No query execution. The server deliberately does not expose a "run this query" tool. The Mode API has no endpoint for running a single query — the only way to execute SQL is POST /reports/{token}/runs, which runs every query in the report at once. On reports with many or expensive queries, that's slow, costly, and impossible to predict from the agent's side. Instead, the server focuses on browsing, authoring, and fetching results:
Write and manage SQL queries through your agent, then run them in Mode's UI where costs and side effects are visible.
Use
get_run_resultsto pull results from completed runs back into the conversation.
Deletes are permission-scoped, not owner-scoped. The server does not check who created a report or query; what you can delete is whatever your API token is allowed to delete in Mode. With a Member API key that's limited to your own permissions, but a Workspace API token has admin access and can delete any report or query in the Workspace. That's why the delete tools are off unless you set MODE_ENABLE_DELETES=true.
Deletes can't skip the preview. When enabled, delete_report and delete_query are always two calls:
The first call deletes nothing. It returns a preview (the report's name, whether it's already archived, and its queries with who wrote each one; or a query's name, author, and SQL) plus a short
confirm_code. Mode's API doesn't say who created a report, only who wrote each query.The delete only happens when the same tool is called again with that
confirm_code. The code is a fingerprint of what the preview showed, so it can't be guessed, and if the report or query changed after the preview (renamed, SQL edited, queries added), the code no longer matches and the delete is refused.
Archive instead of delete. archive_report hides a report and unarchive_report brings it back. The delete tool tells the agent to suggest archiving first.
Credentials never touch the committed config. The ${MODE_API_TOKEN} / ${MODE_API_SECRET} references in your MCP config are expanded from your shell environment at launch (in clients that support it), so the file is safe to commit. Keep the raw secrets in env vars and don't commit them.
Development
git clone https://github.com/nataliemona/mode_mcp.git
cd mode_mcp
uv sync --dev
uv run pytestAvailable Tools
13 toolsadd_queryB
Add a SQL query to an existing report.
This is a write operation — it adds a new query to the report.
Args: report_token: The report to add the query to. raw_query: SQL query text. data_source_id: Data source ID (use list_data_sources to find it). name: Optional query name.
Inputs: raw_query (required), report_token (required), data_source_id (required), name. Returns: object
archive_reportA
Archive a report, hiding it from view. Reversible with unarchive_report.
This is the safe alternative to delete_report.
Args: report_token: The report to archive.
Inputs: report_token (required). Returns: object
create_reportA
Create a new report in a space, optionally with initial SQL queries.
This is a write operation — it creates a report visible to the workspace.
If any queries fail to add, the report is still created; inspect
queries_added and queries_failed in the result.
Args: space_token: Space to create the report in (use list_spaces to find it). name: Report name. description: Optional report description. queries: Optional list of queries to add. Each dict should have: - raw_query (str): The SQL text. - data_source_id (int): Data source ID (use list_data_sources). - name (str, optional): Query name.
Inputs: name (required), space_token (required), queries, description. Returns: object
get_reportC
Get a report's details and its queries (SQL).
Args: report_token: The report token.
Inputs: report_token (required). Returns: object
get_run_resultsA
Get results from a report run. Defaults to the latest run.
Each query's rows are truncated to max_rows_per_query by default so a
single call can't blow past the agent's context window. When a query was
truncated, the result includes truncated: true and row_count: <total>
so you know to re-call with a higher limit (or null) if you need all rows.
Args: report_token: The report token. run_token: Specific run token. If omitted, uses the latest succeeded run. max_rows_per_query: Max rows to return per query. Default 500. Pass null to fetch every row — can be very large (hundreds of MB) for dashboards with long time-series or wide cross-tabs.
Inputs: report_token (required), run_token, max_rows_per_query. Returns: result
list_data_sourcesA
List database connections in the Mode workspace.
Args: limit: Max number of results to return (default 50).
Inputs: limit. Returns: result
list_report_runsC
List recent runs for a report.
Args: report_token: The report token. limit: Max number of runs to return (default 10).
Inputs: report_token (required), limit. Returns: result
list_reportsA
List reports in a space. Archived reports are hidden unless include_archived.
Args:
space_token: Space token (use list_spaces to find it).
limit: Max number of results to return (default 50).
include_archived: Also return archived reports (each has an archived flag).
Inputs: space_token (required), limit, include_archived. Returns: result
list_spacesB
List spaces (collections) in the Mode workspace.
Args: limit: Max number of results to return (default 50).
Inputs: limit. Returns: result
search_reportsA
Search for reports by name or description across all spaces.
Mode's REST API has no native report-search endpoint, so this fans out across every space and filters client-side (case-insensitive substring match on name and description). May be slow on large workspaces. Archived reports are skipped unless include_archived.
Args:
query: Search term to match against report names and descriptions.
limit: Max number of results to return (default 50).
include_archived: Also return archived reports (each has an archived flag).
Inputs: query (required), limit, include_archived. Returns: result
unarchive_reportC
Restore an archived report.
Args: report_token: The report to unarchive.
Inputs: report_token (required). Returns: object
update_queryA
Update a SQL query in a report.
This is a write operation — it modifies an existing query.
Args: report_token: The report containing the query. query_token: The query to update (use get_report to find query tokens). raw_query: New SQL text. Omit to leave unchanged. name: New query name. Omit to leave unchanged. data_source_id: New data source ID. Omit to leave unchanged.
Inputs: query_token (required), report_token (required), name, raw_query, +1 more. Returns: object
update_reportB
Update a report's name, description, or move it to a different space.
This is a write operation — it modifies an existing report.
Args: report_token: The report to update. name: New report name. Omit to leave unchanged. description: New description. Omit to leave unchanged. space_token: Move report to this space. Omit to leave in current space.
Inputs: report_token (required), name, description, space_token. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 13 tools
Each tool targets a distinct resource and action: reports (create/get/update/archive/unarchive/list/search), queries (add/update), and read-only listings (spaces, data sources, runs, run results). The archive/unarchive pair and list_reports vs search_reports are clearly distinguished by scope and description, leaving no real overlap.
All 13 tools follow a strict snake_case verb_noun convention (create_report, update_query, list_spaces, get_run_results, etc.), including consistent use of the archive/unarchive antonym pair. No mixing of styles or verb conventions.
At 13 tools, the set is well-scoped for a report/query management domain, with each tool earning its place and no redundant operations. It stays comfortably within the ideal 3-15 range.
Report lifecycle is well covered (create, get, update, list, search, archive, unarchive), plus query add/update and run inspection. Minor gaps remain: there is no delete_query to remove a query from a report, and no tool to trigger a report run even though run-result and run-list tools exist.
Maintenance
Related MCP Connectors
Governed app access for AI agents: 1,000+ apps & 12,000+ tools via Code Mode MCP.
Hosted MCP server for marketing agencies: connect Google Ads, GA4, Search Console, Meta, LinkedIn and more to Claude or ChatGPT. Pull reports and make changes via OAuth login, no setup.
Your org's AI agents, tasks, runs, search, and brain files as MCP tools and resources.
Query your warehouse or a CSV with Claude/ChatGPT over MCP, governed by table-level ACL + audit.
Related MCP Servers
- AlicenseAqualityBmaintenanceConnects Google Analytics 4 data to Claude, Cursor and other MCP clients, enabling natural language queries of website traffic, user behavior, and analytics data with access to 200+ GA4 dimensions and metrics.121,117 PyPI244MIT
- AlicenseAqualityBmaintenanceProvides AI assistants direct access to Looker through a standard MCP interface, enabling querying the semantic model, managing content, editing LookML, and administering users.33147 PyPI1Apache 2.0
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to query live schema, lineage, and query-context across data warehouses, dbt projects, orchestration systems, and BI tools via MCP tools.Apache 2.0
- FlicenseNot gradedqualityCmaintenanceEnables governed, read-only SQL analytics, hybrid RAG knowledge search, financial metric calculation, and database schema introspection through MCP, with role-based access control, audit logging, and AI observability.-