Skip to main content

MCP Server

What is MCP?

Core Concepts

As Agent-based applications rapidly evolve, developers are encountering common challenges during tool development and integration: the lack of unified standards hampers efficiency; constant adaptation across different platforms increases time and manpower costs; and open-source tools vary in quality, making maintenance and consolidation of high-quality capabilities expensive.

That’s where MCP (Model Context Protocol) comes in. Released by Anthropic, MCP is a leading open protocol designed to establish a secure and consistent two-way connection between large language models (LLMs) and external data sources. It addresses the fragmentation in tool implementation and enables cross-model compatibility.

Think of MCP as a universal plug or a USB port—the protocol defines a consistent specification for transmitting data from applications to LLMs. Any model that supports MCP can seamlessly interact with any MCP-compliant application.

Understanding Agent / MCP / API (Tool) Through the Story of a Smart Butler

Imagine having a smart butler at home. You simply describe what you need, and they take care of everything on your behalf. That’s the role of an Agent.

RoleStory AnalogyTechnical EquivalentMain Responsibilities
👤 UserHomeownerEnd UserSubmits a request and waits for the result.
🤖 AgentSmart ButlerIntelligent AgentUnderstands user intent, performs reasoning, and orchestrates tools.
•Duties: Interpret user needs, decide execution steps and order.
•Capability: Connect multiple tasks into a complete solution.
•Analogy: The brain and decision-making center.
🔌 MCPPlug Standard (Type-C)Protocol LayerEven the smartest butler struggles if every tool works differently.
MCP solves the “tool invocation standardization” issue, allowing the butler to focus on task planning instead of interface compatibility.
• Unified tool invocation specification
• Agent doesn't need to understand the internal logic of each tool
• Plug-and-play after standardization
🛠️ ToolTools (Weather / Flight / Email)APIs or ServicesTools are the entities that perform the actual tasks:
• Weather tool → returns weather info
• Flight tool → provides flight data
• Email tool → sends confirmation emails

Evolution of Three Development Approaches: API Docs → Function Call → MCP

From “Human Understanding” → “Model-Assisted Understanding” → “Model Execution via Protocol”

DimensionAPI DocumentationFunction CallMCP Protocol
🧠 Understanding EntityHuman DeveloperModel + Human (manual tool registration)Model (auto protocol interpretation)
🎯 Target AudienceHuman-readable docsModel-readable function signaturesMachine-readable protocol description
🚀 Usage FlowRead docs → Write request → ExecuteManually define function schema → Model invokesMCP auto-exposes capability → Model discovers and invokes
🧩 Tool SetupRequires separate wrappers per platformRequires registering function per platformConfigure MCP service address once
🔍 DiscoverabilityVia documentationManually registeredAuto-discovered by model (dynamic capability detection)
🔄 Tool UpdateManual doc sync requiredEach platform must update separatelyMCP auto-syncs capability manifest
🧰 Integration ComplexityHigh: manual wrappers & prompt tuningMedium: schema definition requiredLow: auto-exposed via protocol, no duplicate config
🧠 Model ComprehensionDriven by prompt + doc interpretationDepends on function schema clarityProtocol-defined structured types enable native model understanding
🔒 Invocation SecurityWeak (prone to parameter errors)Moderate (schema constrains input format)Strong (protocol-level validation + context control)
💬 Analogy“Read the manual, do it yourself”“Read function signature, follow the format”“Plug in Type-C, auto-detect and run”
⚙️ Abstraction LayerApplication layerSDK layerProtocol layer
🌐 ExtensibilityLow: custom wrappers neededMedium: depends on platform supportHigh: cross-platform capability standardization
👩‍💻 Developer ExperienceManual-centric: write & maintain docsSemi-automated: still need schema + setupFully automated: integrate once, reuse across LLMs

How to Use

APIfox MCP and HAP MCP serve different purposes depending on your integration needs:

  • APIfox MCP allows large language models to read and understand the API documentation of HAP applications — ideal for “making the model API-aware.”
  • HAP MCP enables direct access and manipulation of application data — designed for “executing business actions through the model.”
APIfox MCPHAP MCP
PurposeEnable the model to understand HAP API documentation.Allow the model to execute HAP application APIs.
Entry PointDocumentation URL: https://apifox.mingdao.com
Accessible from within the Application API Documentation panel.
Use CaseWhen the goal is to understand available API structures for generating API call strategies or orchestrating workflows.
📍Example: For a Customer Case Management application, if you want to create a real-time data dashboard, you can let the model (via a client like Cursor) access the API documentation using APIfox MCP (preferably V3 APIs).
When the goal is to perform actions or access real-time data directly within a production environment.
📍Example: In an orchestration flow, the model may directly retrieve application data, perform analysis, map fields, or update records using HAP MCP.
CharacteristicsExposes API definitions, documentation, and examples (read-only). Helps the model act as a knowledgeable API assistant.
Best suited for: project development, API discovery, documentation automation.
Exposes executable tools with permission and security control. Helps the model act as a capable operational agent.
Best suited for: business execution, production system workflows, governance.

MCP Configuration

Retrieve the MCP Configuration from HAP

  • Open the Application API Documentation, navigate to the MCP tab, and copy the generated URL for configuration.

Cursor Configuration

  • Go to [Settings] > [Tools & MCP] to add a new MCP server.

  • Once saved, return to the list. A green indicator means the connection is successful.

Dify Integration

Using MCP in Agent Applications

  • Click the Plugins button in the upper-right corner, explore the Marketplace, search for MCP, and locate “MCP SSE / StreamableHTTP”, then click Install.

  • After installation, locate “MCP SSE / StreamableHTTP” under your installed plugins.

  • Example Configuration:
    Enter your MCP config. You can replace "hap-mcp" with any alias name. The url should be the one generated from your application.

      {"hap-mcp":{"transport":"streamable_http","url":"your-mcp-url-here"}}

  • Add the MCP tool and run a test to verify

Using MCP in Workflows

  • Click the Plugins button in the upper-right corner. In the Marketplace, search for “Agent Strategy (Support MCP Tools)” and click Install.

  • Example Configuration:
    Enter your MCP config. You can replace "hap-mcp" with any alias name. The url should be the one generated from your application.

      {"hap-mcp":{"transport":"streamable_http","url":"your-mcp-url-here"}}

VS Code + Cline Plugin

  • Install the Cline Plugin

  • Click "MCP Servers" in the bottom-right corner of VS Code to complete the configuration

  • Example Configuration:

    "hap-mcp": {
    "url": "your-mcp-url-here",
    "type": "streamableHttp",
    "disabled": false,
    "autoApprove": []
    }