SuperAPI AI Directory

hap-mcp-usage

Agents & models

View repository

Updated 10-15 21:50

About this skill

HAP MCP automated configuration skill

This skill helps users in 9 AI toolsautomatically configure the HAP MCP server, and verify connectivity.

🎯 Skill trigger scenarios

When the user says any of the following,immediately use this skill:

  • "Configure this MCP"
  • "Add MCP server"
  • "Help me configure HAP MCP"
  • "Set up MCP connection"
  • provided information containing hap-mcp- configuration information
  • provided information containing HAP-Appkey and HAP-Sign URL

About HAP MCP

HAP provides two different types of MCP,with completely different functions and use cases:

🔷 Type 1: HAP API documentation MCP

Function: lets AI read and understand HAP interface documentation (read-only, does not execute operations)

Configuration format(officially fixed):

{
  "mcpServers": {
    "应用 API - API 文档": {
      "command": "npx",
      "args": ["-y", "apifox-mcp-server@latest", "--site-id=5442569"]
    }
  }
}

Applicable scenarios:

  • 📖 Query HAP API documentation
  • 🛠️ Learn interface structure and parameters
  • 📝 Generate API call code

🔶 Type 2: HAP app execution MCP

Function: lets AI execute HAP app interfaces (can operate on real data)

Configuration format(app-specific):

{
  "mcpServers": {
    "hap-mcp-应用名": {
      "url": "https://api.mingdao.com/mcp?HAP-Appkey=xxx&HAP-Sign=xxx",
      "type": "streamable"
    }
  }
}

⚠️ Important: HAP MCP's "type": "streamable" configurationdepends on the IDE platform:

  • Needs to be specified: Cursor, TRAE, GitHub Copilot, Antigravity, OpenCode, Windsurf, etc.
  • Does not need to be specified: Claude Code (handled automatically by the command line)
  • Suggestion: If unsure, it is recommended to add "type": "streamable", for better compatibility

Applicable scenarios:

  • 🔍 Query real app data
  • ✏️ Create/modify/delete records
  • 📊 Data statistics and analysis
  • 🔄 Execute workflows

🤖 AI execution steps (automated configuration)

When the user provides an MCP configuration, the AI must complete the configuration automatically according to the following steps:

Step 1: Identify the current AI tool platform

First determine which AI tool the user is currently using (identify from the following 9 platforms):

  1. Claude Code - Anthropic official CLI
  2. TRAE - Standardized .trae/ directory
  3. Cursor - The most popular AI editor
  4. GitHub Copilot - GitHub official tool
  5. Google Antigravity - Google experimental tool
  6. OpenCode - Open-source AI tool
  7. Windsurf - by Codeium
  8. Gemini CLI - Google Gemini command line
  9. Codex - OpenAI programming assistant

Identification method:

  • If the user explicitly mentions the tool name, use that tool
  • Otherwise, ask the user: "Which AI tool are you currently using? (Claude Code / Cursor / TRAE / other)"

Step 2: Parse the MCP configuration information

Extract from the configuration provided by the user:

  • Server name: such as hap-mcp-客户管理
  • URL: contains HAP-Appkey and HAP-Sign full URL
  • MCP Type: Based on the configuration format, determine whether it is API documentation MCP or application execution MCP

Important: If the server name contains Chinese, you need to generate an English name for the Codex platform:

  • Original name: hap-mcp-客户管理 → Keep (for other platforms)
  • English name: hap-mcp-customer-management → Used for Codex
  • Conversion rule: Translate the Chinese part into English pinyin or English words, keeping the kebab-case format

Step 3: Automate configuration based on the platform

Based on the identified platform, execute the corresponding configuration steps:

🔧 Claude Code

Configuration method: Command line

# 添加 HTTP MCP 服务器
claude mcp add <server-name> --url "<server-url>"

# 示例
claude mcp add hap-mcp-客户管理 --url "https://api.mingdao.com/mcp?HAP-Appkey=xxx&HAP-Sign=xxx"

Verification command:

claude mcp list

🔧 Cursor

MCP configuration file: .cursor/mcp.json(project-level, recommended) or ~/.cursor/mcp.json(global) Skills installation location: ~/.cursor/skills/ or ~/.cursor/skills-cursor/

