JSON MCP Filter

JSON MCP Filter

MCP server for JSON schema generation, smart filtering, and secure chunked data extraction.

17
Stars
7
Forks
17
Watchers
1
Issues
JSON MCP Filter is an MCP-compliant server offering robust JSON schema generation and field-level filtering tools for both local files and remote HTTP/HTTPS endpoints. Leveraging quicktype for precise TypeScript type creation, it supports advanced features such as smart shape-based filtering, auto-chunking of large datasets, and memory-safe processing. Designed for seamless integration with popular MCP clients, it excels at extracting and preparing relevant JSON data for large language model contexts.

Key Features

JSON to TypeScript interface conversion using quicktype
Shape-based smart field extraction
Support for processing both local files and remote HTTP/HTTPS API endpoints
Automatic chunking of large datasets (400KB per chunk)
Enforced 50MB processing limit for memory safety
Clear, actionable error messages and debug info
Integration with Claude Desktop and Claude Code via MCP
Dry run analysis for chunking recommendations
Metadata inclusion with chunked responses
Security guidelines for remote data fetching

Use Cases

Filtering and extracting specific fields from large JSON files
Pre-processing API responses for efficient LLM context ingestion
Converting incoming JSON to strict TypeScript types for application development
Handling massive datasets by splitting them into safe chunks for downstream use
Quickly analyzing JSON file structure and recommending optimal chunking strategies
Automating type-safe pipelines for data ingestion to AI models
Protecting memory usage during processing of huge JSON data
Fetching, sanitizing, and preparing remote JSON data for data science workflows
Debugging and troubleshooting complex datasets with detailed error reporting
Ensuring only relevant context is provided to LLMs during prompt engineering

README

MseeP.ai Security Assessment Badge

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:

javascript
// 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 URL
  • shape: Object defining which fields to extract
  • chunkIndex (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 URL
  • shape: Object defining what to analyze

Returns: Size breakdown and chunk recommendations

📋 Usage Examples

Basic Filtering

javascript
// Simple field extraction
json_filter({
  filePath: "https://api.example.com/users",
  shape: {"name": true, "email": true}
})

Shape Patterns

javascript
// 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

javascript
// 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)

bash
# No installation required
npx json-mcp-filter@latest

Option 2: Global Install

bash
npm install -g json-mcp-filter@latest
json-mcp-server

Option 3: From Source

bash
git clone <repository-url>
cd json-mcp-filter
npm install
npm run build

⚙️ MCP Integration

Claude Desktop

Add to your configuration file:

json
{
  "mcpServers": {
    "json-mcp-filter": {
      "command": "npx",
      "args": ["-y", "json-mcp-filter@latest"]
    }
  }
}

Claude Code

bash
# 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

bash
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

bash
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_run first for large files
  • Filter with json_filter before 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://localhost during development
  • Local Files - File system access

💡 Common Workflows

LLM Integration:

  1. API returns large response
  2. json_filter extracts relevant fields
  3. Process clean data without noise
  4. json_schema generates types for safety

Star History

Star History Chart

Repository Owner

Repository Details

Language JavaScript
Default Branch master
Size 95 KB
Contributors 3
License MIT License
MCP Verified Nov 12, 2025

Programming Languages

JavaScript
59.97%
TypeScript
40.03%

Topics

claude-mcp data data-extraction data-filtering json json-analysis json-filter json-mcp-server json-parser json-schema-inference json-to-typescript json-utilities large-files mcp mcp-server query type-generation

Join Our Newsletter

Stay updated with the latest AI tools, news, and offers by subscribing to our weekly newsletter.

We respect your privacy. Unsubscribe at any time.

Related MCPs

Discover similar Model Context Protocol servers

  • mcp-server-webcrawl

    mcp-server-webcrawl

    Advanced search and retrieval for web crawler data via MCP.

    mcp-server-webcrawl provides an AI-oriented server that enables advanced filtering, analysis, and search over data from various web crawlers. Designed for seamless integration with large language models, it supports boolean search, filtering by resource types and HTTP status, and is compatible with popular crawling formats. It facilitates AI clients, such as Claude Desktop, with prompt routines and customizable workflows, making it easy to manage, query, and analyze archived web content. The tool supports integration with multiple crawler outputs and offers templates for automated routines.

    • 32
    • MCP
    • pragmar/mcp-server-webcrawl
  • Maigret MCP Server

    Maigret MCP Server

    OSINT username and URL search server for the Model Context Protocol.

    Maigret MCP Server provides Model Context Protocol (MCP) integration for the Maigret OSINT tool, enabling AI and context-aware applications to search for usernames across hundreds of social networks and analyze URLs. Designed for seamless operation with MCP-compatible clients like Claude Desktop, it supports multiple output formats and advanced filtering options. The server can be installed via Docker or npm, offers Docker-based deployment for consistent performance, and facilitates responsible OSINT research.

    • 205
    • MCP
    • BurtTheCoder/mcp-maigret
  • MobSF MCP Tool

    MobSF MCP Tool

    MCP-compatible interface for MobSF APK and IPA scanning

    MobSF MCP Tool enables integration of the Mobile Security Framework (MobSF) with the Model Context Protocol, allowing direct scanning and analysis of APK and IPA files through any MCP-capable client, such as Claude or 5ire. It leverages MobSF's REST API to automate file uploads, scan initiation, and report retrieval. The tool optimizes output for AI model contexts by filtering out overly large results and provides example configurations for seamless integration with leading AI desktop apps.

    • 15
    • MCP
    • pullkitsan/mobsf-mcp-server
  • Hacker News MCP Server

    Hacker News MCP Server

    Fetch and structure Hacker News stories via the Model Context Protocol.

    Provides an MCP server that enables fetching and parsing stories from Hacker News with structured output. Supports retrieval of different types of stories, configurable limits, and clean error handling. Designed for integration with Claude and other MCP-compatible interfaces, offering a standardized tool for AI-driven access to Hacker News data.

    • 35
    • MCP
    • pskill9/hn-server
  • Vectorize MCP Server

    Vectorize MCP Server

    MCP server for advanced vector retrieval and text extraction with Vectorize integration.

    Vectorize MCP Server is an implementation of the Model Context Protocol (MCP) that integrates with the Vectorize platform to enable advanced vector retrieval and text extraction. It supports seamless installation and integration within development environments such as VS Code. The server is configurable through environment variables or JSON configuration files and is suitable for use in collaborative and individual workflows requiring vector-based context management for models.

    • 97
    • MCP
    • vectorize-io/vectorize-mcp-server
  • AgentQL MCP Server

    AgentQL MCP Server

    MCP-compliant server for structured web data extraction using AgentQL.

    AgentQL MCP Server acts as a Model Context Protocol (MCP) server that leverages AgentQL's data extraction capabilities to fetch structured information from web pages. It allows integration with applications supporting MCP, such as Claude Desktop, VS Code, and Cursor, by providing an accessible interface for extracting structured data based on user-defined prompts. With configurable API key support and streamlined installation, it simplifies the process of connecting web data extraction workflows to AI tools.

    • 120
    • MCP
    • tinyfish-io/agentql-mcp
  • Didn't find tool you were looking for?

    Be as detailed as possible for better results