jsonata-mcp
v1.0.0
Published
MCP Server to evaluate JSONata
Readme
jsonata-mcp
A Model Context Protocol (MCP) server that provides tools to evaluate and validate JSONata expressions. JSONata is a lightweight query and transformation language for JSON data.
Features
- Evaluate JSONata expressions against JSON data with a 5-second timeout for safety
- Validate JSONata syntax without execution
- Access JSONata function reference documentation for built-in functions
Installation
No manual install needed — use npx to run directly:
npx jsonata-mcpOr install globally:
npm install -g jsonata-mcp
jsonata-mcpThe server communicates over stdio, so it's designed to be launched by an MCP client rather than run directly.
Usage
Claude Desktop
Add to your Claude Desktop config (claude_desktop_config.json):
{
"mcpServers": {
"jsonata": {
"command": "npx",
"args": ["jsonata-mcp"]
}
}
}Claude Code
claude mcp add jsonata -- npx jsonata-mcpTools
evaluate_jsonata
Evaluate a JSONata expression against optional JSON data.
Parameters:
expression(string, required) — the JSONata expression to evaluatedata(any, optional) — JSON data to evaluate against
Example request:
{
"name": "evaluate_jsonata",
"arguments": {
"expression": "items[price > 10].name",
"data": {
"items": [
{"name": "Apple", "price": 5},
{"name": "Laptop", "price": 1200},
{"name": "Book", "price": 15}
]
}
}
}Example response:
{
"content": [
{
"type": "text",
"text": "{\"success\":true,\"result\":[\"Laptop\",\"Book\"],\"expression\":\"items[price > 10].name\",\"data\":{\"items\":[{\"name\":\"Apple\",\"price\":5},{\"name\":\"Laptop\",\"price\":1200},{\"name\":\"Book\",\"price\":15}]}}"
}
]
}validate_jsonata
Validate if a string is valid JSONata syntax without evaluating it.
Parameters:
expression(string, required) — the JSONata expression to validate
Example request:
{
"name": "validate_jsonata",
"arguments": {
"expression": "users[age >= 18].{\"name\": name, \"adult\": true}"
}
}Example response:
{
"content": [
{
"type": "text",
"text": "{\"valid\":true,\"expression\":\"users[age >= 18].{\\\"name\\\": name, \\\"adult\\\": true}\",\"message\":\"Expression is valid JSONata syntax\"}"
}
]
}jsonata_function_reference
Get reference information about JSONata built-in functions.
Parameters:
functionName(string, optional) — specific function to look up (e.g.$sum,$map)
Example request:
{
"name": "jsonata_function_reference",
"arguments": {
"functionName": "$sum"
}
}Example response:
{
"content": [
{
"type": "text",
"text": "{\"function\":\"$sum\",\"description\":\"Returns the sum of an array of numbers\",\"category\":\"numeric\"}"
}
]
}Resources
- JSONata Documentation
- JSONata Exerciser — interactive playground
- JSONata GitHub
Development
npm run dev # watch mode (recompiles on change)
npm test # run tests
npm run build # compile TypeScript