Automation steps:

  1. Check and create the .cursor directory (if it does not exist)
  2. Read the existing configuration file(if it exists) - Important: keep all existing configurations
  3. Incrementally add or update MCP configuration:
    • If the MCP name does not exist → add
    • If the MCP name already exists → update (overwrite)
    • Other MCPs → keep (do not delete)
  4. Save to .cursor/mcp.json
  5. Enable the MCP server(takes effect automatically after configuration, no restart required)

Configuration format:

{
  "mcpServers": {
    // 保留用户已有的 MCP 配置
    "existing-mcp-server": {
      "url": "https://example.com/mcp"
    },
    // 新增 HAP MCP 配置(必须指定 type: streamable)
    "hap-mcp-应用名": {
      "url": "https://api.mingdao.com/mcp?HAP-Appkey=xxx&HAP-Sign=xxx",
      "type": "streamable"
    }
  }
}

⚠️ Key principles:

  • ✅ Incremental update: If the name does not exist, add it; if it already exists, update it; keep others
  • ❌ Do not overwrite: Do not clear or delete the user's existing MCP servers
  • ✅ streamable type: Whether it is needed depends on the platform (recommended to add to improve compatibility)
  • ✅ Enable and verify: Enable immediately after configuration and verify connectivity (no restart required)

Note: "type": "streamable" Whether it is needed depends on the IDE platform; it is recommended to add it to improve compatibility

🔧 TRAE

Configuration file: .trae/mcp.json(project-level) or ~/.trae/mcp.json(global)

Automation steps:

  1. Check and create the .trae directory
  2. Read or create mcp.json
  3. Add MCP configuration (format same as Cursor)
  4. Save the file

🔧 GitHub Copilot

Configuration file: ~/.copilot/mcp-config.json

Automation steps:

  1. Check and create the ~/.copilot directory
  2. Read or create the mcp-config.json file
  3. Add MCP configuration
  4. Save the file

Configuration format: Same as Cursor

⚠️ Note: GitHub Copilot uses mcp-config.json instead of mcp.json

🔧 Google Antigravity

Configuration file: ~/.gemini/antigravity/mcp_config.json

Automation steps:

  1. Check and create the directory ~/.gemini/antigravity/
  2. Read or create the mcp_config.json file
  3. In the mcpServers section, add configuration
  4. Save the file

Configuration format: Same as Cursor

⚠️ Note: Antigravity uses mcp_config.json instead of config.json

🔧 OpenCode

Configuration file: ~/.config/opencode/opencode.json

Automation steps:

  1. Check and create directory ~/.config/opencode/
  2. Read or create opencode.json file
  3. In mcp section add configuration
  4. Save file

Configuration format: Same as Cursor

⚠️ Note: OpenCode uses opencode.json instead of mcp.json

🔧 Windsurf

Configuration file: ~/.codeium/windsurf/mcp_config.json

Automation steps:

  1. Check and create directory ~/.codeium/windsurf/
  2. Read or create mcp_config.json file
  3. Add MCP configuration
  4. Save file

Configuration format: Same as Cursor

⚠️ Note: Windsurf uses mcp_config.json instead of mcp.json

🔧 Gemini CLI

Configuration file: settings.json(location managed by Gemini CLI)

Configuration method: Command line or configuration file

Command line method:

gemini mcp add <server-name> --url "<server-url>"

Configuration file method:

  • Use /mcp command to open configuration file
  • In mcpServers add configuration

⚠️ Note: Gemini CLI uses settings.json, the specific path is managed by the tool

Reference documentation: https://github.com/google-gemini/gemini-cli/blob/main/docs/tools/mcp-server.md

🔧 OpenAI Codex

Configuration file: ~/.codex/config.toml

⚠️ Important limitation: Codex's TOML formatdoes not support Chinese key names

Automation steps:

  1. Chinese name conversion: If the server name contains Chinese, convert to English
    • Example: hap-mcp-客户管理 → hap-mcp-customer-management
    • Rule: Translate Chinese into English words or pinyin, use kebab-case format
  2. Read existing config.toml
  3. Add MCP server configuration (use English name)
  4. Save file

Configuration format (TOML):

# ✅ 正确 - 使用英文名称
[mcp_servers."hap-mcp-customer-management"]
url = "https://api.mingdao.com/mcp?HAP-Appkey=xxx&HAP-Sign=xxx"

# ❌ 错误 - 中文名称不支持
# [mcp_servers."hap-mcp-客户管理"]
# url = "https://api.mingdao.com/mcp?HAP-Appkey=xxx&HAP-Sign=xxx"

