Zoho Analytics MCP Server
Enables AI agents to create and edit Zoho Analytics chart reports, run SQL queries, and browse workspaces and views using natural language.
README
Zoho Analytics MCP Server
A FastMCP server that exposes Zoho Analytics as a set of AI-callable tools. It supports creating and editing interactive chart reports, querying data via SQL, and browsing workspaces and views — all from an LLM like Claude.
Features
- Create chart reports — bar, line, pie, scatter, bubble, and all Zoho subtypes
- Edit chart reports — update axis, chart type, or title on an existing report
- Query data — run SQL SELECT queries against any workspace table
- List workspaces — enumerate all workspaces in your Zoho organisation
- Search views — find tables, charts, and dashboards by name or type
- Get view details — inspect column names, data types, and axis config
- Auto token refresh — OAuth2 refresh-token flow with one-retry on expiry
- Interactive chart rendering — charts are rendered via a custom HTML viewer embedded in the MCP app
Project Structure
MCP_server_with_edit_file/
├── server.py # Entry point — registers and runs the MCP server
├── column.py # Standalone debug script to inspect columns in a view
├── pyproject.toml # Project metadata and dependencies
├── requirements.txt # Pip-installable dependencies
├── .env # Credentials (not committed — see setup below)
└── src/
├── tools.py # All 6 MCP tool definitions (create, edit, query, etc.)
├── auth.py # OAuth2 TokenManager (refresh-token flow)
├── config.py # Settings loaded from .env + singleton token manager
├── chart_viewer.html # HTML app used to render charts inline in the MCP client
├── __init__.py
└── utils/
├── zoho_client.py # Async HTTP helpers for Zoho Analytics REST API v2
└── __init__.py
Prerequisites
- Python 3.11 or higher
- A Zoho Analytics account (India DC —
zoho.in) - A Zoho OAuth2 Self Client with the following scope:
ZohoAnalytics.fullaccess.all - Your Client ID, Client Secret, and a Refresh Token
Setup
1. Clone / copy the project
cd "C:/Users/ruban/OneDrive/Desktop/zoho analytics/MCP_server_with_edit_file"
2. Create a virtual environment and install dependencies
python -m venv .venv
.venv\Scripts\activate # Windows
# source .venv/bin/activate # macOS / Linux
pip install -r requirements.txt
3. Configure credentials
Create a .env file in the project root (next to server.py):
ANALYTICS_CLIENT_ID=your_client_id
ANALYTICS_CLIENT_SECRET=your_client_secret
ANALYTICS_REFRESH_TOKEN=your_refresh_token
ANALYTICS_ORG_ID=your_org_id
# Optional — defaults to Zoho India DC
ANALYTICS_ACCOUNTS_URL=https://accounts.zoho.in
ANALYTICS_BASE_URL=https://analyticsapi.zoho.in
Note: To get a refresh token, create a Self Client in the Zoho API Console, generate a grant code with the scope above, then exchange it for a refresh token.
Running the Server
Development mode (hot-reload + web UI on port 8080)
fastmcp dev server.py
Production / stdio mode (for use with Claude Desktop or other MCP clients)
fastmcp run server.py
Available Tools
create_chart_report
Creates a new chart report in a Zoho Analytics workspace and renders it interactively.
| Parameter | Type | Description |
|---|---|---|
workspace_id |
str |
Target workspace ID |
table_name |
str |
Base table name (exact, case-sensitive) |
chart_name |
str |
Name for the new report |
chart_details |
dict |
chartType, x_axis, y_axis |
filters |
list[dict] (optional) |
Filter conditions |
org_id |
str (optional) |
Defaults to ANALYTICS_ORG_ID in .env |
Example chart_details:
{
"chartType": "bar",
"x_axis": { "columnName": "Region", "operation": "actual" },
"y_axis": { "columnName": "Sales", "operation": "sum" }
}
edit_chart_report
Updates an existing chart report (axis, chart type, title) using a PUT request.
| Parameter | Type | Description |
|---|---|---|
workspace_id |
str |
Workspace that owns the chart |
view_id |
str |
ID of the report to update |
chart_name |
str |
New title for the report |
chart_details |
dict |
Same structure as create_chart_report |
filters |
list[dict] (optional) |
Filter conditions |
org_id |
str (optional) |
Defaults to ANALYTICS_ORG_ID in .env |
query_data
Executes a SQL SELECT query against a workspace table.
SELECT "Region", SUM("Sales") FROM "Untitled-1" GROUP BY "Region"
Column and table names must be enclosed in double quotes.
get_workspace_list
Returns all workspaces in the organisation with their IDs and names.
search_views
Searches for views (tables, charts, dashboards) within a workspace.
view_type_ids value |
Meaning |
|---|---|
0 |
Table |
2 |
Chart |
6 |
Query table |
get_view_details
Returns full metadata for a view: column names, data types, report type, chart type, axis config, etc. Call this before edit_chart_report to inspect the current configuration.
Debugging Column Names
Zoho column names are case-sensitive. Use column.py to list exact column names for any view:
.venv\Scripts\python column.py
This fetches a fresh token and prints a table of all columns with their exact names and data types. Copy-paste from this output into chart_details.
Known columns in Untitled-1:
| Column Name | Data Type |
|---|---|
Date |
Date |
Region |
String |
Product Category |
String |
Product |
String |
Customer Name |
String |
Sales |
Numeric |
Cost |
Numeric |
Valid Chart Types
Some of the supported chartType values:
bar, horizontal bar, stacked bar, line, smooth line, line with points, area, stacked area, pie, ring, semi pie, scatter, bubble, packed bubble, funnel, pyramid, heat map, combo, web, map area, map bubble, map filled, geo heat map, table chart
Valid Axis Operations
| Category | Operations |
|---|---|
| String | actual, count, distinctCount |
| Numeric | sum, average, min, max, count, distinctCount, stdDev, median, variance |
| Date | year, monthYear, quarterYear, weekYear, fullDate, dateTime, quarter, month, week, weekDay, day, hour |
Authentication Flow
config.pyloads credentials from.envand creates a singletonTokenManager.- Before every API call,
token_manager.ensure()fetches and caches an access token (if not already present). - If Zoho returns error code
8535(token expired) or HTTP401, the client callstoken_manager.refresh()and retries the request once automatically. - All token refresh calls are protected by an
asyncio.Lockso concurrent tool calls share a single refresh.
Common Errors
| Error Code | Meaning | Fix |
|---|---|---|
8050 |
Unknown column name | Use column.py or get_view_details to get exact column names |
7111 |
Report name already exists | Use a different chart_name or call search_views to find the existing report |
7103 |
Workspace not found | Check workspace_id — get it from the Zoho Analytics URL |
8535 |
Access token expired | Handled automatically; if it persists, check your refresh token |
8525 |
URL rule not configured | The API endpoint doesn't exist for your account/DC — check ANALYTICS_BASE_URL |
Tech Stack
| Library | Role |
|---|---|
| FastMCP | MCP server framework |
| httpx | Async HTTP client for Zoho API calls |
| python-dotenv | .env credential loading |
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.