Supports containerized deployment with Docker, enabling portable execution with volume support for persistent schema storage.
Implements a Server-Sent Events (SSE) server using FastAPI, enabling real-time streaming validation for web clients.
Provides JSON Schema validation capabilities for GitHub Copilot, allowing AI-assisted schema validation through MCP configuration.
Offers database integration for schema storage with PostgreSQL, providing CRUD operations for schema collections with automatic table creation.
Utilizes Pydantic for data validation within the MCP server implementation.
Incorporates Ruff for code linting and formatting as part of the development toolchain.
JSON Schema Validator MCP Server
A comprehensive JSON Schema validation server implementing the Model Context Protocol (MCP) with support for JSON Schema Draft 2020-12, external references, and real-time streaming validation.
🚀 Features
- JSON Schema Draft 2020-12 Support: Full compliance with the latest JSON Schema specification
- External Reference Resolution: Automatic resolution of external schema references via HTTP/HTTPS, database, or local files
- Dual Server Architecture:
- MCP Server for stdio communication with AI assistants
- SSE Server for web clients with real-time streaming
- Schema Management: Complete CRUD operations for schema collections
- Data Storage Flexibility: PostgreSQL database with local file fallback
- Schema Generation: Automatic JSON Schema generation from sample JSON data
- Docker Support: Containerized deployment ready
🏗️ Architecture
Core Components
- MCP Server (
mcp_server.py
): Primary server for AI assistant integration - SSE Server (
sse_server.py
): HTTP server with Server-Sent Events for web clients - Validation Engine (
tools/JSONSchemaValidator.py
): JSON Schema Draft 2020-12 validator - Data Manager (
utils/DataManager.py
): Multi-source data resolution with fallback strategy - Schema Generator (
utils/SchemaGenerator.py
): Automatic schema generation from JSON data
Data Resolution Strategy
- PostgreSQL Database (schemas/data_storage tables)
- Local Files (final fallback)
📦 Installation
Prerequisites
- Python 3.8+
- PostgreSQL (optional, for database storage)
Quick Start
- Clone the repository
- Install dependencies
- Run the MCP server
- Run the SSE server (optional)
🔧 Configuration
Environment Variables
Create a .env
file:
🛠️ Available MCP Tools
Validation Tools
validate_json_schema
: Direct validation with provided schemavalidate_json_from_collections
: Validation using stored schemasget_validation_info
: Validator capabilities and information
Schema Management Tools
add_update_schema
: Add or update schemas in collectionsdelete_schema
: Delete schemas from collectionsget_schema
: Retrieve schema contentlist_schemas
: List all available schemasgenerate_schema
: Generate schema from JSON data
🐳 Docker Deployment
Build and Run
Docker Features
- Multi-stage build optimization
- Non-root user security
- Health check monitoring
- Volume support for data persistence
- Automatic dependency management
🤖 MCP Server Configuration
Claude Desktop Integration
Method 1: Direct Python Execution
Add to your Claude Desktop configuration file:
Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
Linux/macOS Example:
Method 2: Docker Container
GitHub Copilot Integration
Method 1: Direct Python Execution
Create or update your MCP configuration file:
File: ~/.mcp/config.json
(Linux/macOS) or %USERPROFILE%\.mcp\config.json
(Windows)
Linux/macOS Example:
Method 2: Docker Container
Configuration Notes
- Database Configuration:
- Environment variables are optional
- Server automatically falls back to local file storage if database is unavailable
- For file-only mode, omit all
POSTGRES_*
environment variables
- Path Requirements:
- Use absolute paths for
mcp_server.py
- Ensure Python is in your system PATH
- For Docker, ensure the image is built:
docker build -t jsonschema-mcp-server:1.0.0 .
- Use absolute paths for
- Permissions:
- Ensure the server has write permissions to the schemas directory
- For Docker on Windows, use WSL2 backend for better volume mounting
- Testing Configuration:
- File-Only Configuration (No Database):
🌐 Web Client
The repository includes a complete web client (client_example.html
) demonstrating:
- Real-time validation with Server-Sent Events
- Schema management interface
- Interactive testing environment
- Progress tracking and error reporting
🔒 Security Features
- Input Validation: Schema ID format validation with Linux path requirements
- Path Security: Prevention of directory traversal attacks
- Confirmation Requirements: Explicit confirmation for destructive operations
- Error Handling: Detailed error messages without sensitive information exposure
- Non-root Execution: Docker containers run as non-privileged user
📋 Requirements
jsonschema>=4.25.0
- JSON Schema validationmcp>=1.0.0
- Model Context Protocolpsycopg2-binary>=2.9.0
- PostgreSQL adapterfastapi>=0.104.0
- SSE server frameworkuvicorn>=0.24.0
- ASGI serverpydantic>=2.5.0
- Data validationruff>=0.8.0
- Code linting and formatting
🆘 Troubleshooting
Common Issues
- Database Connection Failed
- Check PostgreSQL is running
- Verify credentials in
.env
- Server falls back to file storage automatically
- Permission Denied
- Ensure write permissions for
.schemas
directory - Check Docker volume mounting
- Ensure write permissions for
- Schema Not Found
- Verify schema ID format (must end with
.json
) - Check schema exists with
list_schemas
tool
- Verify schema ID format (must end with
🗺️ Roadmap
See our ROADMAP.md for planned features and future development directions, including DXT package integration, enhanced schema generation, and AI-powered capabilities.
📄 License
This project is licensed under a Custom Non-Commercial License. See the LICENSE file for details.
🙏 Acknowledgments
- Built on the Model Context Protocol (MCP) specification
- Uses the
jsonschema
library for validation - Inspired by modern API design patterns
- Designed for integration with AI assistants
📞 Support
For issues, questions, or contributions:
- Check the troubleshooting section above
- Review existing issues and documentation
- Create a detailed issue report with:
- Error messages
- Steps to reproduce
- Environment details
- Expected vs actual behavior
Made with ❤️ for the AI and developer community
This server cannot be installed
A comprehensive server that enables validation of JSON data against JSON Schema Draft 2020-12, with support for external references, schema management, and real-time streaming validation.
Related MCP Servers
- AsecurityAlicenseAqualityA server that enhances AI assistants with the ability to update your JSON Resume by analyzing your coding projects, automatically extracting skills and generating professional descriptions.Last updated -357755TypeScriptThe Unlicense
- -securityFlicense-qualityA server that enables executing and validating SQL queries against Google BigQuery with safety features that prevent data modifications and excessive processing.Last updated -1TypeScript
- JavaScriptMIT License
- -securityAlicense-qualityJSON MCP Server by CDataLast updated -MIT License