MCP ExplorerExplorer

Gongrzhe Json Mcp Server

@MCP-Mirroron 10 months ago
1 MIT
FreeCommunity
AI Systems
Mirror of https://github.com/GongRzhe/JSON-MCP-Server

Overview

What is Gongrzhe Json Mcp Server

GongRzhe_JSON-MCP-Server is an implementation of a JSON Model Context Protocol (MCP) server designed for querying and manipulating JSON data. It allows Large Language Models (LLMs) to interact with JSON data through standardized tools.

Use cases

Use cases include querying complex JSON datasets, filtering data for specific conditions, transforming data structures, and performing statistical analysis on JSON data.

How to use

To use GongRzhe_JSON-MCP-Server, you can run it using npx with the specific version or install it globally using npm. After installation, you can start the server with the command ‘server-json-mcp’.

Key features

Key features include querying JSON data with JSONPath syntax, filtering JSON data based on conditions, and supporting various operations such as array manipulation, string processing, numeric calculations, date formatting, and aggregation functions.

Where to use

GongRzhe_JSON-MCP-Server can be used in fields such as data analysis, application development, and any scenario requiring interaction with JSON data, particularly in environments involving LLMs.

Content

JSON MCP Server (@gongrzhe/[email protected])

A JSON Model Context Protocol (MCP) server implementation for querying and manipulating JSON data. This server enables LLMs to interact with JSON data through a set of standardized tools.

Installation & Usage

# Using npx with specific version (recommended)
npx @gongrzhe/[email protected]

# Install specific version globally
npm install -g @gongrzhe/[email protected]

# Run after global installation
server-json-mcp

Components

Tools

  • query

    • Query JSON data using JSONPath syntax with extended operations
    • Input:
      • url (string): URL of the JSON data source
      • jsonPath (string): JSONPath expression with optional operations
  • filter

    • Filter JSON data using conditions
    • Input:
      • url (string): URL of the JSON data source
      • jsonPath (string): Base JSONPath expression
      • condition (string): Filter condition

Supported Operations

Array Operations

  • Slicing: $[0:5], $[-3:], $[1:4]
  • Sorting: $.sort(price), $.sort(-price)
  • Distinct: $.distinct()
  • Transformations:
    • Map: $.map(fieldName)
    • Flatten: $.flatten()
    • Union: $.union([1,2,3])
    • Intersection: $.intersection([1,2,3])

String Operations

  • Case: $.toLowerCase(), $.toUpperCase()
  • Tests: $.startsWith('test'), $.endsWith('test')
  • Search: $.contains('test'), $.matches('pattern')

Numeric Operations

  • Math: $.math(+10), $.pow2()
  • Rounding: $.round(), $.floor(), $.ceil()
  • Functions: $.abs(), $.sqrt()

Date Operations

  • Format: $.format('YYYY-MM-DD')
  • Check: $.isToday()
  • Modify: $.add(1, 'days')

Aggregation Operations

  • Group: $.groupBy(category)
  • Stats: $.sum(price), $.avg(price), $.min(price), $.max(price)

Configuration

Usage with Claude Desktop

To use this server with the Claude Desktop app, add the following configuration to your claude_desktop_config.json:

{
  "json": {
    "command": "npx",
    "args": [
      "@gongrzhe/[email protected]"
    ]
  }
}

Alternatively, you can use the node command directly if you have the package installed:

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

Development

Building from Source

  1. Clone the repository
  2. Install dependencies:
    npm install
    
  3. Build the project:
    npm run build
    

Notes

  1. All JSONPath expressions start with $ representing the root object
  2. Array indices are zero-based
  3. String values in operations should be wrapped in quotes
  4. Date operations support ‘days’, ‘months’, and ‘years’ units
  5. Numeric operations support basic arithmetic operators (+, -, *, /)

License

MIT

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers