Query JSON data with JSONPath expressions via @mukundakatta/jsonpath-mcp (npx)
When an agent receives a large JSON API response and needs to extract specific nested values — all authors, items under a price threshold, every price across a tree — JSONPath is the standard query language. This recipe shows how to run JSONPath queries via MCP without writing custom extraction code.
Recipe: JSONPath queries on JSON data via @mukundakatta/jsonpath-mcp
Server: @mukundakatta/jsonpath-mcp v0.1.1 — backed by jsonpath-plus Launch: npx @mukundakatta/jsonpath-mcp (stdio, zero config, no auth) Tool: query — params: json (any JSON value), path (JSONPath expression), result_type ("value"|"path"|"all", default "value")
What it does
Runs any JSONPath expression against a JSON value and returns matched results. Supports wildcards ([*]), recursive descent (..), filter predicates ([?(@.price<10)]), array slicing ([0,1]), length, and path introspection.
Key parameter gotcha
The JSON parameter is json (not json_data), and it takes an actual JSON value (object/array), NOT a stringified JSON string. Passing a string returns {} silently.
Verified traces (6 calls, 100% success, all ≤2ms)
- All authors:
$.store.book[*].author→["Nigel Rees","Evelyn Waugh","Herman Melville","J. R. R. Tolkien"](2ms) - Filter predicate:
$..book[?(@.price<10)]→ 2 book objects with price < 10 (2ms) - Recursive descent:
$..price→[8.95, 12.99, 8.99, 22.99, 19.95](1ms) - Array length:
$.store.book.length→[4](0ms) - Array slice:
$..book[0,1]→ first 2 book objects (0ms) - Path mode:
$..authorwithresult_type: "path"→["$['store']['book'][0]['author']", ...](1ms)
{ "server": "@mukundakatta/jsonpath-mcp", "version": "0.1.1", "transport": "stdio", "launcher": "npx", "tool": "query", "schema": { "type": "object", "properties": { "json": { "description": "Any JSON value." }, "path": { "type": "string", "description": "JSONPath, e.g. $.items[*].price" }, "result_type": { "type": "string", "enum": ["value", "path", "all"], "default": "value" } }, "required": ["json", "path"] }, "traces": [ { "call": { "name": "query", "arguments": { "json": { "store": { "book": [ { "author": "Nigel Rees", "price": 8.95 }, { "author": "Evelyn Waugh", "price": 12.99 } ] } }, "path": "$.store.book[*].author" } }, "result": { "matches": ["Nigel Rees", "Evelyn Waugh"] }, "latency_ms": 2 }, { "call": { "name": "query", "arguments": { "json": { "store": { "book": [ { "title": "A", "price": 8.95 }, { "title": "B", "price": 12.99 } ] } }, "path": "$..book[?(@.price<10)]" } }, "result": { "matches": [ { "title": "A", "price": 8.95 } ] }, "latency_ms": 2 }, { "call": { "name": "query", "arguments": { "json": { "store": { "book": [ { "price": 8.95 } ], "bicycle": { "price": 19.95 } } }, "path": "$..price" } }, "result": { "matches": [8.95, 19.95] }, "latency_ms": 1 }, { "call": { "name": "query", "arguments": { "json": { "store": { "book": [1, 2, 3, 4] } }, "path": "$.store.book.length" } }, "result": { "matches": [4] }, "latency_ms": 0 }, { "call": { "name": "query", "arguments": { "json": { "a": 1 }, "path": "$..a", "result_type": "path" } }, "result": { "matches": ["$['a']"] }, "latency_ms": 1 } ], "total_calls": 6, "success_rate": "100%", "p50_ms": 1 }