Skip to main content
Glama

JSON MCP 服务器 (@gongrzhe/server-json-mcp@1.0.3)

用于查询和操作 JSON 数据的 JSON 模型上下文协议 (MCP) 服务器实现。该服务器使 LLM 能够通过一组标准化工具与 JSON 数据进行交互。

安装与使用

# Using npx with specific version (recommended) npx @gongrzhe/server-json-mcp@1.0.3 # Install specific version globally npm install -g @gongrzhe/server-json-mcp@1.0.3 # Run after global installation server-json-mcp

Related MCP server: MongoDB MCP Server for LLMs

成分

工具

  • 询问

    • 使用 JSONPath 语法和扩展操作查询 JSON 数据

    • 输入:

      • url (字符串):JSON 数据源的 URL

      • jsonPath (字符串):带有可选操作的 JSONPath 表达式

  • 筛选

    • 使用条件过滤 JSON 数据

    • 输入:

      • url (字符串):JSON 数据源的 URL

      • jsonPath (字符串):基本 JSONPath 表达式

      • condition (字符串):过滤条件

支持的操作

数组操作

  • 切片$[0:5]$[-3:]$[1:4]

  • 排序$.sort(price)$.sort(-price)

  • 不同$.distinct()

  • 转变

    • 地图: $.map(fieldName)

    • 展平: $.flatten()

    • 联合: $.union([1,2,3])

    • 交集: $.intersection([1,2,3])

字符串操作

  • 大小写$.toLowerCase()$.toUpperCase()

  • 测试$.startsWith('test')$.endsWith('test')

  • 搜索$.contains('test')$.matches('pattern')

数值运算

  • 数学$.math(+10)$.pow2()

  • 四舍五入$.round()$.floor()$.ceil()

  • 函数$.abs()$.sqrt()

日期操作

  • 格式$.format('YYYY-MM-DD')

  • 检查$.isToday()

  • 修改$.add(1, 'days')

聚合操作

  • $.groupBy(category)

  • 统计数据$.sum(price)$.avg(price)$.min(price)$.max(price)

配置

与 Claude Desktop 一起使用

要将此服务器与 Claude Desktop 应用程序一起使用,请将以下配置添加到您的claude_desktop_config.json中:

{ "json": { "command": "npx", "args": [ "@gongrzhe/server-json-mcp@1.0.3" ] } }

或者,如果您已经安装了该包,则可以直接使用 node 命令:

{ "json": { "command": "node", "args": [ "path/to/build/index.js" ] } }

发展

从源代码构建

  1. 克隆存储库

  2. 安装依赖项:

    npm install
  3. 构建项目:

    npm run build

笔记

  1. 所有 JSONPath 表达式都以$开头,表示根对象

  2. 数组索引从零开始

  3. 操作中的字符串值应该用引号引起来

  4. 日期操作支持‘天’、‘月’和‘年’单位

  5. 数字运算支持基本算术运算符(+、-、*、/)

执照

麻省理工学院

One-click Deploy
A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/GongRzhe/JSON-MCP-Server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server