MCP server for advanced JSON parsing — load, query, aggregate, transform any JSON file from GitHub Copilot, Claude, Cursor, or any MCP client.
Project description
Universal JSON Agent MCP
An MCP server for parsing, querying, and analysing JSON files — installable from PyPI.
pip install universal-json-agent-mcp
26 tools for loading, exploring, querying, aggregating, transforming, and exporting JSON — usable from GitHub Copilot, Claude Desktop, Cursor, or any MCP client.
Table of Contents
- Quick Start
- MCP Client Configuration
- Web API Server (Optional)
- Tools Reference
- Development
- Project Structure
- Testing
- Configuration
- Troubleshooting
Quick Start
Install
pip install universal-json-agent-mcp
# or
uv add universal-json-agent-mcp
Run
universal-json-agent-mcp
# or
python -m universal_json_agent_mcp
The server starts on stdio — connect any MCP client to it.
MCP Client Configuration
VS Code / GitHub Copilot
Add to .vscode/mcp.json in your workspace:
{
"servers": {
"universal-json-agent": {
"type": "stdio",
"command": "universal-json-agent-mcp"
}
}
}
Or use uvx (no install needed):
{
"servers": {
"universal-json-agent": {
"type": "stdio",
"command": "uvx",
"args": ["universal-json-agent-mcp"]
}
}
}
Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"universal-json-agent": {
"command": "universal-json-agent-mcp"
}
}
}
Cursor
Add to Cursor's MCP settings:
{
"mcpServers": {
"universal-json-agent": {
"command": "universal-json-agent-mcp"
}
}
}
Example prompts
Once connected, ask natural-language questions in your AI chat:
Load the file data/orders.json and tell me what's in it
How many missions are there?
What are the codenames of all missions with status "in_progress"?
What's the total budget across all missions?
Sort missions by budget descending
Get all personnel names using JSONPath
Web API Server (Optional)
The repo also includes a standalone FastAPI + LangChain web server that wraps the same 26 tools behind a REST API. See web/ for details.
# Install web dependencies
pip install -r web/requirements.txt
# Set your OpenRouter API key
cp .env.example .env # then edit .env
# Start the server
python -m web.run --port 8000
Endpoints: GET /health, POST /query (file upload), POST /query/path (file on disk). Swagger UI at /docs.
Tools Reference
Load & Manage
| Tool | Description |
|---|---|
load_json |
Load a JSON file from disk into memory |
list_loaded |
Show all loaded documents with metadata |
unload_json |
Remove a document from memory |
Explore
| Tool | Description |
|---|---|
get_keys |
Get keys (object) or index range (array) at a path |
get_value |
Retrieve the value at a path (auto-truncated at 10KB) |
get_type |
Return the JSON type at a path |
get_structure |
Schema-like skeleton showing keys and types |
Query
| Tool | Description |
|---|---|
jsonpath_query |
Execute a JSONPath expression (e.g. $.users[*].email) |
filter_objects |
Filter arrays by a field condition (eq, gt, lt, contains, regex…) |
search_text |
Recursively search all string values for a substring or regex |
Aggregate
| Tool | Description |
|---|---|
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 |
Get distinct values at a JSONPath |
value_counts |
Frequency table of values (like pandas value_counts()) |
Transform
| Tool | Description |
|---|---|
flatten |
Flatten nested objects into dot-notation key-value pairs |
pick_fields |
Project specific fields from array objects |
group_by |
Group array objects by a field value |
sort_by |
Sort array objects by a field |
sample |
Return N random items from an array |
Analytics
| Tool | Description |
|---|---|
describe |
Statistical summary (count, mean, std, min, max, percentiles) |
multi_filter |
Filter with multiple AND/OR conditions |
compare |
Diff two JSON values — added/removed keys, type/value changes |
Export
| Tool | Description |
|---|---|
export_csv |
Export an array of objects to CSV |
export_json |
Export a value at a path to a new JSON file |
Introspect
| Tool | Description |
|---|---|
distinct_paths |
List every unique leaf path in a document with types |
Development
# Clone and install for development
git clone https://github.com/GautamVhavle/universal-json-agent.git
cd universal-json-agent
uv sync --extra dev
Project Structure
universal-json-agent/
├── src/universal_json_agent_mcp/ # Installable MCP server package
│ ├── __init__.py
│ ├── __main__.py # python -m universal_json_agent_mcp
│ ├── server.py # MCP entry point — registers all 26 tools
│ ├── store.py # In-memory document store with metadata
│ ├── tools/
│ │ ├── load.py # load_json, list_loaded, unload_json
│ │ ├── explore.py # get_keys, get_value, get_type, get_structure
│ │ ├── query.py # jsonpath_query, filter_objects, search_text
│ │ ├── aggregate.py # count, sum_values, min_max, unique_values, value_counts
│ │ ├── transform.py # flatten, pick_fields, group_by, sort_by, sample
│ │ ├── stats.py # describe
│ │ ├── advanced_query.py # multi_filter, compare
│ │ ├── export.py # export_csv, export_json
│ │ └── introspect.py # distinct_paths
│ └── utils/
│ ├── path_resolver.py # Dot/bracket path navigation
│ └── truncation.py # Smart output capping
│
├── web/ # Optional FastAPI + LangChain web server
├── tests/ # 489 tests
├── pyproject.toml # Package metadata (PyPI)
├── LICENSE # MIT
└── sample.json # Example JSON file
Testing
# Run all tests
uv run pytest
# Run with verbose output
uv run pytest -v
# Run a specific test file
uv run pytest tests/test_tools/test_aggregate.py
# Run tests matching a name pattern
uv run pytest -k "test_filter"
Configuration
Environment variables
| Variable | Required | Default | Description |
|---|---|---|---|
OPENROUTER_API_KEY |
Yes (web only) | — | Your OpenRouter API key |
OPENROUTER_MODEL |
No | openai/gpt-4o-mini |
Any model from openrouter.ai/models |
MCP server config
The MCP server requires no configuration. It's registered via .vscode/mcp.json and uses stdio transport.
Troubleshooting
| Problem | Solution |
|---|---|
| MCP server not appearing in Copilot | Make sure .vscode/mcp.json exists and the workspace is open. Restart VS Code. |
| "No document loaded" errors | Call load_json first before querying. |
| Truncated output | Large results are capped at ~10KB. Use specific paths or filters to narrow results. |
OPENROUTER_API_KEY not set |
Create a .env file from .env.example and add your key. |
| 429 Too Many Requests | You're rate-limited by the model provider. Wait a moment or switch to a different model. |
| Import errors in web server | Run uv pip install -r web/requirements.txt to install web dependencies. |
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file universal_json_agent_mcp-0.1.2.tar.gz.
File metadata
- Download URL: universal_json_agent_mcp-0.1.2.tar.gz
- Upload date:
- Size: 65.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
496d2442ffbb572df50bc569c71e01b81123a4c5fb9a80abc038a28c9d50b41c
|
|
| MD5 |
4b91501f4a07f9f0f3ccdbf6eaaf914d
|
|
| BLAKE2b-256 |
8c20aafb70816edaf1acc79ea42c4361923754a4d49c0dbf4b6e3d4e040d90fa
|
Provenance
The following attestation bundles were made for universal_json_agent_mcp-0.1.2.tar.gz:
Publisher:
publish.yml on GautamVhavle/universal-json-agent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
universal_json_agent_mcp-0.1.2.tar.gz -
Subject digest:
496d2442ffbb572df50bc569c71e01b81123a4c5fb9a80abc038a28c9d50b41c - Sigstore transparency entry: 1110804161
- Sigstore integration time:
-
Permalink:
GautamVhavle/universal-json-agent@9bb91753cb84ea7706c5043040919d5e4c8ee3f7 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/GautamVhavle
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9bb91753cb84ea7706c5043040919d5e4c8ee3f7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file universal_json_agent_mcp-0.1.2-py3-none-any.whl.
File metadata
- Download URL: universal_json_agent_mcp-0.1.2-py3-none-any.whl
- Upload date:
- Size: 33.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97226493b58973dd17d902f4b190094538c58044203e3070834c60b00d6a2d6c
|
|
| MD5 |
6a431c5641016406c08f3a501a857fea
|
|
| BLAKE2b-256 |
d8550a19fd2d5646b383f0f2471b6d6ccc51c328cfe8c33756ef31cbe350bc10
|
Provenance
The following attestation bundles were made for universal_json_agent_mcp-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on GautamVhavle/universal-json-agent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
universal_json_agent_mcp-0.1.2-py3-none-any.whl -
Subject digest:
97226493b58973dd17d902f4b190094538c58044203e3070834c60b00d6a2d6c - Sigstore transparency entry: 1110804205
- Sigstore integration time:
-
Permalink:
GautamVhavle/universal-json-agent@9bb91753cb84ea7706c5043040919d5e4c8ee3f7 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/GautamVhavle
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9bb91753cb84ea7706c5043040919d5e4c8ee3f7 -
Trigger Event:
release
-
Statement type: