JSON MCP Server
A Model Context Protocol (MCP) server that provides powerful JSON manipulation tools using node-jq
with a locally installed jq
binary, native Node.js fs operations, and genson-js
.
Prerequisites
🚨 Required: Install jq binary on your system
Windows:
macOS:
Linux:
Verify installation:
Features
- Query JSON: Use jq notation to query JSON files with complex filters and transformations
- Generate JSON Schema: Automatically generate JSON schemas from existing JSON data
- Validate JSON Schema: Ensure that JSON schemas are properly formed and valid
- S3 Sync: Automatically sync JSON files from AWS S3 at startup with smart caching
Installation
- Clone or create the project directory:
- Save the provided files (
index.js
,package.json
) in this directory - Clean install dependencies:
- Make the script executable (Unix/Linux/macOS):
Claude Desktop Installation
Basic Configuration
Mac/Linux:
Windows:
Configuration with S3 Sync (Optional)
To enable automatic S3 synchronization, add AWS credentials and S3 parameters. Note: S3 sync only runs when both --s3-uri
and --file-path
arguments are provided:
Usage
Command Line Arguments
--verbose=true
: Enable verbose logging (default: false)--file-path=/path/to/file.json
: Set a default file path for operations (optional)--jq-path=/path/to/jq
: Specify custom jq binary path (auto-detected if not provided)--s3-uri=s3://bucket/key
: S3 URI to sync from at startup (optional)--aws-region=region
: AWS region for S3 operations (default: us-east-1)
Starting the Server
Windows (Command Prompt):
Windows (PowerShell):
Unix/Linux/macOS:
Using npm scripts (all platforms):
🪟 Windows Setup Guide for JSON MCP Server
Windows-Specific Installation
Option 1: Chocolatey (Recommended)
Option 2: Scoop
Option 3: Manual Installation
- Go to https://stedolan.github.io/jq/download/
- Download
jq-win64.exe
orjq-win32.exe
- Rename to
jq.exe
- Place in a directory in your PATH, or use
--jq-path
parameter
Option 4: WSL (Windows Subsystem for Linux)
Windows-Specific Issues and Solutions
Issue 1: "jq not found" Error
Symptoms:
Solutions:
- Check if jq is installed:
- Check PATH:
- If jq.exe specifically:
- Use custom path:
Issue 2: PowerShell Execution Policy
Symptoms:
Solution:
Issue 3: Antivirus Blocking jq.exe
Symptoms:
- jq installs but doesn't run
- "Access denied" errors
Solutions:
- Add jq.exe to antivirus exclusions
- Use Windows Defender exclusions:
- Settings → Update & Security → Windows Security → Virus & threat protection
- Add exclusion for jq.exe location
Issue 4: Path with Spaces
Symptoms:
Solution: Always quote paths with spaces:
Windows File Path Formats
The MCP server accepts multiple Windows path formats:
Testing on Windows
- Open Command Prompt or PowerShell as regular user (not Administrator unless needed)
- Navigate to your project directory:
- Install dependencies:
- Create test data:
- Start the server:
- Expected output:
Windows Development Tips
Use Windows Terminal
- Better than Command Prompt
- Supports Unicode output
- Multiple tabs
PowerShell vs Command Prompt
- Both should work
- PowerShell has better error messages
- Command Prompt is more compatible with older systems
Long Path Support
If you encounter path length issues:
Environment Variables
You can set default paths using environment variables:
Command Prompt:
PowerShell:
Common Windows jq Installation Paths
After installation, jq is typically found at:
- Chocolatey:
C:\ProgramData\chocolatey\bin\jq.exe
- Scoop:
C:\Users\{username}\scoop\apps\jq\current\jq.exe
- Manual: Wherever you placed it
- WSL:
/usr/bin/jq
(inside WSL)
The MCP server will auto-detect these common locations! 🎉
Tools
1. query_json
Query JSON data using jq notation.
Parameters:
filePath
(string, optional if default set): Absolute path to JSON filequery
(string, required): jq query expression
Example queries:
"."
- Return entire JSON".users"
- Get users array".users[0].name"
- Get first user's name".users[] | select(.active == true)"
- Filter active users".[].price | add"
- Sum all prices
2. generate_json_schema
Generate a JSON schema from a JSON file using genson-js.
Parameters:
filePath
(string, optional if default set): Absolute path to JSON file
Output: Complete JSON schema that describes the structure of your data.
3. validate_json_schema
Validate that a JSON schema is properly formed.
Parameters:
schema
(object): JSON schema object to validate, ORschemaFilePath
(string): Path to file containing JSON schema
Output: Validation result with detailed feedback.
Example JSON Data
Create a test file test-data.json
:
Example Usage with MCP Client
Once connected to an MCP client, you can use the tools like this:
Query Examples
Schema Generation
Schema Validation
Error Handling
The server provides detailed error messages for:
- Invalid file paths
- Malformed jq queries
- Invalid JSON data
- Schema validation errors
- File access issues
Requirements
- Node.js >= 18.0.0
- Access to the file system for reading JSON files
- Files must use absolute paths for security
S3 Sync Feature (Optional)
The server can automatically synchronize JSON files from AWS S3 at startup when the --s3-uri
argument is provided. This feature:
- Smart Sync: Only downloads if S3 file is newer than local file or local file doesn't exist
- Startup Integration: Sync happens before server connection, ensuring fresh data
- Error Recovery: Server continues startup even if S3 sync fails
- Progress Reporting: Shows download progress in verbose mode
AWS Credentials Configuration
The server supports multiple AWS credential methods:
- Environment Variables (recommended for Claude Desktop):
- AWS Profile: Uses default AWS profile or AWS CLI configuration
- IAM Roles: For EC2 instances or containerized environments
- AWS SSO: Single sign-on credentials
S3 Usage Examples
Dependencies
@modelcontextprotocol/sdk
: MCP protocol implementation (latest v1.x)node-jq
: Node.js wrapper for jq binary (uses your local jq installation)genson-js
: JSON schema generationajv
: JSON schema validationcommander
: Command line argument parsingwhich
: Binary path detection utility@aws-sdk/client-s3
: AWS S3 client for file synchronization
Troubleshooting
jq Binary Issues
If you get "jq binary not found" errors:
Windows:
- Install jq: Follow the prerequisites section above
- Check PATH: Ensure jq is in your system PATH
- Try jq.exe: Some Windows installations use
jq.exe
- Custom path: Use
--jq-path
if jq is in a non-standard location
Unix/Linux/macOS:
- Install jq: Follow the prerequisites section above
- Check PATH: Ensure jq is in your system PATH
- Custom path: Use
--jq-path
if jq is in a non-standard location
Dependency Issues
If you encounter dependency issues:
- Clean install:
- Node version: Ensure you're using Node.js >= 18.0.0
- Clear npm cache:
S3 Sync Issues
If you encounter S3 sync errors:
- Check AWS credentials: Ensure AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are set
- Verify bucket name: Ensure the S3 bucket name is correct and accessible
- Check permissions: Ensure your AWS credentials have read access to the S3 bucket
- Verify region: Ensure the AWS region matches your bucket's region
- Check file path: Ensure the local file path is absolute and the directory exists
Common S3 errors:
NoSuchBucket
: The bucket name is incorrect or doesn't existAccessDenied
: Your AWS credentials lack permission to access the bucketNotFound
: The specified S3 key (file path) doesn't exist in the bucket
Permission Issues
Windows:
- Usually no permission changes needed
- If you get access denied errors, run Command Prompt or PowerShell as Administrator
- Ensure jq.exe is not blocked by antivirus software
Unix/Linux/macOS: If you get permission errors:
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Provides powerful JSON manipulation tools through Model Context Protocol, enabling complex queries, schema generation, and validation with jq notation and native Node.js operations.
- Prerequisites
- Features
- Installation
- Claude Desktop Installation
- Usage
- 🪟 Windows Setup Guide for JSON MCP Server
- Windows-Specific Installation
- Windows-Specific Issues and Solutions
- Windows File Path Formats
- Testing on Windows
- Windows Development Tips
- Environment Variables
- Common Windows jq Installation Paths
- Tools
- Example JSON Data
- Example Usage with MCP Client
- Error Handling
- Requirements
- S3 Sync Feature (Optional)
- Dependencies
- Troubleshooting
- Contributing
Related MCP Servers
- AsecurityAlicenseAqualityA Model Context Protocol server that extracts embedded data (such as i18n translations or key/value configurations) from TypeScript/JavaScript source code into structured JSON configuration files.Last updated -24266JavaScriptMIT License
- AsecurityAlicenseAqualityA comprehensive Model Context Protocol server that provides advanced Node.js development tooling for automating project creation, component generation, package management, and documentation with AI-powered assistance.Last updated -74JavaScriptMIT License
- AsecurityAlicenseAqualityA Model Context Protocol server implementation that enables LLMs to query and manipulate JSON data using JSONPath syntax with extended operations for filtering, sorting, transforming, and aggregating data.Last updated -252267JavaScriptMIT License
- AsecurityAlicenseAqualityA Model Context Protocol server that transforms text into structured JSON data using templates with placeholders.Last updated -21TypeScriptMIT License