Skip to main content
Glama
Universal JSON Agent MCP

Universal JSON Agent MCP

by GautamVhavle

Universal JSON Agent MCP

Talk to your JSON files using natural language.

26 powerful tools to load, explore, query, aggregate, transform, and export — right from your AI editor.

PyPI   Python   MCP Badge   License   CI   Tests

uv tool install universal-json-agent-mcp

Getting Started  ·  26 Tools  ·  Web Server  ·  Development


Why?

Working with JSON shouldn't require writing a script every time. This tool lets you ask questions in plain English and get answers instantly.

You:  What's the total budget across all missions?

AI:   The total budget across all missions is $18,250,000,000.50
      (Used tools: load_json → sum_values)

Supported Clients

Any MCP Client

VS Code / Copilot

Claude Desktop

Cursor

stdio


Related MCP server: jsony-mcp

⚡ Getting Started

1. Install

uv tool install universal-json-agent-mcp   # install CLI once
uvx universal-json-agent-mcp               # run without installing
uv add universal-json-agent-mcp            # add dependency to your project

2. Configure your editor

Create .vscode/mcp.json in your workspace:

{
  "servers": {
    "universal-json-agent": {
      "type": "stdio",
      "command": "universal-json-agent-mcp"
    }
  }
}

Tip: Prefer zero-install? Use "command": "uvx" with "args": ["universal-json-agent-mcp"] instead.

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "universal-json-agent": {
      "command": "universal-json-agent-mcp"
    }
  }
}

Add to your Cursor MCP settings:

{
  "mcpServers": {
    "universal-json-agent": {
      "command": "universal-json-agent-mcp"
    }
  }
}
universal-json-agent-mcp
# or
uv run python -m universal_json_agent_mcp

Starts on stdio — pipe any MCP client into it.

3. Start asking questions

> Load data/orders.json and tell me what's inside
> How many missions have status "in_progress"?
> What's the total budget across all missions?
> Filter personnel where role contains "engineer"
> Sort by priority descending and show codenames
> Export the filtered results to CSV

🛠 Tools Reference

Load & Manage

Tool

What it does

load_json

Load a JSON file from disk into memory

list_loaded

List all loaded documents with metadata

unload_json

Remove a document from memory

Explore

Tool

What it does

get_keys

Get keys of an object or index range of an array

get_value

Retrieve value at a path (auto-truncated at 10 KB)

get_type

Return the JSON type at a path

get_structure

Schema-like skeleton — keys, types, nesting

Query

Tool

What it does

jsonpath_query

Run JSONPath — $.missions[*].codename

filter_objects

Filter by condition: eq, gt, lt, contains, regex…

search_text

Full-text search across all string values

Aggregate

Tool

What it does

count

Count items in an array or keys in an object

sum_values

Sum numeric values at a JSONPath

min_max

Get min and max of numeric values

unique_values

Distinct values at a JSONPath

value_counts

Frequency table — like pandas value_counts()

Transform

Tool

What it does

flatten

Flatten nested objects to dot-notation pairs

pick_fields

Project specific fields from array objects

group_by

Group objects by a field value

sort_by

Sort objects by a field

sample

Random N items from an array

Analytics

Tool

What it does

describe

Stats: count, mean, std, min, max, percentiles

multi_filter

Compound filters with AND / OR logic

compare

Diff two values — added, removed, changed keys

Export

Tool

What it does

export_csv

Export array of objects to CSV file

export_json

Export a value to a new JSON file

Introspect

Tool

What it does

distinct_paths

List every unique leaf path with types


🌐 Web Server Subproject (web/)

Optional FastAPI + LangChain web-server subproject inside this repo, wrapping all 26 root MCP tools for integrations, dashboards, or non-MCP workflows.

uv sync --extra web                       # install web deps with uv
cp .env.example .env                     # add your OpenRouter key
uv run python -m web.run --port 8000     # start server with uv
# open docs in browser: http://127.0.0.1:8000/docs

Endpoints

Method

Endpoint

Description

GET

/health

Health check

POST

/query

Upload JSON + ask a question

POST

/query/path

Reference a file on disk + ask a question

GET

/docs

Interactive Swagger UI

Example

curl -X POST http://localhost:8000/query \
  -F "file=@data/missions.json" \
  -F "query=What's the total budget?"
{
  "answer": "The total budget across all missions is $18,250,000,000.50",
  "steps": [
    {"tool": "load_json", "output": "Loaded 'missions' from data/missions.json"},
    {"tool": "sum_values", "output": "Sum: 18250000000.5  (from 4 values)"}
  ]
}

