Model Integration Protocol (MIP)
The Model Integration Protocol (MIP) is a framework I’ve developed that enables seamless integration between Java services and AI systems by converting Java methods, classes, and services into AI-consumable tools using modified JSON-RPC format. MIP automatically handles the conversion of existing Java objects, including their fields, arrays, maps, and nested objects, into a standardized format that AI systems can understand and use.
👉Source code of the reference project is here
Features of MIP:
Automatic Conversion of Java Services to JSON-RPC Tools:
- MIP leverages reflection and annotations to automatically expose Java methods and classes as tools for AI.
- It transforms Java classes, methods, and objects into JSON-RPC compliant tools, making them compatible with AI and LLMs (Large Language Models).
Annotation-Based Mapping:
- Java classes and methods are annotated with specific annotations like
@Action
,@Prompt
,@ListType
, and@MapKeyType
to define how they should be treated in the JSON-RPC conversion process. - These annotations help define field types, array handling, and date formatting, among other behaviors.
AI Integration:
- The converted JSON-RPC format can be easily consumed by AI systems, making it possible for AI models to interact with and control real-world Java applications.
- This allows AI to access and call Java-based functionality directly via simple JSON-RPC requests.
Supports Complex Structures:
- MIP can handle complex data types, including nested objects, arrays, maps, and custom date formats, ensuring full compatibility with AI systems.
No Need for Manual Serialization/Deserialization:
- Instead of manually converting Java objects to a format AI systems can understand (e.g., writing custom serializers), MIP automates the process by using its own internal reflection mechanism and annotations.
Cross-Platform Compatibility:
- The (modified) JSON-RPC format is widely understood and can be used across multiple platforms, making it easy to integrate AI with a variety of Java-based backends.
How Does MIP Work?
Input Annotations:
- Java classes and methods are annotated with MIP-specific annotations (such as
@Action
,@ListType
,@MapKeyType
, etc.) to define their behavior when integrated into AI systems.
Reflection:
- MIP uses reflection to inspect the Java class and its annotations to automatically extract the necessary details about the class, including its fields, types, and methods.
JSON-RPC Conversion:
- The class or method is then converted into a Modified JSON-RPC format that defines its fields, types, and expected input/output.
- This enables AI systems to call these methods directly using JSON-RPC requests, without having to write any custom API handling code.
AI Consumption:
- The JSON-RPC format is then consumed by AI systems or Large Language Models (LLMs), allowing them to access the Java functionality and execute the required operations.
For example this java class:
@Service
@Log
@Agent
public class CompareMiniVanService {
public CompareMiniVanService() {
log.info("created compare car service");
}
@Action( description = "compare two minivan")
public String compareMiniVan(String car1 , String car2) {
log.info(car2);
log.info(car1);
// implement the comparison logic here
return " this is better - "+car2;
}
}
Will Automatically get converted to this:
{
"actionType": "JAVAMETHOD",
"actionParameters": {
"methodName": "compareMiniVan",
"parameters": [
{
"name": "car1",
"type": "String",
"fieldValue": ""
},
{
"name": "car2",
"type": "String",
"fieldValue": ""
}
],
"returnType": "String"
},
"actionClass": "io.github.vishalmysore.service.CompareMiniVanService",
"description": "compare two minivan",
"actionGroup": "No Group",
"actionName": "compareMiniVan",
"expanded": true
}
🛠️ Key Highlights:
Annotation-based Tooling:
By simply annotating my Java classes with @agent, @Action, and @Prompt, I automatically expose them as AI-consumable tools.
MIP inspects the Java classes and converts their methods and parameters into JSON-RPC schemas — no need for custom serialization logic or creating new APIs.
Effortless Integration:
I have eliminated the need to build separate API layers or new REST servers.
Instead, I directly expose existing Spring services, HTTP calls, and shell scripts as tools for AI interaction.
Cross-LLM Compatibility:
MIP is platform-agnostic and works with any LLM that supports JSON-RPC (e.g., OpenAI, Claude, Gemini, etc.).
Simplified Parameter Handling:
MIP automatically handles complex and nested parameters (e.g., lists, maps, date formats, arrays) through annotations like:
@ListType → for Lists
@MapValueType and @MapKeyType → for Maps
@Prompt → for contextual hints and formatting
Reduced Boilerplate:
Unlike MCP (Model Context Protocol), which requires creating separate servers and extensive coding, MIP uses reflection and annotations to auto-generate the schema.
This makes maintenance, expansion, and scaling significantly easier.
🔥 What I’ve Achieved So Far:
Server:
I’ve built Neurocaster-Server — the reference implementation of MIP.
This server exposes existing Java classes as JSON-RPC tools with minimal configuration.
As soon as the library is included in any spring boot project it exposes the tools on this url http://localhost:8081/actuator/tools4ai-tools
Al you have to do in your spring boot project for toosl invocation is enable websocket
@Configuration
@EnableWebSocket
public class NeuroCasterWebSocketConfig implements WebSocketConfigurer {
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
registry.addHandler(webSocketHandler(), "/chat")
.addInterceptors(new HttpSessionHandshakeInterceptor())
.setAllowedOrigins("*"); // Allow all origins or specific ones
}
@Bean
public WebSocketHandler webSocketHandler() {
return new NeuroCasterChatEndpoint(); // Use the ChatEndpoint class as WebSocketHandler
}
@Bean
public ServerEndpointExporter serverEndpointExporter() {
return new ServerEndpointExporter();
}
}
Markdown
Model Integration Protocol (MIP)
The Model Integration Protocol (MIP) is a framework I’ve developed that enables seamless integration between Java services and AI systems by converting Java methods, classes, and services into AI-consumable tools using modified JSON-RPC format. MIP automatically handles the conversion of existing Java objects, including their fields, arrays, maps, and nested objects, into a standardized format that AI systems can understand and use.
👉Source code of the reference project is here
Features of MIP:
Automatic Conversion of Java Services to JSON-RPC Tools:
- MIP leverages reflection and annotations to automatically expose Java methods and classes as tools for AI.
- It transforms Java classes, methods, and objects into JSON-RPC compliant tools, making them compatible with AI and LLMs (Large Language Models).
Annotation-Based Mapping:
- Java classes and methods are annotated with specific annotations like
@Action
,@Prompt
,@ListType
, and@MapKeyType
to define how they should be treated in the JSON-RPC conversion process. - These annotations help define field types, array handling, and date formatting, among other behaviors.
AI Integration:
- The converted JSON-RPC format can be easily consumed by AI systems, making it possible for AI models to interact with and control real-world Java applications.
- This allows AI to access and call Java-based functionality directly via simple JSON-RPC requests.
Supports Complex Structures:
- MIP can handle complex data types, including nested objects, arrays, maps, and custom date formats, ensuring full compatibility with AI systems.
No Need for Manual Serialization/Deserialization:
- Instead of manually converting Java objects to a format AI systems can understand (e.g., writing custom serializers), MIP automates the process by using its own internal reflection mechanism and annotations.
Cross-Platform Compatibility:
- The (modified) JSON-RPC format is widely understood and can be used across multiple platforms, making it easy to integrate AI with a variety of Java-based backends.
How Does MIP Work?
Input Annotations:
- Java classes and methods are annotated with MIP-specific annotations (such as
@Action
,@ListType
,@MapKeyType
, etc.) to define their behavior when integrated into AI systems.
Reflection:
- MIP uses reflection to inspect the Java class and its annotations to automatically extract the necessary details about the class, including its fields, types, and methods.
JSON-RPC Conversion:
- The class or method is then converted into a Modified JSON-RPC format that defines its fields, types, and expected input/output.
- This enables AI systems to call these methods directly using JSON-RPC requests, without having to write any custom API handling code.
AI Consumption:
- The JSON-RPC format is then consumed by AI systems or Large Language Models (LLMs), allowing them to access the Java functionality and execute the required operations.
For example this java class:
java
@Service
@Log
@Agent
public class CompareMiniVanService {
public CompareMiniVanService() {
log.info("created compare car service");
}
@Action( description = "compare two minivan")
public String compareMiniVan(String car1 , String car2) {
log.info(car2);
log.info(car1);
// implement the comparison logic here
return " this is better - "+car2;
}
}
Will Automatically get converted to this:
JSON
{
"actionType": "JAVAMETHOD",
"actionParameters": {
"methodName": "compareMiniVan",
"parameters": [
{
"name": "car1",
"type": "String",
"fieldValue": ""
},
{
"name": "car2",
"type": "String",
"fieldValue": ""
}
],
"returnType": "String"
},
"actionClass": "io.github.vishalmysore.service.CompareMiniVanService",
"description": "compare two minivan",
"actionGroup": "No Group",
"actionName": "compareMiniVan",
"expanded": true
}
🛠️ Key Highlights:
Annotation-based Tooling:
By simply annotating my Java classes with @Agent, @Action, and @Prompt, I automatically expose them as AI-consumable tools.
MIP inspects the Java classes and converts their methods and parameters into JSON-RPC schemas — no need for custom serialization logic or creating new APIs.
Effortless Integration:
I have eliminated the need to build separate API layers or new REST servers.
Instead, I directly expose existing Spring services, HTTP calls, and shell scripts as tools for AI interaction.
Cross-LLM Compatibility:
MIP is platform-agnostic and works with any LLM that supports JSON-RPC (e.g., OpenAI, Claude, Gemini, etc.).
Simplified Parameter Handling:
MIP automatically handles complex and nested parameters (e.g., lists, maps, date formats, arrays) through annotations like:
@ListType → for Lists
@MapValueType and @MapKeyType → for Maps
@Prompt → for contextual hints and formatting
Reduced Boilerplate:
Unlike MCP (Model Context Protocol), which requires creating separate servers and extensive coding, MIP uses reflection and annotations to auto-generate the schema.
This makes maintenance, expansion, and scaling significantly easier.
🔥 What I’ve Achieved So Far:
Server:
I’ve built Neurocaster-Server — the reference implementation of MIP.
This server exposes existing Java classes as JSON-RPC tools with minimal configuration.
As soon as the library is included in any spring boot project it exposes the tools on this url http://localhost:8081/actuator/tools4ai-tools
Al you have to do in your spring boot project for toosl invocation is enable websocket
Java
@Configuration
@EnableWebSocket
public class NeuroCasterWebSocketConfig implements WebSocketConfigurer {
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
registry.addHandler(webSocketHandler(), "/chat")
.addInterceptors(new HttpSessionHandshakeInterceptor())
.setAllowedOrigins("*"); // Allow all origins or specific ones
}
@Bean
public WebSocketHandler webSocketHandler() {
return new NeuroCasterChatEndpoint(); // Use the ChatEndpoint class as WebSocketHandler
}
@Bean
public ServerEndpointExporter serverEndpointExporter() {
return new ServerEndpointExporter();
}
}
Client:
I’ve built Neurocaster-Client in Angular, allowing chatting and invoking MIP tools via a WebSocket interface.
You can either chat with the server or inoke the tool
Tools4AI:
I’ve developed Tools4AI, which handles the conversion of Java methods and classes into AI-compatible JSON-RPC schemas, invoking tools etc.
Real-World Use Cases:
I’ve demonstrated complex class hierarchies (Organization, Employee), map handling (Dictionary), and diary entries with date formatting—all automatically converted into JSON-RPC schemas.
🚀 Why This is Significant:
Simplifies AI Integration: MIP makes any existing Java service or class AI-compatible without writing separate API layers.
Reduces Development Overhead: No need for additional servers — just annotate and expose!
Future-Proof: Since it uses JSON-RPC, it will work with any AI model, making it future-proof and flexible.
Massive Potential: I am enabling the LLM-driven automation of legacy Java systems with minimal refactoring, which could be groundbreaking for large enterprises.
Top comments (1)
Looking great!