Planfix MCP Server

Planfix MCP Server

Enables integration with Planfix CRM and task management system, allowing lead management, contact/company management, task creation/search/commenting, and report generation via the Planfix REST API v2.0.

Category
访问服务器

README

Planfix MCP Server

Coverage Status

This MCP server provides integration with the Planfix API, allowing Model Context Protocol (MCP) clients to interact with Planfix CRM and task management system.

Features

  • Lead management (create, search, convert to tasks)
  • Lead searches can reuse a known clientId to skip contact lookups
  • Contact and company management
  • Task management (create, search, comment)
  • Report generation and management
  • Uses Planfix REST API v2.0 (API docs)
  • Authentication via Bearer token

Configuration

The server requires the following environment variables for Planfix API access:

  • PLANFIX_ACCOUNT – Your Planfix account name (e.g., yourcompany)
  • PLANFIX_TOKEN – Planfix API token with necessary permissions
  • PLANFIX_BASE_URL – (optional) Override the REST API base URL. Defaults to https://<PLANFIX_ACCOUNT>.planfix.com/rest/. Set this for .ru and other regional installations, e.g. https://yourcompany.planfix.ru/rest/
  • PLANFIX_ACCOUNT_URL – (optional) Override the web origin used for human-facing links (task/contact/user pages). Defaults to PLANFIX_BASE_URL without the trailing /rest/
  • PLANFIX_FIELD_ID_EMAIL – Custom field ID for email
  • PLANFIX_FIELD_ID_PHONE – Custom field ID for phone
  • PLANFIX_FIELD_ID_TELEGRAM – Set any value to use the system Telegram field
  • PLANFIX_FIELD_ID_TELEGRAM_CUSTOM – Custom field ID for Telegram when using the custom field
  • PLANFIX_FIELD_ID_CLIENT – Custom field ID for client
  • PLANFIX_FIELD_ID_MANAGER – Custom field ID for manager
  • PLANFIX_FIELD_ID_AGENCY – Custom field ID for agency
  • PLANFIX_FIELD_ID_LEAD_SOURCE – Custom field ID for lead source
  • PLANFIX_FIELD_ID_LEAD_SOURCE_VALUE – Value ID for default lead source
  • PLANFIX_FIELD_ID_PIPELINE – Custom field ID for pipeline
  • PLANFIX_FIELD_ID_TAGS – Custom field ID for task tags
    • Missing tag names will be added automatically to the directory
  • PLANFIX_FIELD_ID_LEAD_ID – Custom field ID for external lead ID
  • PLANFIX_LEAD_TEMPLATE_ID – ID of the lead task template
  • PLANFIX_TASK_TITLE_TEMPLATE – Template for the default lead task title (e.g., {name} - client's task)

config.yml

Custom fields can also be configured via config.yml. The default path is ./data/config.yml. Override it with the --config=/abs/path/config.yml CLI flag or the PLANFIX_CONFIG environment variable. You can also specify a different Planfix account when using a custom config:

PLANFIX_CONFIG=/etc/planfix-mcp.yml PLANFIX_ACCOUNT=demo \
npx @popstas/planfix-mcp-server
proxyUrl: "http://localhost:8080"

webhook:
  enabled: false
  url: "https://example.com/hook"
  token: "<token>"
  skipPlanfixApi: false

leadTaskFields:
  - id: "456"
    name: "id сделки"
    argName: lead_id
    type: number
contactFields:
  - id: "123"
    name: "Резидентство"
    argName: resident
    type: enum
    values: ["резидент", "нерезидент", "иное"]
userFields:
  - id: "789"
    name: "Департамент"
    argName: department
    type: string

proxyUrl routes all Planfix REST API calls (including tool requests) through the specified HTTP proxy.

Values from config.yml override matching entries from the legacy environment variables when merged by id. User custom fields from this list are requested individually by the planfix_search_manager tool so their values are available in responses. Managers can be searched either by email or by numeric id through this tool, enabling lookups when only an identifier is available.

Chat API

To create tasks from chat messages, add a chatApi block to config.yml:

chatApi:
  useChatApi: true
  chatApiToken: "<token>"
  providerId: "<id>"
  baseUrl: "https://<account>.planfix.com/webchat/api"
  • chatApiToken – token for Planfix Chat API requests.
  • providerId – identifier of the chat provider configured in Planfix.
  • useChatApi – enable Chat API integration. When true, task creation proceeds as:
    1. A chat is created via Chat API with the initial message.
    2. getTask retrieves the new task's taskId.
    3. Subsequent updates are made through the REST API.
  • baseUrl – base URL for Chat API calls. Defaults to https://<account>.planfix.com/webchat/api.

Webhook

To post lead task payloads to a webhook before creating or updating a task, add a webhook block to config.yml:

webhook:
  enabled: true
  url: "https://example.com/hook"
  token: "<token>"
  skipPlanfixApi: false
  • enabled – whether to send the lead task payload to the webhook URL.
  • url – webhook endpoint URL.
  • token – shared secret appended to the JSON payload as token.
  • skipPlanfixApi – when true, the webhook response must include taskId, and the Planfix REST API call is skipped.

Debug

npx @modelcontextprotocol/inspector node d:/projects/expertizeme/planfix-mcp-server/dist/index.js

Logging

Set LOG_LEVEL=debug to enable detailed cache logs. Logs are written to data/mcp.log.

Clearing Cache

Run npm run cache-clear to remove all cached Planfix API responses stored in data/planfix-cache.sqlite3 and delete the objects cache file data/planfix-cache.yml.

Example MCP Config (NPX)

{
  "mcpServers": {
    "planfix": {
      "command": "npx",
      "args": [
        "-y",
        "@popstas/planfix-mcp-server"
      ],
      "env": {
        "PLANFIX_ACCOUNT": "yourcompany",
        "PLANFIX_TOKEN": "your-api-token",
        "PLANFIX_FIELD_ID_EMAIL": "123",
        "PLANFIX_FIELD_ID_PHONE": "124",
        "PLANFIX_FIELD_ID_TELEGRAM": "1",
        "PLANFIX_FIELD_ID_TELEGRAM_CUSTOM": "125",
        "PLANFIX_FIELD_ID_CLIENT": "126",
        "PLANFIX_FIELD_ID_MANAGER": "127",
        "PLANFIX_FIELD_ID_AGENCY": "128",
        "PLANFIX_FIELD_ID_TAGS": "129",
        "PLANFIX_FIELD_ID_LEAD_ID": "130",
        "PLANFIX_LEAD_TEMPLATE_ID": "42",
        "PLANFIX_TASK_TITLE_TEMPLATE": "{name} - работа с клиентом"
      }
    }
  }
}

Usage

Running the Server

Run the server with the required environment variables set. Example (with npx):

PLANFIX_ACCOUNT=yourcompany \
PLANFIX_TOKEN=your-api-token \
PLANFIX_FIELD_ID_EMAIL=123 \
PLANFIX_FIELD_ID_PHONE=124 \
PLANFIX_FIELD_ID_TELEGRAM=1 \
PLANFIX_FIELD_ID_TELEGRAM_CUSTOM=125 \
PLANFIX_FIELD_ID_CLIENT=126 \
PLANFIX_FIELD_ID_MANAGER=127 \
PLANFIX_FIELD_ID_AGENCY=128 \
PLANFIX_FIELD_ID_LEAD_SOURCE=129 \
PLANFIX_FIELD_ID_LEAD_SOURCE_VALUE=130 \
PLANFIX_FIELD_ID_PIPELINE=131 \
PLANFIX_FIELD_ID_LEAD_ID=132 \
PLANFIX_FIELD_ID_TAGS=133 \
PLANFIX_LEAD_TEMPLATE_ID=42 \
PLANFIX_TASK_TITLE_TEMPLATE="{name} - работа с клиентом" \
npx @popstas/planfix-mcp-server

To run the server over Server-Sent Events (SSE), use the planfix-mcp-server-sse command:

PLANFIX_ACCOUNT=yourcompany \
PLANFIX_TOKEN=your-api-token \
planfix-mcp-server-sse

Using the Planfix Client

The Planfix client provides a convenient way to interact with the Planfix API directly from the command line.

Prerequisites

Make sure you have the following environment variables set in your .env file:

PLANFIX_ACCOUNT=your-account
PLANFIX_TOKEN=your-api-token

Basic Commands

  1. Test the connection

    npm run planfix test
    
  2. Make a GET request

    npm run planfix get user/current
    
  3. Make a POST request with data

    npm run planfix post task/ --data '{"name":"Test Task","description":"Test Description"}'
    
  4. Search for objects

    npm run planfix post object/list --data '{"filters":[{"type":1,"operator":"equal","value":"Продажа"}]}'
    

Tool Reference

planfix_create_sell_task

  • Creates a sell task using textual information about the agency and employee.
  • Resolves the client, parent lead task, assignees, and agency IDs automatically based on the provided strings.
  • Input fields (all strings):
    • name: Task title, e.g. "Продажа {{ название товара }} на pressfinity.com".
    • agency: Agency/company name (optional).
    • email: Employee email used to locate the Planfix contact.
    • contactName/employeeName: Employee full name (optional).
    • telegram: Employee telegram username (optional).
    • description: Description with the list of ordered products.
    • project: Project name to associate with the sell task (optional).
  • Returns { taskId, url }.

planfix_create_sell_task_ids

  • Creates a sell task when Planfix identifiers are already known.
  • Requires numeric clientId and optional leadTaskId, agencyId, and assignees (user IDs).
  • Accepts name, description, and optional project string values.
  1. Update an object (PUT request)

    npm run planfix put task/123 --data '{"name":"Updated Task Name"}'
    
  2. Delete an object

    npm run planfix delete task/123
    

Using in Code

import { planfixClient } from './lib/planfix-client';

// Get current user
const user = await planfixClient.get('user/current');

// Create a new task
const newTask = await planfixClient.post('task/', {
  name: 'New Task',
  description: 'Task description',
  // ... other task properties
});

// Search for objects
const objects = await planfixClient.post('object/list', {
  filters: [
    {
      type: 1,
      operator: 'equal',
      value: 'Продажа'
    }
  ]
});

Available Tools

Lead Management

  • leadToTask: Convert a lead to a task by creating/updating contact and task
  • searchLeadTask: Search for lead tasks by contact information

Contact Management

  • searchPlanfixContact: Search contacts by name, phone, email, or Telegram
  • createPlanfixContact: Create a new contact in Planfix
  • updatePlanfixContact: Update existing contact information
  • searchPlanfixCompany: Search for companies by name

Task Management

  • searchPlanfixTask: Search for tasks by title, client ID and optional templateId
  • createSellTask: Resolve contact/agency IDs and create a sell task
  • createSellTaskIds: Create a sell task when IDs are already known
  • createLeadTask: Create a new lead task. When chatApi.useChatApi is enabled, it sends the initial message through the Chat API, gets the resulting taskId via getTask, and then updates the task using the REST API. Accepts message and contactName fields.
  • addToLeadTask: Create or update a lead task and update contact details. When webhook.enabled is true, it posts the input payload to the webhook endpoint, optionally skipping the Planfix API if skipPlanfixApi is set.
  • createTask: Create a task using text fields
  • createComment: Add a comment to a task
  • getChildTasks: Retrieve child tasks of a parent task. Use recursive to fetch all descendant tasks as a flat list; returned tasks include parent_task_id.
  • updateLeadTask: Update an existing lead task (only empty fields are updated unless forceUpdate is true)

Directory Management

  • planfix_search_directory: Search directories by name
  • planfix_search_directory_entry: Search directory entry by directory name and entry name

User Management

  • searchManager: Find a manager by email

Reporting

  • listReports: List all available reports
  • runReport: Generate and retrieve a specific report

References

TODO:

  • Add tool getTask to retrieve task details
  • Add tool getContact to retrieve contact details
  • Add tool getManager to retrieve manager details
  • Add more comprehensive error handling and logging
  • Add input validation for all API endpoints
  • Add rate limiting and retry logic for API calls

MIT License

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选