JSON MCP Server: JSONPath Arrays, Strings, Numbers, Dates
Query and process JSON with an MCP server using JSONPath for arrays, strings, numbers, and date operations.
npx -y @GongRzhe/JSON-MCP-ServerOverview
This MCP (Model Context Protocol) server provides a lightweight, HTTP-accessible set of JSON processing tools driven by JSONPath and common operations for arrays, strings, numbers, and dates. It is intended to be used as a tool endpoint for language models or other agents that need reliable, programmatic access to manipulate and query JSON data without embedding heavy processing logic in prompts.
The server exposes discrete “tools” that accept JSON inputs and return structured JSON outputs. Each tool focuses on a single kind of operation (for example, array filtering with JSONPath, string extraction with regex, numeric aggregation, or date parsing/formatting). That makes it easy to call from an MCP-capable client and chain results in multi-step reasoning or data-pipeline scenarios.
Features
- JSONPath-based array querying and selection
- String processing: regex extract, replace, split, join, trim
- Numeric operations: sum, average, min, max, count, map/transform
- Date handling: parse multiple formats, format to ISO, compute diffs
- Light-weight HTTP interface compatible with MCP tooling patterns
- Deterministic JSON outputs suitable for downstream programmatic use
- Small footprint and easy to self-host from source
Installation / Configuration
Clone the repository, install dependencies, and run the server locally. The project uses Node.js and npm (or yarn).
Clone and install:
Run the server (default port 8080):
# development
# or directly with node if provided entrypoint
Environment variables:
# example
If the repository includes an npm script for building:
Note: Adjust commands to match package.json scripts in the repository. See the project README and package.json for exact script names.
Available Tools
The server exposes a set of named tools. The example table below summarizes commonly provided tool names, their purpose, and the key arguments they accept.
| Tool name | Purpose | Key arguments |
|---|---|---|
| jsonpath.query | Select nodes from JSON using JSONPath | data (JSON), path (string) |
| array.filter | Filter array by JSONPath predicate or expression | data (array), predicate (JSONPath or expression) |
| string.match | Extract substring(s) via regex | data (string), pattern (regex), group (int optional) |
| string.replace | Replace strings using regex or literal | data (string), pattern, replacement |
| number.aggregate | Aggregate numeric arrays (sum, avg, min, max) | data (array of numbers), op (sum |
| date.parse | Parse date strings into ISO timestamps | data (string), format (optional) |
| date.format | Format ISO date to a given pattern | data (ISO string), format |
| date.diff | Compute difference between two dates | from, to, unit (days |
Tool invocations typically accept a JSON body describing the tool and its arguments and return a structured JSON result.
Use Cases
- Filter an array of products where price > 100 Request:
Response:
- Extract first capture group from a log message Request:
Response:
- Sum numeric values in an array Request:
Response:
- Parse a date string and compute days between two dates Request:
Response:
Example HTTP call (generic)
Below is a generic curl example showing the kind of request you send to invoke a tool. Adjust the URL and JSON shape to the server’s actual API.
Resources
- Source and issues: https://github.com/GongRzhe/JSON-MCP-Server
- Inspect package.json and README in the repository for exact scripts and any additional configuration options.
- Use MCP-compatible clients or simple HTTP POST requests to integrate this server into an LLM toolchain or automation pipeline.
Notes for Developers
- The server is intended to be deterministic and return machine-friendly JSON; design calling code to handle structured results and errors.
- When composing multi-step MCP workflows, prefer small, single-purpose tool invocations (for example, query then aggregate) to keep output predictable.
- Validate input sizes when sending large JSON payloads to avoid performance issues; the server is optimized for typical JSON sizes used in tool-based workflows.