Configuration

Variable

Required

Default

Description

OPENROUTER_API_KEY

✅

—

Your OpenRouter API key

OPENROUTER_MODEL

—

openai/gpt-4o-mini

Any supported model


🧑‍💻 Development

git clone https://github.com/GautamVhavle/universal-json-agent.git
cd universal-json-agent
uv sync --extra dev
uv run pytest                            # 503 tests
uv run pytest -v                                        # verbose
uv run pytest tests/test_tools/test_aggregate.py        # one file
uv run pytest -k "test_filter"                          # by pattern

Releasing

Releases are fully automated via GitHub Actions:

git tag v0.3.0 -m "v0.3.0"
git push origin v0.3.0

Then create a GitHub Release for the tag — CI runs tests, builds, and publishes to PyPI.


Troubleshooting

  1. Verify the config file exists (.vscode/mcp.json for VS Code)

  2. Check the command is on your PATH: which universal-json-agent-mcp

  3. Restart the editor

You need to load a file first. Ask your AI: "Load the file data/example.json" — this calls load_json behind the scenes.

Large results are capped at ~10 KB. Use more specific paths, filters, or pick_fields to narrow results.

The model provider is rate-limiting you. Wait a moment or switch to a different model in your .env file.

uv sync --extra web

MIT License · Built with ❤️ by Gautam Vhavle · Star this repo if it helped you ⭐

Available Tools

26 tools
compareA

Compare two JSON values and report their differences.

Can compare two paths within the same document or across two documents. Reports added keys, removed keys, type changes, and value changes. Walks as deep as Python allows unless max_depth is set.

Args: alias_a: The alias of the first document. path_a: Path to the first value (default root). alias_b: The alias of the second document (defaults to alias_a). path_b: Path to the second value (default root). max_depth: Stop after this many nested levels. Omit to walk the full safe depth.

Returns: A structured diff report listing all differences found.

Inputs: alias_a (required), path_a, path_b, alias_b, +1 more. Returns: result

countB

Count items in an array or keys in an object at a given path.

Args: alias: The alias of the loaded document. path: Dot/bracket notation path. Empty string means root.

Returns: The item/key count at the given path.

Inputs: alias (required), path. Returns: result

describeA

Get a full statistical summary of numeric values matched by a JSONPath.

Returns count, mean, median, standard deviation, min, max, 25th/75th percentiles, and sum — like pandas .describe() for JSON.

Args: alias: The alias of the loaded document. expression: A JSONPath expression resolving to numbers (e.g. "$.orders[*].total").

Returns: A formatted statistical summary table.

Inputs: alias (required), expression (required). Returns: result

distinct_pathsA

List every unique leaf path in a JSON document.

Essential for understanding the shape of an unknown JSON file. For arrays, only the first N items are sampled to discover paths efficiently without scanning thousands of identical objects.

Args: alias: The alias of the loaded document. path: Starting path (default root). max_depth: Maximum recursion depth (default 10). sample_array_items: How many array elements to inspect (default 5).

Returns: A list of all discovered paths with their JSON types.

Inputs: alias (required), path, max_depth, sample_array_items. Returns: result

export_csvA

Export an array of objects to a CSV file.

If fields is omitted, all keys found across all objects are used as columns. Nested values (dicts, arrays) are serialized as JSON strings in the CSV.

Args: alias: The alias of the loaded document. path: Dot-notation path to the array of objects. output_path: File path for the output CSV. fields: Optional list of column names to include.

Returns: Confirmation with file path, row count, and column count.

Inputs: path (required), alias (required), output_path (required), fields. Returns: result

export_jsonA

Export a value at a path to a new JSON file.

Useful for saving a filtered subset or nested section of a large document.

Args: alias: The alias of the loaded document. output_path: File path for the output JSON. path: Dot-notation path to the value to export (default root). indent: JSON indentation level (default 2).

Returns: Confirmation with file path and size.

Inputs: alias (required), output_path (required), path, indent. Returns: result

filter_objectsB

Filter an array of objects by a field condition.

Operators: eq, neq, gt, gte, lt, lte, contains, regex.

Args: alias: The alias of the loaded document. path: Dot-notation path to the array (e.g. "products", "data.users"). field: The field name to filter on (e.g. "status", "price"). operator: Comparison operator (eq, neq, gt, gte, lt, lte, contains, regex). value: The value to compare against.

Returns: The filtered objects with a match count header.

