Skip to main content

JH-MES MCP Gateway Bridge

JH-MES 智能工厂 MCP 网关的 STDIO 桥接服务。将标准 MCP STDIO 协议转发到 Java HTTP 网关,使 AI 客户端(Cursor / Cherry Studio / 通义灵码 / 魔搭 MCP 广场)能够调用 MES 业务接口。

工作原理

AI 客户端 (Cursor / Cherry Studio / 魔搭MCP广场)
    │ STDIO (JSON-RPC over stdin/stdout)
    ▼
jh-mes-mcp (Python 桥接包, PyPI: jh-mes-mcp)
    │ HTTP POST (Streamable HTTP / JSON-RPC 2.0)
    ▼
http://mom.azk168.cn/mcp-gateway/mcp (Java MCP 网关, Spring Boot)
    │ RestTemplate
    ▼
jhmes:9090 / jerp:9091 (MES 业务服务)

提供的工具

工具 说明
list_tools 列出网关上所有可用的业务接口工具(名称、描述、参数定义)
call_tool 调用指定业务接口工具,传入工具名和 JSON 参数

使用流程:AI 先调 list_tools 了解有哪些能力,再调 call_tool 执行具体业务操作。

快速开始

安装

pip install jh-mes-mcp

本地运行

# 默认连接线上网关
jh-mes-mcp

# 指定网关地址
JH_MES_GATEWAY_URL=http://localhost:9093/mcp-gateway/mcp jh-mes-mcp

MCP 客户端配置

Cursor / VS Code / Cherry Studiomcp.json):

{
  "mcpServers": {
    "jh-mes": {
      "command": "uvx",
      "args": ["jh-mes-mcp"],
      "env": {
        "JH_MES_GATEWAY_URL": "http://mom.azk168.cn/mcp-gateway/mcp"
      }
    }
  }
}

Claude Desktop~/.claude/claude_desktop_config.json):

{
  "mcpServers": {
    "jh-mes": {
      "command": "uvx",
      "args": ["jh-mes-mcp"],
      "env": {
        "JH_MES_GATEWAY_URL": "http://mom.azk168.cn/mcp-gateway/mcp"
      }
    }
  }
}

环境变量

变量 默认值 说明
JH_MES_GATEWAY_URL http://mom.azk168.cn/mcp-gateway/mcp Java MCP 网关地址
JH_MES_TIMEOUT 30 HTTP 请求超时(秒)

发布到 PyPI

# 1. 安装构建工具
pip install build twine

# 2. 构建包
cd mcp-bridge
python -m build

# 3. 上传到 PyPI
twine upload dist/*

# 或使用 TestPyPI 测试
twine upload --repository testpypi dist/*

魔搭 MCP 广场部署

方式一:仅分发展示(推荐)

提供 SSE URL 供外部 AI 客户端接入:

{
  "mcpServers": {
    "jh-mes": {
      "type": "sse",
      "url": "http://mom.azk168.cn/mcp-gateway/mcp"
    }
  }
}

魔搭 MCP 广场 创建时选择「仅分发展示」,填入上述 URL。

方式二:可托管部署

通过 GitHub 仓库由魔搭平台托管运行:

  1. 将本项目推到 GitHub
  2. 登录 魔搭 MCP 广场 → 创建 MCP
  3. 创建类型选择 「GitHub 快速创建」
  4. 填写:
    • 来源地址:GitHub 仓库 URL
    • 托管类型:可托管部署
  5. 平台自动读取 pyproject.toml 进行构建部署

技术栈

组件 技术
Python 桥接包 FastMCP (mcp SDK v1/v2 兼容) + httpx
Java MCP 网关 Spring Boot 2.1.2 + MyBatis-Plus
协议 JSON-RPC 2.0 + Streamable HTTP (MCP 2025-06-18)
打包 hatchling + PyPI

项目结构

mcp-bridge/
├── pyproject.toml              # PyPI 打包配置
├── README.md                   # 本文件
└── src/
    └── jh_mes_mcp/
        ├── __init__.py
        ├── server.py           # 静态版(list_tools + call_tool)
        └── server_dynamic.py   # 动态版(启动时加载所有业务工具为独立 MCP 工具)

切换版本:

# 使用动态版(每个业务工具作为独立 MCP 工具暴露)
copy server_dynamic.py server.py

# 恢复静态版(通用 list_tools + call_tool)
# 用备份覆盖即可

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jh_mes_mcp-1.0.13.tar.gz (25.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jh_mes_mcp-1.0.13-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file jh_mes_mcp-1.0.13.tar.gz.

File metadata

  • Download URL: jh_mes_mcp-1.0.13.tar.gz
  • Upload date:
  • Size: 25.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.2

File hashes

Hashes for jh_mes_mcp-1.0.13.tar.gz
Algorithm Hash digest
SHA256 fa3762f80ba742cd8f5af01fa1046327e9114ca66e5e098fc53d35c8afc0eb6d
MD5 822018ac42e5ea2823ad525072a8db5a
BLAKE2b-256 a4b14247e4159f96a693d757acc2311a54b6f12d383cf8a545376d9d6515713d

See more details on using hashes here.

File details

Details for the file jh_mes_mcp-1.0.13-py3-none-any.whl.

File metadata

  • Download URL: jh_mes_mcp-1.0.13-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.2

File hashes

Hashes for jh_mes_mcp-1.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 7b8729fe8762925b2d834ffcd6003d17816be91da4554190161c64211299c0ed
MD5 ff92561f415c59c26311ef5dc5781b02
BLAKE2b-256 1fd6ccd0c2f8aa024dd711a3d54dcdc06ffaf175fd95fc639422e42920b6656f

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.34

2 files

1.0.33

2 files

1.0.32

2 files

1.0.31

2 files

1.0.30

2 files

1.0.28

2 files

1.0.27

2 files

1.0.26

2 files

1.0.25

2 files

1.0.23

2 files

1.0.22

2 files

1.0.21

2 files

1.0.20

2 files

1.0.19

2 files

1.0.18

2 files

1.0.17

2 files

1.0.16

2 files

1.0.15

2 files

1.0.14

2 files

This release

1.0.13 This release

2 files

1.0.11

2 files

1.0.10

2 files

1.0.9

2 files

1.0.8

2 files

1.0.7

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page