# JSON Path Query Engine MCP

> JSON Path Query Engine is an MCP that lets you surgically extract specific data points from massive, complex JSON payloads. Instead of sending a huge API response to your agent and risking context window overload, this tool uses precise JSONPath expressions to pull out only the fields you need—like all email addresses or every order total—saving tokens and keeping your conversation focused.

## Overview
- **Category:** loved-by-devs
- **Price:** Free
- **Tags:** json-query, data-extraction, api-parsing, token-optimization, data-filtering

## Description

Working with APIs often means receiving enormous data dumps. You might get a 5,000-token payload containing dozens of records when really, you just needed three specific values: the user ID, the item name, and the final price. Sending that whole blob to your AI client is wasteful and noisy. This MCP lets you bypass that problem entirely. It runs specialized pathing logic to look through deeply nested data structures using standard JSONPath syntax. You give it the raw JSON and a precise expression (like `$.orders[0].total_price`), and it spits out only the matching values. This capability means your agent doesn't have to read gigabytes of unnecessary text; it gets clean, filtered results immediately. It's essential for keeping your prompts efficient, whether you connect Vinkius through Claude or Cursor.

## Tools

### query_json
Pass a raw JSON string and a path expression to extract every value that matches the defined path.

## Prompt Examples

**Prompt:** 
```
Extract all author names from this bookstore JSON.
```

**Response:** 
```
JSONPath Result: 4 matches found.
```

## Capabilities

### Extract specific fields from JSON
You pass the MCP a raw JSON string and a path expression to pull out only matching data points.

### Query nested arrays
The tool can search through complex, deeply nested structures within the payload using advanced paths like `$.users[*].email`.

### Reduce context window load
You eliminate sending large amounts of unnecessary data to your agent, saving tokens and improving response reliability.

## Use Cases

### Needing all author emails from a bookstore API payload
A developer receives a massive JSON file containing details for hundreds of books. Instead of asking the agent to 'find all emails,' they use query_json with `$.bookstore[*].authors[*].email` to get one clean list of every single email address, ignoring book titles and prices entirely.

### Extracting multiple order totals for a billing process
An analyst needs to calculate the total value from an array of line items. They use query_json on the raw payload with `$.orders[*].total_price` to pull every single price into a list, making it easy to sum up and verify against a database record.

### Finding all user IDs associated with failed transactions
The operations team gets an error log containing thousands of records. They use the MCP to specifically query for `$.transactions[?(@.status=='FAILED')].user_id`, instantly generating a precise, actionable list of only the affected users.

### Parsing complex nested user profiles
A system needs to pull the secondary phone number and primary billing address from a deeply structured JSON profile. They use query_json with multiple specific paths (e.g., `$.contact.secondary_phone` and `$.billing.address`) to guarantee they get exactly what they need.

## Benefits

- You save tokens by not dumping entire API responses. Instead of sending a 5,000-token payload to your agent, you use the query_json tool to pull just the three fields you need, keeping costs down and context clear.
- The ability to search deeply nested data is huge. You can target specific records, like finding all email addresses (`$.users[*].email`) across a whole user list without manually looping through the JSON structure.
- Your agent processes clean results, not noise. By filtering the payload first, your AI client doesn't waste time reading irrelevant metadata or boilerplate text; it acts on facts.
- It vastly improves reliability when dealing with complex data sets. Instead of relying on the LLM to 'figure out' where a value is buried, you tell it exactly where using JSONPath syntax.
- You get structured output for scripting. This MCP ensures that whether you are building an agent pipeline or running a local test, the extracted values are consistent and ready for immediate use.

## How It Works

The bottom line is you stop sending entire API responses and start sending targeted, pre-filtered datasets.

1. First, you provide the MCP with two things: the full raw JSON string that came from an API, and a specific JSONPath expression defining the data you want.
2. The engine processes this input, running the pathing logic against the massive payload to locate every piece of data that matches your defined criteria.
3. You get back only a clean list of values. The raw JSON remains hidden; your agent only sees the filtered results.

## Frequently Asked Questions

**How do I use JSON Path Query Engine with multiple arrays?**
You reference the array structure directly within the path expression using wildcards like `[*]` or specific indices. For example, to get emails from all users, you'd use `$.users[*].email`.

**Is JSON Path Query Engine better than just asking my AI client to extract data?**
Yes, because it enforces structure. Your agent relies on its interpretation of the text; this MCP uses established, mathematical pathing logic, guaranteeing that if a value exists at that path, you'll retrieve it.

**What is the best way to use query_json?**
Pass the raw JSON string into the tool first. Then, construct your specific path expression based on where the data lives (e.g., `$.results[0].value`). Always start with the most precise path possible.

**Does JSON Path Query Engine handle different types of payloads?**
It handles any raw JSON payload, provided that structure is consistent and follows standard JSON syntax. It doesn't care if the data is finance, health records, or gaming scores.

**Can I use this MCP to search across multiple nested levels?**
Absolutely. You can use advanced pathing (like `$..field`) to recursively search for a field regardless of how many layers deep it is within the JSON structure.