Generate JSON Schemas and Filter Data
JSON MCP Server: Generates TypeScript schemas and filters JSON data from local files or URLs.
Why it matters
Automate data processing by generating JSON schemas and filtering local or remote JSON files. This asset helps extract specific data structures and provides TypeScript interfaces for better code integration.
Outcomes
What it gets done
Generate TypeScript interfaces from JSON data using quicktype.
Filter JSON files and API responses to extract specific fields.
Analyze large datasets and recommend chunking strategies.
Process data from HTTP/HTTPS endpoints and local files.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/vb-json | bash Capabilities
Tools your agent gets
Generates TypeScript interfaces from JSON data using quicktype
Extracts specific fields using shape-based filtering and automatic chunking of large datasets
Analyzes data size and provides chunking recommendations before filtering
Overview
JSON MCP Server
What it does
Connect to JSON data, generate TypeScript interfaces, and filter out unnecessary information. This tool is built with quicktype for robust TypeScript type generation.
For example, to get started without installation, you can use:
npx json-mcp-filter@latest
This allows you to perform tasks like:
// Simple field extraction
json_filter({
filePath: "https://api.example.com/users",
shape: {"name": true, "email": true}
})
Or analyze large datasets first:
// 1. Check size first
json_dry_run({filePath: "./large.json", shape: {"users": {"id": true}}})
// โ "Recommended chunks: 6"
How it connects
2024-05-15T11:30:00Z
Source README
JSON MCP Filter
A powerful Model Context Protocol (MCP) server that provides JSON schema generation and filtering tools for local files and remote HTTP/HTTPS endpoints. Built with quicktype for robust TypeScript type generation.
Perfect for: Filtering large JSON files and API responses to extract only relevant data for LLM context, while maintaining type safety.
โจ Key Features
- ๐ Schema Generation - Convert JSON to TypeScript interfaces using quicktype
- ๐ฏ Smart Filtering - Extract specific fields with shape-based filtering
- ๐ Remote Support - Works with HTTP/HTTPS URLs and API endpoints
- ๐ฆ Auto Chunking - Handles large datasets with automatic 400KB chunking
- ๐ก๏ธ Size Protection - Built-in 50MB limit with memory safety
- โก MCP Ready - Seamless integration with Claude Desktop and Claude Code
- ๐จ Smart Errors - Clear, actionable error messages with debugging info
๐ ๏ธ Available Tools
json_schema
Generates TypeScript interfaces from JSON data.
Parameters:
filePath: Local file path or HTTP/HTTPS URL
Example:
// Input JSON
{"name": "John", "age": 30, "city": "New York"}
// Generated TypeScript
export interface GeneratedType {
name: string;
age: number;
city: string;
}
json_filter
Extracts specific fields using shape-based filtering with automatic chunking for large datasets.
Parameters:
filePath: Local file path or HTTP/HTTPS URLshape: Object defining which fields to extractchunkIndex(optional): Chunk index for large datasets (0-based)
Auto-Chunking:
- โค400KB: Returns all data
400KB: Auto-chunks with metadata
json_dry_run
Analyzes data size and provides chunking recommendations before filtering.
Parameters:
filePath: Local file path or HTTP/HTTPS URLshape: Object defining what to analyze
Returns: Size breakdown and chunk recommendations
๐ Usage Examples
Basic Filtering
// Simple field extraction
json_filter({
filePath: "https://api.example.com/users",
shape: {"name": true, "email": true}
})
Shape Patterns
// Single field
{"name": true}
// Nested objects
{"user": {"name": true, "email": true}}
// Arrays (applies to each item)
{"users": {"name": true, "age": true}}
// Complex nested
{
"results": {
"profile": {"name": true, "location": {"city": true}}
}
}
Large Dataset Workflow
// 1. Check size first
json_dry_run({filePath: "./large.json", shape: {"users": {"id": true}}})
// โ "Recommended chunks: 6"
// 2. Get chunks
json_filter({filePath: "./large.json", shape: {"users": {"id": true}}})
// โ Chunk 0 + metadata
json_filter({filePath: "./large.json", shape: {"users": {"id": true}}, chunkIndex: 1})
// โ Chunk 1 + metadata
๐ Security Notice
Remote Data Fetching: This tool fetches data from HTTP/HTTPS URLs. Users are responsible for:
โ Safe Practices:
- Verify URLs point to legitimate endpoints
- Use trusted, public APIs only
- Respect API rate limits and terms of service
- Review data sources before processing
โ Maintainers Not Responsible For:
- External URL content
- Privacy implications of remote requests
- Third-party API abuse or violations
๐ก Recommendation: Only use trusted, public data sources.
๐ Quick Start
Option 1: NPX (Recommended)
# No installation required
npx json-mcp-filter@latest
Option 2: Global Install
npm install -g json-mcp-filter@latest
json-mcp-server
Option 3: From Source
git clone <repository-url>
cd json-mcp-filter
npm install
npm run build
โ๏ธ MCP Integration
Claude Desktop
Add to your configuration file:
{
"mcpServers": {
"json-mcp-filter": {
"command": "npx",
"args": ["-y", "json-mcp-filter@latest"]
}
}
}
Claude Code
# Add via CLI
claude mcp add json-mcp-filter npx -y json-mcp-filter@latest
Or add manually:
- Name:
json-mcp-filter - Command:
npx - Args:
["-y", "json-mcp-filter@latest"]
๐ง Development
Commands
npm run build # Compile TypeScript
npm run start # Run compiled server
npm run inspect # Debug with MCP inspector
npx tsc --noEmit # Type check only
Testing
npm run inspect # Interactive testing interface
๐ Project Structure
src/
โโโ index.ts # Main server + tools
โโโ strategies/ # Data ingestion strategies
โ โโโ JsonIngestionStrategy.ts # Abstract interface
โ โโโ LocalFileStrategy.ts # Local file access
โ โโโ HttpJsonStrategy.ts # HTTP/HTTPS fetching
โโโ context/
โ โโโ JsonIngestionContext.ts # Strategy management
โโโ types/
โโโ JsonIngestion.ts # Type definitions
๐จ Error Handling
Comprehensive Coverage
- Local Files: Not found, permissions, invalid JSON
- Remote URLs: Network failures, auth errors (401/403), server errors (500+)
- Content Size: Auto-reject >50MB with clear messages
- Format Detection: Smart detection of HTML/XML with guidance
- Rate Limiting: 429 responses with retry instructions
- Processing: Quicktype errors, shape filtering issues
All errors include actionable debugging information.
โก Performance
Processing Times
| File Size | Processing Time |
|---|---|
| < 100 KB | < 10ms |
| 1-10 MB | 100ms - 1s |
| 10-50 MB | 1s - 5s |
| > 50 MB | Blocked |
Size Protection
- 50MB maximum for all sources
- Pre-download checking via Content-Length
- Memory safety prevents OOM errors
- Clear error messages with actual vs. limit sizes
Best Practices
- Use
json_dry_runfirst for large files - Filter with
json_filterbefore schema generation - Focus shapes on essential fields only
๐ Supported Sources
- Public APIs - REST endpoints with JSON responses
- Static Files - JSON files on web servers
- Local Dev -
http://localhostduring development - Local Files - File system access
๐ก Common Workflows
LLM Integration:
- API returns large response
json_filterextracts relevant fields- Process clean data without noise
json_schemagenerates types for safety
Hosted deployment
A hosted deployment is available on Fronteir AI.
Discussion
Questions & comments ยท 0
Sign In Sign in to leave a comment.
