MCP Server实战:将AnQiCMS接入Claude and Cursor
The Model Context Protocol (MCP) provides a standardized communication bridge between AI clients and server capabilities. The built-in MCP Server of the Anqi Content Management System aggregates background functions by intent domain, authenticates through Bearer Token, and implements round-level batch approval mechanisms for write operations. External AI clients such as Claude Desktop or Cursor only need to complete simple connection configurations to safely call the CMS's content management, SEO optimization, and site operation capabilities.
The core value of the MCP protocol
Traditional API integration requires developers to manually write authentication, parameter validation, and error handling logic, while MCP abstracts through a unified intent directory, allowing AI clients to automatically discover available tools and their input/output specifications. For CMS systems that are intensive in functionality, the advantage of MCP lies in reorganizing scattered interfaces according to business intent, such as creating articles, querying indexing status, and backing up data, rather than exposing the details of the underlying HTTP endpoints.
The AnQiCMS MCP implementation divides the tool interface into multiple intent domains such as content, SEO, operations, business, etc. Tools within each domain share the same permission strategy and audit rules. This design reduces the learning cost of AI clients and makes it convenient for administrators to open or close specific feature domains as needed, achieving fine-grained access control.
Bearer Token authentication configuration
Security is the primary consideration for MCP integration. The AnQiCMS MCP Server requires that all requests carry a valid Bearer Token in the HTTP header. The token value is generated by the system's key management module behind the scenes, supporting setting the validity period and scope. Compared to traditional API Keys, the advantage of Bearer Tokens lies in their ability to be bound to user sessions, achieving more precise permission mapping.
Configuration steps as follows: First, enable the service and generate a token on the 'MCP Settings' page in the CMS backend and record the generated token string (this value is displayed only once). Then, add the service endpoint and token information to the configuration file of the AI client, for example, Claude Desktop needs to add in theclaude_desktop_config.jsonto specifymcpServers.anqicms.urlandmcpServers.anqicms.headers.Authorizationfield. After restarting the client, you can test whether the connection is successful in the conversation.
tool organization structure of the intent directory.
The intent directory is the core index of MCP Server, which classifies hundreds of underlying interfaces into several business domains. High-risk domains (such as backup recovery, system upgrade, multi-site management, and other full-site operations) are in the default off state and need to be explicitly enabled by the administrator to be called by the AI client. This default denial strategy ensures that even if the token is leaked, the attacker cannot immediately perform destructive operations.
Each intent domain contains several specific tools, such as the 'Content Domain' which has tools for creating articles, querying documents, updating tags, etc.; the 'SEO Domain' has tools for pushing links, generating Sitemap, managing anchor text, etc. The AI client will read the metadata of the intent directory before initiating a call to understand the required parameters, return value structure, and permission requirements of each tool, thereby generating a standardized request.
Round-based batch approval mechanism
For write operations (such as publishing articles, deleting categories, modifying system settings), MCP Server does not immediately execute individual requests, but instead stores them in a pending approval queue. When multiple write operations accumulate within the same session, the system initiates a batch confirmation request to the administrator, listing all pending operations and their impact scope. The administrator can choose to approve all, partially approve, or reject all.
This round-level approval design balances automation efficiency and safety control: the AI assistant can plan multiple steps in a single conversation, reducing the interruption of repeated confirmation; at the same time, the administrator still retains the final decision-making power to avoid dangerous operations performed by AI due to misinterpretation of instructions. The approval records will be audited in full, facilitating post-event tracing of responsibility.
Common questions
How to limit the AI client to read-only and not to modify?
On the MCP settings page, you can set the permission level of the intent domain to 'read-only'. At this time, the AI client can only call query tools (such as getting a list of articles, checking SEO status), and all write operation tools will be hidden. If you need finer-grained control, you can generate independent Bearer Tokens for different AI clients, each token binding a different permission strategy.
Can the MCP Server affect the performance of CMS?
The MCP Server runs as an independent service module, isolated from the main station's HTTP service process. The response delay for regular query operations is in the millisecond range, and it may consume more resources only in scenarios of batch export or complex analysis. If you are concerned about performance impact, you can perform intensive MCP calls during off-peak hours, or constrain the request limit per minute through throttling configuration.
What are the differences in connection configuration between Claude and Cursor?
Both follow the standard MCP client specifications, but there are slight differences in the location and format of the configuration files. Claude Desktop uses a desktop configuration file in JSON format, while Cursor requires adding MCP server entries in the VS Code-style settings..Core parameters (endpoint URL, Bearer Token, timeout) are the same, please refer to the official documentation's MCP integration section for specific paths.If you encounter a connection failure during the configuration process, first check if the firewall allows the listening port of the MCP service to pass, and then confirm that the Token has not expired and has not been revoked.