A Model Context Protocol (MCP) server that provides JSON schema generation and filtering tools. This server uses quicktype to convert JSON samples into TypeScript type definitions and offers JSON data filtering capabilities.
Particulary helpful for JSON files that are on the larger side which contains data you don't want included in your LLM context.
- JSON Schema Generation: Convert JSON files into TypeScript type definitions using quicktype-core
- JSON Filtering: Extract specific fields from JSON data using shape-based filtering
- MCP Integration: Seamlessly integrates with Claude Desktop and Claude Code
- Type Safety: Built with TypeScript and includes comprehensive error handling
Generates TypeScript type definitions from JSON files.
Parameters:
filePath
: Path to the JSON file to analyze
Example:
{"name": "John", "age": 30, "city": "New York"}
Generates TypeScript interfaces with proper typing.
Extracts specific fields from JSON data using a shape definition.
Parameters:
filePath
: Path to the JSON file to filtershape
: Shape object defining which fields to extract
Shape Examples:
// Extract single field
{"name": true}
// Extract multiple fields
{"name": true, "age": true}
// Extract nested fields
{"user": {"name": true, "email": true}}
// Extract from arrays (applies to each item)
{"users": {"name": true, "age": true}}
# Using npx (no installation required)
npx json-mcp-filter@latest
# Or install globally
npm install -g json-mcp-filter@latest
json-mcp-server
- Clone this repository:
git clone <repository-url>
cd json-mcp-filter
- Install dependencies:
npm install
- Build the server:
npm run build
Add this server to your Claude Desktop configuration file:
{
"mcpServers": {
"json-mcp-filter": {
"command": "node",
"args": ["/path/to/json-mcp-filter/build/index.js"]
}
}
}
Add this server to your Claude Code MCP settings:
Add a new server with:
- Name:
json-mcp-filter
- Command:
node
- Args:
["/path/to/json-mcp-filter/build/index.js"]
Or, use the npx
method for easier setup:
{
"mcpServers": {
"json-mcp-filter": {
"command": "npx",
"args": ["-y", "json-mcp-filter@latest"]
}
}
}
Or claude mcp add json-mcp-filter node /path/to/json-mcp-filter/build/index.js
npm run build
- Compile TypeScript and make executablenpm run start
- Run the compiled servernpm run inspect
- Run with MCP inspector for debuggingnpx tsc --noEmit
- Type check without emitting files
Test the server using the MCP inspector:
npm run inspect
This will start the server with the MCP inspector interface for interactive testing.
src/
index.ts # Main server implementation with tools
test/
test.json # Sample JSON file for testing
build/ # Compiled TypeScript output
The server includes error handling for:
- File not found errors
- Invalid JSON format
- Quicktype processing errors
- Shape filtering errors