Name conversion example:

  • hap-mcp-客户管理 → hap-mcp-customer-management
  • hap-mcp-订单系统 → hap-mcp-order-system
  • hap-mcp-人力资源 → hap-mcp-hr or hap-mcp-human-resources
  • hap-mcp-财务管理 → hap-mcp-finance-management

Step 4: Enable and verify MCP connectivity

Important: After configuration is complete, you mustimmediately enable the MCP server and verifywhether it can connect normally.

4.1 Enable MCP server

Takes effect automatically after configuration, no need to restart the tool:

  • After the configuration file is saved, the MCP server will load automatically
  • You can start using MCP tools immediately

Note: If MCP is not enabled automatically, you may need to manually refresh or reload the configuration

4.2 Verify connectivity

Verification method:

  1. Call MCP tool:get_app_info(get application information)
  2. Check the returned result:
    • ✅ Success: Returns application information (application name, worksheet list, etc.)
    • ❌ Failure: Returns error information (authentication failure, network error, etc.)

Verification example:

// 调用 MCP 工具验证连通性
const result = await mcpClient.call('get_app_info');

if (result.success) {
  console.log('✅ MCP 连接成功!');
  console.log('应用名称:', result.appName);
  console.log('工作表数量:', result.worksheets.length);
} else {
  console.error('❌ MCP 连接失败:', result.error);
}

4.3 Connection failure diagnosis

If the MCP connection fails, diagnose according to the following steps:

Diagnosis checklist:

  1. Check configuration file:
    • Whether the configuration file path is correct
    • Whether the JSON/TOML format is correct
    • "type": "streamable" Whether it has been added (required for HAP MCP)
  2. Check authentication information:
    • HAP-Appkey and HAP-Sign are correct
    • Whether the URL is complete and correctly formatted
  3. Check application status:
    • Whether the MCP feature is enabled for the application
    • Whether the application is accessible
  4. Check network connection: Confirm that you can access api.mingdao.com or www.nocoly.com
  5. Check MCP server status:
    • Whether the MCP server is enabled
    • Whether the configuration needs to be manually refreshed

Common errors and solutions:

Error type Possible cause Solution
Authentication failed Incorrect Appkey/Sign Retrieve the correct authentication information from HAP again
Connection timed out Network issue Check the network connection and try accessing api.mingdao.com
MCP not found Configuration not taking effect Check the configuration file path and format, and manually refresh the configuration
Configuration format error JSON/TOML syntax error Check and correct the configuration file format
Missing streamable type not specified Add "type": "streamable" to the configuration
Chinese key error Codex used a Chinese name Convert the server name to English

Diagnostic steps to provide to the user:

❌ MCP 连接失败,请按以下步骤排查:

1. 检查配置文件
   → 位置: [配置文件路径]
   → 格式: [JSON/TOML]
   → 打开文件检查是否有语法错误
   → 确认已添加 "type": "streamable"(HAP MCP 必需)

2. 检查鉴权信息
   → HAP-Appkey: [显示前5位]...
   → HAP-Sign: [显示前5位]...
   → 如果不确定,请重新从 HAP 应用获取

3. 验证 URL 格式
   → 确认 URL 完整且无多余空格
   → 格式: https://api.mingdao.com/mcp?HAP-Appkey=xxx&HAP-Sign=xxx
   → 或: https://www.nocoly.com/mcp?HAP-Appkey=xxx&HAP-Sign=xxx

4. 测试网络连接
   → 在浏览器访问: https://api.mingdao.com
   → 确认网络可以访问明道云 API

5. 检查应用设置
   → 登录 HAP 应用
   → 确认 MCP 功能已启用
   → 检查 API 权限设置

6. 手动刷新配置
   → 如果配置未自动生效,尝试手动刷新
   → 或重启 AI 工具使配置重新加载

如果以上步骤都无法解决,请提供完整错误信息以便进一步诊断。

Step 5: Report the results to the user

After configuration is complete, report to the user:

On success:

✅ MCP 配置成功!

📋 配置信息:
- 平台:Cursor
- 服务器名称:hap-mcp-客户管理
- 配置文件:.cursor/mcp.json
- 已保留其他 MCP 配置

✅ 连通性验证通过:
- 应用名称:客户管理系统
- 工作表数量:5 个

