Skip to main content
Glama
NitinSharma077-echo

Zoho CRM MCP Server

Zoho CRM MCP 服务器(FastAPI + FastMCP)

一个基于 FastAPI + FastMCP 构建的生产级模型上下文协议(MCP)服务器,为 Claude 和其他 AI 客户端提供对 Zoho CRM REST API v8 的完整、经过身份验证的访问——从读取记录到设计模块和编写工作流自动化。

167 个 MCP 工具,涵盖记录、COQL、架构设计、工作流规则及其操作、Webhook、批量/大规模操作、标签、备注、电子邮件、安全设置以及批量导入/导出——此外还有一个通用的 zoho_api_request 逃生通道,用于访问 Zoho 暴露但尚无专用工具的任何功能。


🌟 主要特性

  • FastAPI Web 框架: 高性能、生产就绪的 ASGI 应用,由 Uvicorn 驱动。

  • 双传输模式: 既可作为 Streamable HTTP MCP 服务器(用于远程/云托管)运行,也可作为 STDIO MCP 服务器(用于本地 Claude Desktop)运行。

  • 完整的 OAuth 2.0 生命周期: 自动代码交换、浏览器重定向处理程序(/auth/callback)、加密令牌存储,以及一个在服务器运行期间保持令牌新鲜的后台循环。

  • 可通过聊天配置凭据: 通过聊天提供 Zoho 客户端 ID/密钥(set_zoho_credentials,或直接在 get_auth_url/exchange_auth_code 中内联提供),而无需使用 .env——便于在不重启的情况下切换 Zoho 账户。

  • 完整的自动化编写能力: 端到端构建工作流规则——创建字段更新、邮件通知、任务和 Webhook 操作,然后通过触发器和条件将其接入规则。

  • 架构设计: 创建自定义模块(包含 Zoho 强制要求的配置文件)、字段、全局选择列表、布局和销售管道。

  • 作用域会话模式: 基于 ID 的安全过滤器(activate_scope),将操作限制在特定记录 ID 范围内。

  • 人工审批(HITL): 破坏性操作会排队等待审批请求,而不是直接执行。可通过 ZOHO_REQUIRE_APPROVAL 切换。

  • 结构化活动日志: 每个认证事件、API 调用和审批决策均以 JSON 格式记录,可通过 get_logs() / GET /logs 检索。

  • 加密令牌存储: OAuth 令牌在静态存储时加密(Fernet/AES),绝不使用明文。

  • 弹性网络客户端: 池化 httpx 客户端,具有自动 401 刷新重试、429 限流退避、指数 5xx 重试、出站速率限制器,以及针对 Zoho 逐记录响应的部分失败检测。

  • 自动化测试套件: 35 个 pytest 测试,涵盖 HTTP 表面、工具注册、请求负载结构和客户端防护。


Related MCP server: Zoho CRM MCP Server

📁 仓库结构

zoho-crm-mcp/
├── server.py              # FastAPI app + all FastMCP tool definitions & REST endpoints
├── auth_manager.py        # OAuth 2.0 flow, scopes & token refresh
├── zoho_client.py         # Async HTTP client for Zoho CRM API v8 (151 methods)
├── models.py              # Pydantic state & validation models
├── token_store.py         # Encrypted (Fernet) token persistence
├── approval_manager.py    # HITL approval queue for high-risk actions
├── activity_log.py        # Structured JSON activity logger
├── test_server.py         # pytest suite
├── requirements.txt       # Dependencies
├── .env.example           # Environment configuration template
├── pyproject.toml         # Package metadata
└── README.md

⚙️ 设置与安装