Inputs: path (required), alias (required), field (required), value (required), +1 more. Returns: result

flattenA

Flatten a nested JSON object into dot-notation key-value pairs.

Converts nested structures like {"a": {"b": 1}} into {"a.b": 1}. Walks as deep as Python allows unless max_depth is set.

Args: alias: The alias of the loaded document. path: Dot-notation path to the object to flatten. Empty means root. separator: The separator for flattened keys (default "."). max_depth: Stop after this many nested levels. Omit to walk the full safe depth.

Returns: A flat mapping of dotted-path keys to their values.

Inputs: alias (required), path, max_depth, separator. Returns: result

get_keysA

Get all keys at a given path in a loaded JSON document.

Works on objects (returns key names) and arrays (returns index count).

Args: alias: The alias of the loaded document. path: Dot/bracket notation path to navigate into the document. Examples: "", "data.users", "items[0].tags". Empty string means root.

Returns: List of keys (for objects) or item count (for arrays).

Inputs: alias (required), path. Returns: result

get_structureA

Return a schema-like skeleton of a JSON document showing keys and types.

Useful for understanding the shape of deeply nested JSON without viewing all the actual data.

Args: alias: The alias of the loaded document. path: Dot/bracket notation path. Empty string means root. max_depth: How many levels deep to show (default 3).

Returns: An indented tree showing the document structure with types.

Inputs: alias (required), path, max_depth. Returns: result

get_typeA

Return the JSON type of the value at a given path.

Possible types: object, array, string, number, boolean, null. For objects and arrays, also includes the count of keys/items.

Args: alias: The alias of the loaded document. path: Dot/bracket notation path. Empty string means root.

Returns: The JSON type (e.g. "object (5 keys)", "array (100 items)", "string").

Inputs: alias (required), path. Returns: result

get_valueA

Retrieve the value at an exact path in a loaded JSON document.

The output is automatically truncated if it exceeds 10KB to prevent overwhelming the context window.

Args: alias: The alias of the loaded document. path: Dot/bracket notation path. Empty string means root.

Returns: The JSON value at the given path (serialized, possibly truncated).

Inputs: alias (required), path. Returns: result

group_byB

Group an array of objects by a field value.

Args: alias: The alias of the loaded document. path: Dot-notation path to the array of objects. field: The field to group by (e.g. "category", "status").

Returns: A summary of groups with counts, plus the grouped data.

Inputs: path (required), alias (required), field (required). Returns: result

jsonpath_queryA

Execute a JSONPath expression against a loaded JSON document.

Use standard JSONPath syntax to extract data. Examples:

  • $.users[*].email — all user emails

  • $.orders[?@.total>100] — orders over 100

  • $.config.database.host — specific nested value

Args: alias: The alias of the loaded document. expression: A JSONPath expression (must start with $).

Returns: The matched values as a list, or a message if nothing matched.

Inputs: alias (required), expression (required). Returns: result

list_loadedA

List all currently loaded JSON documents with their metadata.

Returns: A formatted table showing alias, type, item count, size, and path for each loaded document, or a message if none are loaded.

Inputs: no named parameters. Returns: result

load_jsonA

Load a JSON file from disk into memory.

Args: file_path: Absolute or relative path to the JSON file. alias: Optional friendly name for the document (defaults to filename stem). replace: Set true to reload an alias that is already loaded.

Returns: Summary of the loaded document including type, size, and item count.

Inputs: file_path (required), alias, replace. Returns: result

min_maxA

Get the minimum and maximum of numeric values matched by a JSONPath expression.

Args: alias: The alias of the loaded document. expression: A JSONPath expression resolving to numbers.

Returns: The min, max, and count of matched values.

Inputs: alias (required), expression (required). Returns: result

multi_filterA

Filter an array of objects with multiple conditions combined by AND/OR.

Each condition is a dict with keys: field, operator, value. Operators: eq, neq, gt, gte, lt, lte, contains, regex.

Examples:

  • [{"field": "status", "operator": "eq", "value": "active"}, {"field": "score", "operator": "gt", "value": 80}]

  • mode="and" means ALL conditions must match.

  • mode="or" means ANY condition can match.

Args: alias: The alias of the loaded document. path: Dot-notation path to the array of objects. conditions: List of condition dicts. mode: "and" or "or" (default "and").

Returns: The filtered objects with a match count header.

Inputs: path (required), alias (required), conditions (required), mode. Returns: result

pick_fieldsA

Extract specific fields from each object in an array (projection).

Like SQL SELECT — picks only the columns you care about.