💡 下一步:
- MCP 已启用并可正常使用
- 现在可以使用 MCP 工具操作数据了

On failure:

❌ MCP 配置已保存,但连通性验证失败

📋 配置信息:
- 平台:Cursor
- 配置文件:.cursor/mcp.json
- 已保留其他 MCP 配置

❌ 连接错误:
- 错误类型:鉴权失败
- 错误信息:Invalid HAP-Appkey or HAP-Sign

🔧 诊断步骤:

1️⃣ 检查配置文件
   → 打开文件: .cursor/mcp.json
   → 检查 JSON 格式是否正确
   → 确认已添加 "type": "streamable"
   → 确认 URL 完整且无多余空格

2️⃣ 检查鉴权信息
   → HAP-Appkey: abc12... (前5位)
   → HAP-Sign: xyz78... (前5位)
   → 如果不确定,请从 HAP 应用重新获取

3️⃣ 验证 URL 格式
   → 格式: https://api.mingdao.com/mcp?HAP-Appkey=xxx&HAP-Sign=xxx
   → 或: https://www.nocoly.com/mcp?HAP-Appkey=xxx&HAP-Sign=xxx

4️⃣ 测试网络
   → 在浏览器访问: https://api.mingdao.com
   → 确认网络可以连接明道云

5️⃣ 检查应用设置
   → 登录 HAP 应用后台
   → 确认 MCP 功能已启用
   → 检查 API 访问权限

6️⃣ 手动刷新配置
   → 如果配置未自动生效,尝试手动刷新
   → 或重启 AI 工具使配置重新加载

📞 需要帮助?
- 提供完整错误信息以便进一步诊断
- 或访问 HAP 帮助中心查看 MCP 配置文档

📋 Quick reference table for MCP configuration files and Skills installation locations

MCP configuration file locations

Platform Project-level configuration Global configuration Format Skills location
Claude Code - Command-line configuration Command ~/.claude/skills/
Cursor .cursor/mcp.json ~/.cursor/mcp.json JSON ~/.cursor/skills/ or ~/.cursor/skills-cursor/
TRAE .trae/mcp.json ~/.trae/mcp.json JSON ~/.trae/skills/
GitHub Copilot - ~/.copilot/mcp-config.json JSON ~/.copilot/skills/
Antigravity - ~/.gemini/antigravity/mcp_config.json JSON ~/.gemini/antigravity/skills/
OpenCode - ~/.config/opencode/opencode.json JSON ~/.config/opencode/skills/
Windsurf - ~/.codeium/windsurf/mcp_config.json JSON ~/.codeium/windsurf/skills/
Gemini CLI - settings.json (tool management) JSON Tool management
Codex - ~/.codex/config.toml TOML ~/.codex/skills/

Important notes

MCP configuration strategy:

  • Platforms that support project-level configuration (Cursor, TRAE): Prefer project-level
  • Other platforms: Use global configuration
  • streamable type: Determined by platform requirements; recommended to add for better compatibility

Skills installation:

  • Skills are usually installed in the corresponding tool's skills/ directory
  • Cursor may have skills/ or skills-cursor/ two directories
  • After installing skills, the tool needs to be restarted for them to take effect

Required actions after configuration:

  1. ✅ Save the configuration file
  2. ✅ Enable the MCP server(Takes effect automatically after configuration, no restart required)
  3. ✅ Verify connectivity immediately(Call get_app_info to test)
  4. ✅ If it fails, provide detailed diagnostic steps to the user

⚠️ Important notes

Must be done during configuration

  • ✅ Automated execution: Configure directly for the user, do not just tell them the steps
  • ✅ Platform identification: Accurately identify the tool the user is using
  • ✅ streamable type: Determine whether it is needed based on the platform (recommended to add for better compatibility)
  • ✅ Chinese conversion: The Codex platform must convert Chinese server names to English
  • ✅ Incremental update: If the name does not exist, add it; if it already exists, update it; keep everything else
  • ✅ Format check: Ensure the JSON/TOML format is correct
  • ✅ Enable configuration: Enable immediately after configuration (no restart required)
  • ✅ Verify connectivity: After configuration,verify immediately whether the MCP is available
  • ✅ Failure diagnosis: Provide detailed diagnostic steps and solutions when the connection fails
  • ✅ Error handling: If configuration or verification fails, provide clear error information

