About Quicktype Mcp
Quicktype Mcp is an MCP server for turning JSON into type-safe models for developers. It supports several target languages, validates or fixes JSON, and generates null-safe code with serialization methods.
Key features
- 01Generate models for multiple languages
- 02Validate and fix JSON
- 03Generate null-safe models
- 04Handle nested JSON structures
- 05Include serialization methods
Use cases
- 01Create Dart models from JSON
- 02Generate Kotlin models with serialization
- 03Repair malformed JSON before model generation
MCP support
The MCP server exposes `generate_model` for producing models from JSON, along with `list_languages` and `fix_json` tools.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEQuicktype MCP Server
An MCP (Model Context Protocol) server specifically designed for generating models from JSON. This tool simplifies the process of creating type-safe models for various programming languages including Dart, Kotlin.
Features
- Generate models for multiple programming languages
- Automatic JSON validation and fixing
- Generates null-safe models
- Handles complex nested JSON structures
- Includes serialization/deserialization methods
Prerequisites
- Python 3.10 or higher
- Internet connection (to access the quicktype.io API)
Usage as MCP Server
This tool is designed to be used as an MCP server that other applications can connect to. The server exposes a simple API for generating models from JSON input.
API
The server exposes the following endpoint:
generate_model: Generates a model from JSON input
Parameters:
json_input: The JSON string to generate a model fromclass_name: The name of the generated class (default: Model)language: The programming language to generate code for (dart, kotlin, typescript, swift, python, java, go)
{
"quicktype-mcp": {
"command": "uv",
"args": [
"--directory",
"/path/to/quicktype-mcp",
"run",
"main.py",
]
}
}
Available MCP Tools
-
generate_model: Generate models from JSON
- Parameters:
json_input: The JSON string to generate a model fromclass_name: The name of the generated class (default: "Model")language: The programming language to generate code for (dart, kotlin)
- Parameters:
-
list_languages: List all supported languages
-
fix_json: Fix and format invalid JSON input
Supported Languages
The server currently supports generating models for the following languages:
Dart (with built-in serialization)
For Dart, the generated models include built-in serialization methods (fromJson and toJson):
// To parse this JSON data, do
//
// final model = modelFromJson(jsonString);
import 'dart:convert';
class Model {
int? id;
String? name;
Model({
this.id,
this.name,
});
factory Model.fromJson(Map<String, dynamic> json) => Model(
id: json["id"],
name: json["name"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
};
}
Kotlin (with kotlinx.serialization)
For Kotlin, the generated models use kotlinx.serialization annotations:
// To parse the JSON, install kotlin's serialization plugin and do:
//
// val json = Json { allowStructuredMapKeys = true }
// val model = json.decodeFromString(Model.serializer(), jsonString)
import kotlinx.serialization.*
import kotlinx.serialization.json.*
import kotlinx.serialization.descriptors.*
import kotlinx.serialization.encoding.*
@Serializable
data class Model(
val id: Int? = null,
val name: String? = null
)
The Kotlin generator produces code that:
- Uses
kotlinx.serializationannotations for automatic serialization/deserialization - Handles nullable types properly with Kotlin's null safety features
- Converts snake_case JSON keys to camelCase Kotlin properties
- Uses
@SerialNameannotations when the property name differs from the JSON key - Supports nested objects, lists, and complex data structures
Troubleshooting
If you encounter issues with the server not running, make sure:
- You have an active internet connection
- All dependencies are installed
- The correct Python version is being used (3.10+)
For issues with the generated models:
- Ensure your JSON is valid
- Try simplifying complex JSON structures if you encounter errors
- Check that the class name follows the naming conventions for the target language
Features of Generated Models
- Null Safety: All fields are properly marked as nullable when appropriate
- JSON Serialization: Includes serialization/deserialization methods
- Nested Objects: Properly handles nested objects with their own classes
- Lists and Maps: Correctly handles collections and their generic types
- Type Safety: Uses appropriate types for JSON values
License
This project is licensed under the MIT License - see the LICENSE file for details.
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.