Args: alias: The alias of the loaded document. path: Dot-notation path to the array of objects. fields: List of field names to include (e.g. ["name", "price"]).

Returns: The projected array containing only the specified fields.

Inputs: path (required), alias (required), fields (required). Returns: result

sampleA

Return N random items from an array.

Useful for previewing large datasets without loading everything.

Args: alias: The alias of the loaded document. path: Dot-notation path to the array. Empty means root. n: Number of items to sample (default 5). seed: Optional random seed for reproducible results.

Returns: N randomly selected items from the array.

Inputs: alias (required), n, path, seed. Returns: result

search_textA

Recursively search all string values for a substring or regex pattern.

Returns the paths and values of every match found. Useful for finding where a specific term appears anywhere in a large JSON document. Walks as deep as Python allows unless max_depth is set.

Args: alias: The alias of the loaded document. pattern: A substring or regex pattern to search for. path: Optional starting path to narrow the search scope. case_sensitive: Whether matching is case-sensitive (default False). max_depth: Stop after this many nested levels. Omit to walk the full safe depth.

Returns: A list of matching paths and their string values.

Inputs: alias (required), pattern (required), path, max_depth, +1 more. Returns: result

sort_byB

Sort an array of objects by a field.

Args: alias: The alias of the loaded document. path: Dot-notation path to the array of objects. field: The field to sort by (e.g. "price", "name"). descending: Sort in descending order (default False = ascending).

Returns: The sorted array.

Inputs: path (required), alias (required), field (required), descending. Returns: result

sum_valuesB

Sum numeric values matched by a JSONPath expression.

Args: alias: The alias of the loaded document. expression: A JSONPath expression resolving to numbers (e.g. "$.orders[*].total").

Returns: The sum and count of matched numeric values.

Inputs: alias (required), expression (required). Returns: result

unique_valuesB

Get distinct values matched by a JSONPath expression.

Args: alias: The alias of the loaded document. expression: A JSONPath expression (e.g. "$.users[*].role").

Returns: A list of unique values with count information.

Inputs: alias (required), expression (required). Returns: result

unload_jsonB

Remove a loaded JSON document from memory.

Args: alias: The alias of the document to unload.

Returns: Confirmation that the document was unloaded.

Inputs: alias (required). Returns: result

value_countsA

Count occurrences of each distinct value matched by a JSONPath expression.

Like a frequency table: shows each unique value and how many times it appears. Results are sorted by count (most common first).

Args: alias: The alias of the loaded document. expression: A JSONPath expression (e.g. "$.orders[*].status").

Returns: A frequency table with values and their counts.

Inputs: alias (required), expression (required). Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 26 tools

    Disambiguation3/5

    Most tools have clear roles, but several pairs overlap significantly: filter_objects is essentially a single-condition subset of multi_filter, unique_values overlaps with value_counts, and jsonpath_query/get_value/get_keys/count all retrieve related path-based information. Descriptions help, but an agent could reasonably choose the wrong tool for filtering or value inspection.

    Naming Consistency4/5

    All names use consistent snake_case, and most are action-oriented (filter_objects, sum_values, export_csv, get_structure). A few names are noun phrases (value_counts, unique_values, distinct_paths, jsonpath_query) rather than verb_noun, which is a minor deviation but still predictable.

    Tool Count3/5

    At 26 tools, the surface is heavy for a JSON analysis server and includes redundant or near-redundant operations such as filter_objects/multi_filter and the multiple aggregation tools. The breadth is plausible for a 'universal' JSON agent, but some consolidation would make the set easier to use.

    Completeness3/5

    The server covers loading, inspection, querying, filtering, aggregation, transformation, comparison, and export well. However, it lacks mutation operations such as setting/deleting fields, merging documents, or saving modifications back, which are notable gaps for a universal JSON agent.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • -
      license
      C
      quality
      Not graded
      maintenance
      Enables AI to create, edit, and batch generate JSON data with advanced rule engines. Supports CRUD operations, node-level editing, template management, and multi-format file exports (JSON, JSONL, CSV).
      3
      179 npm
      -
    • A
      license
      A
      quality
      D
      maintenance
      Enables AI assistants to read, write, query, and manage JSON data files with automatic ID and timestamp generation.
      6
      23 npm
      1
      MIT
    • A
      license
      C
      quality
      D
      maintenance
      Enables LLMs to query and manipulate JSON data from URLs using JSONPath expressions with array, string, numeric, date, and aggregation operations via standardized tools.
      2
      MIT