Do not do during configuration

  • ❌ Do not overwrite configuration: Do not clear or delete the user's existing MCP servers (fatal error!)
  • ❌ Incremental update principle: If the name does not exist, add it; if it already exists, update it; everything else must be preserved
  • ❌ streamable type: Determine whether it is needed based on the platform; it is recommended to add it for better compatibility
  • ❌ Do not just tell the user how to configure it; execute directly
  • ❌ Do not skip the connectivity verification step
  • ❌ Do not give up directly when verification fails; provide diagnostic steps
  • ❌ Do not use Chinese server names in Codex (they must be converted to English)
  • ❌ Do not use the wrong configuration format (use the correct type according to the platform)

Configuration priority

  1. Project-level configuration - If the platform supports it (Cursor, TRAE)
  2. Global configuration - Other platforms or when the user explicitly requests it

Security tips

  • 🔐 Remind the user to protect HAP-Appkey and HAP-Sign
  • 🔐 Do not commit configuration files to Git (recommended to add to .gitignore)
  • 🔐 Regularly check and update authentication information

📚 Configuration examples

Example 1: Cursor project-level configuration

User provides:

{"hap-mcp-客户管理":{"url":"https://api.mingdao.com/mcp?HAP-Appkey=abc123&HAP-Sign=xyz789"}}

AI executes:

  1. Create .cursor directory (if it does not exist)
  2. Read the existing .cursor/mcp.json and preserve all existing configuration
  3. Incrementally addthe new HAP MCP configuration:
{
  "mcpServers": {
    // 保留所有已有的 MCP 配置
    "existing-server-1": { "url": "..." },
    "existing-server-2": { "url": "..." },
    // 新增 HAP MCP(必须指定 type: streamable)
    "hap-mcp-客户管理": {
      "url": "https://api.mingdao.com/mcp?HAP-Appkey=abc123&HAP-Sign=xyz789",
      "type": "streamable"
    }
  }
}
  1. Save the file
  2. Enable the MCP server(takes effect automatically after configuration, no restart required)
  3. Verify connectivity immediately(call get_app_info to test)
  4. If it fails, provide detailed diagnostic steps
  5. Report the result to the user

Example 2: Claude Code command-line configuration

User provides: Same as above

AI executes:

claude mcp add hap-mcp-客户管理 --url "https://api.mingdao.com/mcp?HAP-Appkey=abc123&HAP-Sign=xyz789"

Verification:

claude mcp list

Example 3: Codex TOML configuration (Chinese name conversion)

User provides:

{"hap-mcp-客户管理":{"url":"https://api.mingdao.com/mcp?HAP-Appkey=abc123&HAP-Sign=xyz789"}}

AI executes:

  1. Identify that the server name contains Chinese: hap-mcp-客户管理
  2. Convert to English name: hap-mcp-customer-management
  3. Edit ~/.codex/config.toml:
[mcp_servers."hap-mcp-customer-management"]
url = "https://api.mingdao.com/mcp?HAP-Appkey=abc123&HAP-Sign=xyz789"
  1. Explain name conversion to the user:
✅ MCP 配置成功!

📋 配置信息:
- 平台:Codex
- 原始名称:hap-mcp-客户管理
- 转换后名称:hap-mcp-customer-management(Codex 不支持中文 key)
- 配置文件:~/.codex/config.toml

💡 说明:Codex 的 TOML 格式不支持中文 key 名称,已自动转换为英文。

🎯 Summary

Core value of this skill:

  1. Automation - Users only need to provide configuration; AI automatically completes all steps
  2. Full platform support - Supports 9 mainstream AI tools
  3. Incremental updates - Only adds new configurations, preserving all existing user MCPs
  4. Enable and verify - After configuration, enable and verify connectivity to ensure usability
  5. Failure diagnosis - Provides detailed diagnosis and solutions when connection fails
  6. Error handling - Clear error messages and user guidance

Key principles:

  • ✅ Incremental updates: If the name does not exist, add it; if it already exists, update it; keep the rest
  • ✅ After configurationenable and verify immediately(no restart required)
  • ✅ Provide diagnostic steps on failure, do not give up directly
  • ✅ Codex platform automatically converts Chinese names
  • ✅ "type": "streamable" Determined by the platform; adding it is recommended to improve compatibility

Remember: When the user says "configure MCP", do not ask "Do you need me to help you configure it?", but immediately execute the configuration process!