
JSON MCP 服务器只过滤与你的大型语言模型相关的数据
概览
一个强大的模型上下文协议(MCP)服务器,为本地文件和远程 HTTP/HTTPS 端点提供 JSON 模式生成和过滤工具。采用 Quicktype 构建,实现稳健的 TypeScript 类型生成。 :过滤大型 JSON 文件和 API 响应,只提取与 LLM 上下文相关的数据,同时保持类型安全。 - 🔄 - 利用 quicktype 将 JSON 转换为 TypeScript 接口 - 🎯 - 利用基于形状的过滤提取特定字段 - 🌐 支持 HTTP/HTTPS URL 和 API 端点 - 📦 - 自动处理 400KB 分块处理大型数据集 - 🛡️ - 内置 50MB 限制并具内存安全 - ⚡ - 与 Claude Desktop 和 Claude 代码无缝集成 - 🚨 - 清晰且可操作的错误信息及调试信息 从 JSON 数据生成 TypeScript 接口。 - filePath:本地文件路径或HTTP/HTTPS地址 利用基于形状的过滤和自动分块提取特定字段,适用于大型数据集。
概述(AI 翻译)
一个强大的模型上下文协议(MCP)服务器,为本地文件和远程 HTTP/HTTPS 端点提供 JSON 模式生成和过滤工具。采用 Quicktype 构建,实现稳健的 TypeScript 类型生成。
完美用途:过滤大型JSON文件和API响应,只提取与LLM上下文相关的数据,同时保持类型安全。
✨ 主要特色
- 🔄 模式生成 - 使用 quicktype 将 JSON 转换为 TypeScript 接口
- 🎯 智能过滤 - 通过基于形状的过滤提取特定字段
- 🌐 远程支持 - 支持 HTTP/HTTPS URL 和 API 端点
- 📦 自动分块 - 自动400KB分块处理大型数据集
- 🛡️ 大小保护 - 内置50MB限制,带内存安全
- ⚡ MCP Ready - 与 Claude Desktop 和 Claude Code 无缝集成
- 🚨 智能错误 - 清晰且可操作的错误信息及调试信息
🛠️ 可用工具
json_schema
从 JSON 数据生成 TypeScript 接口。
参数:
filePath:本地文件路径或HTTP/HTTPS地址
示例:
json_filter
利用基于形状的过滤和自动分块提取特定字段,适用于大型数据集。
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 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
安装
npx -y json-mcp-filter@latest配置
{
"mcpServers": {
"json-mcp-filter": {
"command": "npx",
"args": ["-y", "json-mcp-filter@latest"]
}
}
}