模型上下文协议服务器

HCore MCP服务器通过Postman集合动态暴露HCore API,为Cursor等MCP客户端提供可调用的工具集。

  • by vromano-newel
  • JavaScript
  • 本地部署
  • 更新于
在 GitHub 查看 vromano-newel/hcore-mcp

使用说明

HCore MCP服务器

服务器MCP(模型上下文协议)根据API HCore tramite集合Postman。

📋 描述

此 MCP 服务器将 HCore API 暴露为 Cursor 和其他 MCP 客户端可用的工具。API被组织成Postman集合,这些集合被动态加载并作为MCP工具展示。

可用的收藏

  • 认证 - 用户身份验证和管理
  • 每小时 -个人健康记录(PHR)
  • 遵守 -Aderenza terapeutica药物请求
  • 内容 -内容管理系统
  • 肥胖 肥胖计划管理
  • pjbuilder -程序生成器

🚀 安装

  1. 克隆或下载仓库

  2. 安装依赖关系

    npm install
    
  3. 设置环境变量

    创建文件 .env 在项目的root中,使用以下变量:

    # File environment Postman (opzionale)
    POSTMAN_ENVIRONMENT_FILE=./nwl.obesity.stage.postman_environment.json
    
    # Percorsi delle collection Postman
    # Formato: COLLECTION_NAME_PATH=/path/to/collection.json
    # Puoi specificare più collection separandole con virgole
    PHR_PATH=./collections/phr.postman_collection.json
    AUTH_PATH=./collections/auth.postman_collection.json
    ADHERENCE_PATH=./collections/adherence.postman_collection.json
    CONTENT_PATH=./collections/content.postman_collection.json
    OBESITY_PATH=./collections/obesity.postman_collection.json
    PJBUILDER_PATH=./collections/pjbuilder.postman_collection.json
    

⚙️ 光标配置

🚀 方法1:自动脚本(推荐)

脚本会自动生成具有正确路径的配置:

node generate-cursor-config.js

复制JSON输出并粘贴到Cursor的MCP设置:

  1. Apri光标→ 设置 → 特性 → 模型上下文协议
  2. 点击 添加MCP服务器
  3. 粘贴生成的配置
  4. 重新启动光标

📝 方法2:手动配置

  1. 查找项目的绝对路径

    pwd
    # Esempio output: /Users/vincenzo.romano/Data/Projects/MCPs/hcore
    
  2. Apri光标

    • 还是 设置 → 特性 → 模型上下文协议
    • 点击 添加MCP服务器
  3. 复制并粘贴配置

    打开文件 cursor-mcp-config.json 包括在项目中,替换 /path/to/hcore 在点1中找到绝对路径,并将配置粘贴到Cursor。

    或者直接复制此配置(请记住替换路径):

    {
      "mcpServers": {
        "hcore-mcp": {
          "command": "node",
          "args": [
            "/path/to/hcore/src/server.js"
          ],
          "env": {
            "POSTMAN_ENVIRONMENT_FILE": "/path/to/hcore/nwl.obesity.stage.postman_environment.json",
            "PHR_PATH": "/path/to/hcore/collections/phr.postman_collection.json",
            "AUTH_PATH": "/path/to/hcore/collections/auth.postman_collection.json",
            "ADHERENCE_PATH": "/path/to/hcore/collections/adherence.postman_collection.json",
            "CONTENT_PATH": "/path/to/hcore/collections/content.postman_collection.json",
            "OBESITY_PATH": "/path/to/hcore/collections/obesity.postman_collection.json",
            "PJBUILDER_PATH": "/path/to/hcore/collections/pjbuilder.postman_collection.json"
          }
        }
      }
    }
    
  4. 重新启动光标

    添加配置后,重新启动 Cursor 以加载 MCP 服务器。

🔧 方法3:直接修改配置文件

如果您想直接修改配置文件:

  1. 打开 Cursor MCP 配置文件:

    • macOS: ~/Library/Application Support/Cursor/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json
    • 视窗: %APPDATA%\Cursor\User\globalStorage\rooveterinaryinc.roo-cline\settings\cline_mcp_settings.json
    • Linux: ~/.config/Cursor/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json
  2. 添加配置 (或修改现有的 hcore-mcp 已经存在)

  3. 重新启动光标

📝 方法2:手动配置

🔧 方法3:直接修改配置文件

  1. 打开 Cursor MCP 配置文件:

    • macOS: ~/Library/Application Support/Cursor/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json
    • 视窗: %APPDATA%\Cursor\User\globalStorage\rooveterinaryinc.roo-cline\settings\cline_mcp_settings.json
    • Linux: ~/.config/Cursor/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json
  2. 添加上述配置

  3. 重新启动光标

📝 使用

配置后,您可以直接在 Cursor 中使用 MCP 工具。工具按收集方式组织:

  • mcp_hcore-mcp_auth Endpoint 身份验证
  • mcp_hcore-mcp_phr -端点PHR
  • mcp_hcore-mcp_adherence -端点依从性
  • mcp_hcore-mcp_content -端点CMS
  • mcp_hcore-mcp_app -终点肥胖
  • mcp_hcore-mcp_program -端点程序生成器

示例:搜索项目PHR

// Cerca item con category "observations" e type "weight"
mcp_hcore-mcp_phr({
  endpoint: "item_search_test_json_post",
  body: {
    "category": "observations",
    "search[type]": "weight"
  }
})

示例:身份验证

// Autenticazione
mcp_hcore-mcp_auth({
  endpoint: "auth_token_password_post",
  vars: {
    "username": "user@example.com",
    "password": "password123"
  }
})

示例:药物搜索请求

// Lista medication request
mcp_hcore-mcp_adherence({
  endpoint: "adherence_medication_request_search_post"
})

🔧 功能

变量管理

您可以设置会话或全局变量,以便在下次呼叫中使用:

mcp_hcore-mcp_set_vars({
  vars: {
    "userToken": "your-token-here",
    "category": "observations"
  },
  scope: "session" // o "global"
})

自定义车身形状

当你通过一个 body 作为使用 formdata 的端点的对象,包含 只有您指定的字段忽略了原始终端。这允许您确切地控制发送哪些参数。

🛠️ 发展

服务器启动

npm start

服务器以 stdio 模式启动,并通过 MCP 协议进行通信。

项目结构

hcore/
├── collections/                    # Collection Postman
│   ├── auth.postman_collection.json
│   ├── phr.postman_collection.json
│   ├── adherence.postman_collection.json
│   └── ...
├── src/
│   └── server.js                   # Server MCP principale
├── generate-cursor-config.js        # Script per generare la config Cursor
├── cursor-mcp-config.json           # Template configurazione Cursor
├── package.json
└── README.md

📚 文档

若要查看所有可用的端点,请查看文件夹中的 Postman 集合 collections/.

每个集合将其端点显示为MCP工具,名称为:

  • 收藏集名称( 缩写)
  • 端点名称
  • Metodo http

例如: phr__item_search_test_json_post → item_search_test_json_post

🔐 安全

  • 身份验证令牌通过会话变量进行管理
  • 凭据永远不会被登录或暴露
  • 在生产中始终使用 HTTPS

📄 许可证

ISC

👤 作者

文森佐·罗曼诺