1. 前置条件

  • Python 3.10+

  • 一个 Zoho CRM API 控制台应用(Zoho API 控制台

    • 客户端类型: 基于服务器的应用

    • 重定向 URI: http://localhost:8000/auth/callback(或您的部署回调 URL)

2. 环境设置

cp .env.example .env

最低配置:

ZOHO_CLIENT_ID=1000.xxxxxxx
ZOHO_CLIENT_SECRET=xxxxxxx
ZOHO_REDIRECT_URI=http://localhost:8000/auth/callback
ZOHO_DATA_CENTER=com
PORT=8000

有关所有支持的变量(包括审批门控、OAuth 作用域覆盖、速率限制和超时设置),请参阅 .env.example

需要同时使用多个 Zoho 账户? ZOHO_CLIENT_ID/ZOHO_CLIENT_SECRET 是可选的。将其留空,让 Claude 调用 set_zoho_credentials(client_id, client_secret, redirect_uri?, data_center?),或者将 client_id/client_secret 直接传递给 get_auth_url / exchange_auth_code。切换 client_id 会清除为先前账户保存的令牌,从而避免因重用颁发给其他应用的刷新令牌而触发 Zoho 的 invalid_client 错误。

3. 安装依赖

pip install -r requirements.txt

🚀 运行与部署

选项 A:本地 FastAPI Web 服务器

python server.py

或直接使用 Uvicorn:

uvicorn server:app --host 0.0.0.0 --port 8000

运行后:

选项 B:本地 STDIO

python server.py --stdio

选项 C:云部署(Render、Railway、Docker、AWS、Heroku)

  • 启动命令: uvicorn server:app --host 0.0.0.0 --port $PORT

  • 健康检查路径: /health

  • 环境变量: 设置 ZOHO_CLIENT_IDZOHO_CLIENT_SECRETZOHO_REDIRECT_URIZOHO_DATA_CENTERZOHO_TOKEN_ENCRYPTION_KEY(以便令牌在临时文件系统上重启后仍然有效)。


🖥️ Claude Desktop 集成

模式 1:HTTP / 远程 MCP 连接

{
  "mcpServers": {
    "zoho-crm": {
      "url": "http://localhost:8000/mcp"
    }
  }
}

模式 2:本地 STDIO 连接

{
  "mcpServers": {
    "zoho-crm": {
      "command": "python",
      "args": ["C:/Users/Lenovo/Desktop/zoho MCP/server.py", "--stdio"],
      "env": {
        "ZOHO_CLIENT_ID": "1000.YOUR_CLIENT_ID",
        "ZOHO_CLIENT_SECRET": "YOUR_CLIENT_SECRET",
        "ZOHO_REDIRECT_URI": "http://localhost:8000/auth/callback",
        "ZOHO_DATA_CENTER": "com"
      }
    }
  }
}

🔑 首次运行 OAuth 流程

  1. 启动服务器:python server.py

  2. 打开 http://localhost:8000/auth/url,或让 Claude 运行 get_auth_url()

  3. 打开返回的 URL,登录 Zoho CRM,点击 接受

  4. Zoho 重定向到 /auth/callback?code=...;服务器交换代码并将加密令牌保存到 ~/.zoho_crm_tokens.json


🧩 构建自动化:工作流配方

Zoho 将工作流规则建模为触发器条件,其中每个条件指向预先创建的操作对象。请按以下顺序构建:

1. get_workflow_configurations(module="Leads")
   -> see which triggers, comparators, and action types this org supports

2. create_field_update_action(
       name="Mark as Hot", module="Leads",
       field_api_name="Rating", value="Hot")
   -> returns the action id

3. create_workflow(
       name="Hot Lead Router",
       module="Leads",
       execute_when={"type": "create_or_edit"},
       conditions=[{
           "sequence_number": 1,
           "criteria_details": {"criteria": {"group_operator": "and", "group": [
               {"comparator": "equal",
                "field": {"api_name": "Lead_Source"},
                "value": "Web Form"}]}},
           "instant_actions": {"actions": [
               {"id": "<action id from step 2>", "type": "field_updates"}]}}])

4. activate_workflow(workflow_id="...")

同样的模式也适用于以 create_email_notification_actioncreate_automation_taskcreate_webhook 作为操作来源的情况。


🎯 作用域会话模式(安全过滤器)

将所有操作限制在特定记录 ID 范围内:

  • 激活: activate_scope(module="Deals", record_ids=["4153...001", "4153...002"])

  • REST: POST /scope/activate,请求体为 {"module": "Leads", "record_ids": ["123", "456"]}

  • 停用: deactivate_scope()POST /scope/deactivate

激活后,对该模块的读取将被过滤为仅限这些 ID,对任何其他 ID 的写入将被拒绝并返回 OUT_OF_SCOPE


✅ 人工审批(HITL)

默认情况下,破坏性操作会排队等待审批请求并返回 request_id,而不是直接执行:

delete_recordbulk_update_recordsbulk_delete_recordsmass_update_recordsmass_delete_recordschange_ownermass_change_ownermerge_recordsdelete_workflowdelete_workflowsexecute_blueprintupdate_layoutactivate_layoutdelete_layoutdelete_fielddelete_userdelete_tagbulk_write_create_job

  • 查看: list_pending_approvals()GET /approvals

  • 批准并执行: approve_action(request_id="...")POST /approvals/{id}/approve

  • 拒绝并丢弃: reject_action(request_id="...")POST /approvals/{id}/reject

  • 完全禁用门控: 设置 ZOHO_REQUIRE_APPROVAL=false,使这些工具立即执行。

每个请求、批准和拒绝都会写入活动日志。


📜 活动日志

认证事件、出站 Zoho API 调用、函数执行和审批决策均记录为 {timestamp, action, status, details} 条目——保存在内存中并追加到 ~/.zoho_crm_mcp_activity.log.jsonl

  • 检索: get_logs(limit=50, action=None, status=None)GET /logs


🔐 令牌安全

  • 令牌在静态存储时加密(Fernet/AES),保存在 ~/.zoho_crm_tokens.json 中。

  • 密钥在首次运行时自动生成到 ~/.zoho_crm_mcp.key(在 POSIX 系统上仅限当前用户权限),或通过 ZOHO_TOKEN_ENCRYPTION_KEY 显式设置,以便在容器重启时保持密钥稳定。

  • 令牌带有颁发它们的 client_id 标签,不匹配时会被丢弃,这可以防止切换账户后出现 Zoho 的 invalid_client 错误。

  • 出站调用在 429/5xx 退避的基础上还会进行自我限流(ZOHO_RATE_LIMIT_PER_SEC,默认 10 次/秒)。


🧪 测试

pytest -v

涵盖 HTTP 表面(/health//auth/*/scope/*/approvals/*/logs)、全部 167 个 MCP 工具的注册、为工作流/模块/备注/通话/Webhook/合并/锁定发送的确切请求负载、客户端验证防护、速率限制钳制以及 Zoho 部分失败检测。

测试完全离线运行——无需 Zoho 凭据。


🛠️ MCP 工具参考

类别

工具

OAuth 与认证

get_auth_urlexchange_auth_codeset_zoho_credentialsget_auth_statusget_access_tokenrefresh_access_tokenvalidate_tokenget_token_expiry

作用域模式

activate_scopedeactivate_scopeget_scope_status

人工审批与日志

list_pending_approvalsapprove_actionreject_actionget_logs

逃生通道

zoho_api_request — 调用任意 Zoho v8 端点,具备完整的认证/重试处理

记录 CRUD

create_recordget_recordupdate_recorddelete_record†、list_recordssearch_recordsupsert_recordclone_recordget_record_countget_deleted_recordsget_record_timeline

批量(每次调用 ≤100 条)

bulk_create_recordsbulk_update_records†、bulk_upsert_recordsbulk_delete_records

大规模(异步任务)

mass_update_records†、get_mass_update_statusmass_delete_records†、get_mass_delete_statuschange_owner†、mass_change_owner†、merge_records

锁定与共享

lock_recordunlock_recordget_record_locking_infoshare_recordget_shared_record_detailsrevoke_shared_record

关联记录

get_related_recordsget_related_records_countlink_related_recordsdelink_related_record

查询

execute_coqlcomposite_request

元数据与发现

get_modulesget_module_detailsget_fieldsget_field_detailsget_picklist_valuesget_layoutsget_layout_structureget_related_listsget_custom_viewsget_custom_view_detailsget_featuresget_organizationsget_business_hoursget_currenciesget_email_templatesget_recycle_bin

架构设计

create_moduleupdate_modulecreate_fieldcreate_fieldsupdate_fielddelete_field†、get_global_picklistscreate_global_picklistupdate_layout†、activate_layout†、deactivate_layoutdelete_layout†、get_pipelinescreate_pipelineupdate_pipeline

工作流规则

get_workflowsget_workflowget_workflow_configurationscreate_workflowupdate_workflowactivate_workflowdeactivate_workflowdelete_workflow†、delete_workflows

工作流操作

get_field_update_actionscreate_field_update_actionupdate_field_update_actiondelete_field_update_actionget_email_notification_actionscreate_email_notification_actiondelete_email_notification_actionget_automation_taskscreate_automation_taskupdate_automation_taskget_assignment_rules

Webhooks

create_webhookget_webhooksupdate_webhookdelete_webhook

文件

upload_attachmentget_attachmentsdownload_attachmentdelete_attachmentupload_photodelete_photo

备注、通话与邮件

create_noteget_notesupdate_notedelete_notecreate_callsend_mailget_from_addressesget_emails

标签

get_tagscreate_tagsupdate_tagdelete_tag†、merge_tagsget_tag_record_countadd_tagsremove_tagsadd_tags_to_multiple_records

线索转化

get_lead_conversion_optionsconvert_leadmass_convert_leadsget_mass_convert_status

蓝图

get_blueprintsexecute_blueprint†、create_blueprintupdate_blueprint

批量读/写

bulk_read_create_jobbulk_read_job_statusbulk_read_download_resultbulk_write_upload_filebulk_write_create_job†、bulk_write_job_status

安全与用户

get_userscreate_userupdate_userdelete_user†、get_profilescreate_profileget_rolescreate_roleupdate_roleget_territoriesget_variablescreate_variables

通知

get_notification_detailsenable_notificationsdisable_notifications

函数

execute_functionget_functionscreate_functionupdate_functiondelete_function

报表与仪表盘

get_reports(代理到自定义视图)、create_reportexport_reportget_dashboardcreate_dashboard_widget

† 默认需要审批。设置 ZOHO_REQUIRE_APPROVAL=false 可立即执行。

* Zoho CRM 的公共 REST API 没有针对此操作的端点——蓝图编写、Deluge 函数源码以及报表/仪表盘创建仅限 UI 操作,或属于独立的 Zoho Analytics 产品。这些工具会返回一条明确的 NOT_SUPPORTED_BY_ZOHO_API 消息,并指明可用的替代方案,而不是针对不存在的 URL 报错。


🧭 访问未列出的任何内容

Zoho 的 API 比任何手写封装都要庞大。zoho_api_request 以相同的认证、限流和重试处理覆盖其余部分:

zoho_api_request(
    method="GET",
    endpoint="settings/territories")

zoho_api_request(
    method="POST",
    endpoint="settings/automation/scoring_rules",
    body={"scoring_rules": [{...}]})

zoho_api_request(
    method="GET",
    endpoint="read/1234567890",
    api_root="bulk")

api_root 选择 URL 基础地址:crm{domain}/crm/v8(默认),bulk{domain}/crm/bulk/v8root{domain}

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

No tool schema history has been recorded yet.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

  • The HubSpot MCP Server acts as a bridge that enables AI assistants and Large Language Models to securely interact with HubSpot CRM data through natural conversation, without requiring users to understand complex API structures. It provides read-only access to standard CRM objects (contacts, companies, deals, tickets, products, invoices, and more) and their associations, secured via OAuth 2.0, allowing AI agents to perform tasks like summarizing deals, fetching company updates, and looking up record changes.

  • Connect Claude to your Platform7n workspaces — chat, links, and tasks. One-click OAuth.

  • xmagnet — AI-powered B2B CRM for Claude. 35 tools that turn natural-language prompts into real CRM actions: prospect, enrich, score leads, manage deals, scan buying intent, run email campaigns and sequences, build forms and landing pages, refine ICP, and analyze performance — all directly inside Claude. 🚀 ONE-CLICK INSTALL: https://api.xmagnet.ai/claude The install page guides Claude users through 3 steps in under a minute: open Claude Connectors, paste the connector name, paste the server URL, sign in. A reviewer workspace is auto-provisioned on first sign-in with sample contacts, deals, campaigns, and ICP suggestions, so every tool works end-to-end with zero setup. No 2FA. No paid plan required. Free tier exposes all 35 tools. What you can do: • Prospecting — search_contacts, search_companies, search_investors, find_contacts_at_companies, enrich_contact, validate_email, find_competitors, company_intelligence • Pipeline — get_deals_pipeline, scan_deal_intent, get_ghost_pipeline, create_deal • Campaigns & sequences — create_campaign, generate_campaign_content, get_campaign_stats, get_bounce_stats, get_unsub_stats, create_sequence_draft, list_sequences • Top of funnel — suggest_icp, get_icp, create_form, list_forms, create_landing_page, list_landing_pages, show_suggestions • Operations — analyze_contacts, get_contact_details, update_contact, save_contacts_to_crm, export_contacts, get_dashboard_stats, get_credit_balance Example prompts to try: • "Find C-suite contacts at fintech companies that raised Series A in the last 6 months." • "Scan my open deals for buying intent and prioritize follow-ups." • "Generate a re-engagement campaign for contacts who opened my last newsletter but didn't reply." • "Show me my deals pipeline by stage with weighted value and win rate." • "Generate a landing page for my Q2 webinar with a registration form." Built for founders, SDRs, RevOps, and growth teams who want their CRM to take action — not just store records. Install: https://api.xmagnet.ai/claude · Site: https://xmagnet.ai · Privacy: https://xmagnet.ai/privacy-policy · Terms: https://xmagnet.ai/terms-of-service · Support: ashish.sinha@xmagnet.ai

  • WHOOP recovery, strain, sleep and workouts in Claude via official WHOOP OAuth. Free, open source.

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Connects Claude to Zoho CRM with read-only access, enabling natural language queries to search records, list modules, retrieve field information, and count records using OAuth authentication.
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables read-only interaction with Zoho CRM data through natural language queries, allowing users to search records, list modules, retrieve field information, and count records using secure OAuth authentication.
    2
    -
  • F
    license
    B
    quality
    D
    maintenance
    Exposes Zoho CRM v6 REST API as structured tools for LLM agents via MCP, enabling CRUD operations, search, COQL queries, and more.
    11
    3
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants to interact with Zoho CRM data through secure OAuth authentication, supporting comprehensive CRM operations including record management, search, bulk operations, and lead conversion.
    3
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/NitinSharma077-echo/zoho-crm-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server