An AI-powered application for rapid development of IDDM data connectors, enhanced with a comprehensive Model Context Protocol (MCP) server for streamlined development workflows.
- MCP Server Integration: Full Model Context Protocol server for seamless IDE integration
- OpenAPI Processing: Automated OpenAPI specification parsing and code generation
- Java Client Generation: Automatic generation of Java client code from OpenAPI specs
- Data Connector Templates: Pre-built templates and examples for common connector patterns
- Few-Shot Learning: AI-powered code generation using example-based learning
- Maven Integration: Complete Maven project structure with automated builds
- FastWorkflow Interface: Natural language interface for generating data connectors from OpenAPI specifications
iddm_dataconnector_codegen/
βββ mcp_server/ # MCP Server implementation
β βββ mcp_server.py # Main MCP server with full tooling
β βββ requirements.txt # Python dependencies for the server
βββ examples/ # Few-shot learning examples
β βββ HarryPotterDataConnector.java # Example Java connector class
β βββ harrypotterbooksconnector.json # Example JSON configuration
β βββ HarryPotterDataConnectorTest.java # Example unit tests
βββ yamlfiles/ # OpenAPI specifications
β βββ harry_potter_openapi.yaml
β βββ idp-minimal.yaml
βββ sdkfiles/ # SDK reference documentation
β βββ radiantlogicinc-iddm-sdk.txt
β βββ minimal-radiantlogic-iddm-sdk.txt
β βββ minimal_user_guide.txt
βββ java_client/ # Generated Java client code
β βββ harrypotterapi/
β βββ myaccountmanagement/
βββ data_connector_fastworkflow/ # FastWorkflow application for data connector generation
β βββ application/ # Application layer with core business logic
β β βββ __init__.py
β β βββ data_connector.py # Main application class using MCP server functions
β β βββ enhanced_mcp_server.py # Enhanced MCP server functionality
β β βββ mcp_server.py # Base MCP server functionality
β βββ _commands/ # Commands layer for natural language interface
β β βββ __init__.py
β β βββ initialize_data_connector.py # Command to initialize with API spec path
β β βββ context_inheritance_model.json # Context hierarchy definition
β β βββ DataConnector/ # DataConnector-specific commands
β β βββ __init__.py
β β βββ _DataConnector.py # Context navigation class
β β βββ list_objects.py # Command to list objects from source JSON
β β βββ select_object.py # Command to select objects for target JSON
β β βββ generate_code.py # Command to generate data connector code
β β βββ zip_code.py # Command to zip the latest generated code
β βββ fastworkflow.env # Environment variables with LLM settings
β βββ fastworkflow.passwords.env # API keys for LLMs
β βββ startup_action.json # Empty startup action (initialization requires parameters)
βββ pom.xml # Maven project configuration
βββ requirements.txt # Project-level extras (optional)
βββ debug_generation.log # Tooling logs (if present)
# Install Python dependencies
cd mcp_server
pip install -r requirements.txt
# Install Java dependencies (if building)
mvn install# From anywhere: point to your local clone
python /absolute/path/to/iddm_dataconnector_codegen/mcp_server/mcp_server.py
# or
python3 /absolute/path/to/iddm_dataconnector_codegen/mcp_server/mcp_server.pyIn the project where you want to use these tools, create or edit .cursor/mcp.json and add an entry:
Option A: call Python directly with an absolute path
{
"mcpServers": {
"iddm-dataconnector": {
"command": "python3",
"args": ["/absolute/path/to/iddm_dataconnector_codegen/mcp_server/mcp_server.py"],
"disabled": false
}
}
}Option B: ensure the server runs with the correct working directory
{
"mcpServers": {
"iddm-dataconnector": {
"command": "bash",
"args": ["-lc", "cd '/absolute/path/to/iddm_dataconnector_codegen/mcp_server' && python3 mcp_server.py"],
"disabled": false
}
}
}Option C: portable configuration (recommended)
{
"mcpServers": {
"iddm-dataconnector": {
"command": "/Library/Frameworks/Python.framework/Versions/3.12/bin/python3",
"args": [
"/absolute/path/to/iddm_dataconnector_codegen/mcp_server/mcp_server.py"
],
"env": {
"PYTHONPATH": "/absolute/path/to/iddm_dataconnector_codegen"
},
"cwd": "/absolute/path/to/iddm_dataconnector_codegen"
}
}
}Tip: If your editor supports ${workspaceFolder}, you can use it in place of absolute paths.
- NEW: Use
get_project_infoto verify the server detected your project root correctly - Initialize or load an OpenAPI spec (use one under
yamlfiles/, e.g.,harry_potter_openapi.yaml) - Explore/list objects and methods
- Select objects and methods to include in the target
- Generate Java client code β output under
java_client/ - Generate Data Connector code β output under
src/main/java/com/radiantlogic/custom/dataconnector/
mvn package -DskipTests- Artifacts are written to
target/
- Project Management:
get_project_info- verify project root detection and configuration - OpenAPI Operations: initialize specs, list objects/methods, select targets
- Data Connector Operations: generate Java client code, generate connector code, compile/test with Maven
The Data Connector FastWorkflow provides a natural language interface for generating data connectors from OpenAPI specifications. It leverages the MCP server functionality for a more user-friendly experience.
The FastWorkflow application follows a layered architecture:
- Application Layer: Contains the core business logic in the
DataConnectorclass - Commands Layer: Provides natural language interfaces to the application functionality
- MCP Integration: Connects to the MCP server to perform operations on OpenAPI specifications
- Initial Setup
First, clone the repository, create a Python virtual environment, and install all dependencies:
git clone https://github.com/your-org/iddm_dataconnector_codegen.git cd iddm_dataconnector_codegen
python3 -m venv venv source venv/bin/activate # On Windows use: venv\Scripts\activate
pip install -r requirements.txt
Next, add your API key values to fastworkflow.passwords.env before using FastWorkflow:
LITELLM_API_KEY_SYNDATA_GEN=your-api-key-here LITELLM_API_KEY_PARAM_EXTRACTION=your-api-key-here LITELLM_API_KEY_RESPONSE_GEN=your-api-key-here LITELLM_API_KEY_AGENT=your-api-key-here
After cloning the repository and installing all dependencies from the requirements.txt, you must first train the FastWorkflow:
# If you're in the project root directory
fastworkflow train ./data_connector_fastworkflow ./data_connector_fastworkflow/fastworkflow.env ./data_connector_fastworkflow/fastworkflow.passwords.env
# If you're in another directory, use the absolute path
fastworkflow train /path/to/iddm_dataconnector_codegen/data_connector_fastworkflow /path/to/iddm_dataconnector_codegen/data_connector_fastworkflow/fastworkflow.env /path/to/iddm_dataconnector_codegen/data_connector_fastworkflow/fastworkflow.passwords.envBefore running the FastWorkflow application, make the convenience script executable:
chmod +x run_data_connector.shNow you can run the FastWorkflow application using the provided convenience script:
./run_data_connector.shThis script runs the FastWorkflow application with the appropriate environment and password files.
Once the FastWorkflow application is running, you can interact with it using natural language commands:
-
Initialize the data connector:
initialize data connector with api spec path /path/to/api-spec.yaml -
List objects from source JSON:
list all objects in source json -
Select objects for target JSON:
select the users, products and orders object for target -
Generate data connector code:
generate data connector code -
Zip the latest code:
zip the latest code
And add your API keys to fastworkflow.passwords.env:
# LLM API Keys
LITELLM_API_KEY_SYNDATA_GEN=your-api-key-here
LITELLM_API_KEY_PARAM_EXTRACTION=your-api-key-here
LITELLM_API_KEY_RESPONSE_GEN=your-api-key-here
LITELLM_API_KEY_AGENT=your-api-key-here
When generating code, the application creates a structured output directory:
Api_code/
βββ {api_name}/
βββ source.json # Parsed OpenAPI spec
βββ target.json # Selected objects
βββ src version {version}/ # Generated code
β βββ main/
β β βββ java/
β β β βββ com/
β β β βββ radiantlogic/
β β β βββ custom/
β β β βββ dataconnector/
β β β βββ {ApiName}DataConnector.java
β β βββ resources/
β β βββ com/
β β βββ radiantlogic/
β β βββ custom/
β β βββ dataconnector/
β β βββ {api_name}Connector.json
β βββ test/
β βββ java/
β βββ com/
β βββ radiantlogic/
β βββ custom/
β βββ dataconnector/
β βββ {ApiName}DataConnectorTest.java
βββ zip/ # Zipped code archives
βββ src_version_{version}.zip
- File Deletion Limitation: if generated files need to be cleared, remove them manually:
rm -rf src/main/java/com/radiantlogic/custom/dataconnector/*.java rm -rf src/test/java/com/radiantlogic/custom/dataconnector/*.java
- The
requirements.txtat the project root is optional; the server usesmcp_server/requirements.txt. - If you work outside the original directory, absolute paths in certain advanced operations (like automatic POM updates) may need adjusting. Core MCP features (OpenAPI, selection, codegen, build) work with the configuration above.
- OpenAPI specs live under
yamlfiles/. Point the MCP tools at these when initializing. - The
src/main/java/com/radiantlogic/custom/dataconnector/directory will be empty until you generate code. - Check
debug_generation.logandselect_object_debug.log(if present) for troubleshooting information. - When using the FastWorkflow interface, you can select multiple objects before generating code.
- The FastWorkflow application maintains state between commands, so you don't need to re-initialize for each operation.
The examples/ folder contains few-shot learning examples used by the MCP server to generate high-quality Data Connector code:
HarryPotterDataConnector.java- Complete working Java connector class showing proper structure, imports, and patternsharrypotterbooksconnector.json- Example JSON configuration file for the connectorHarryPotterDataConnectorTest.java- Example unit tests demonstrating proper testing patterns
These examples are automatically loaded by the server and used as templates when generating new connectors. They ensure consistent code quality and proper adherence to the Data Connector framework requirements.
You can modify these example files to:
- Change import patterns for different frameworks
- Update annotation styles
- Modify testing approaches
- Add new functionality patterns
The server will automatically use your updated examples in future code generation.
This project combines:
- FastMCP: High-performance MCP server framework
- DSPy: AI-powered code generation and optimization
- OpenAPI: Standard API specification processing
- Maven: Java project management and build automation
- FastWorkflow: Natural language interface for data connector generation
This integration brings together the power of MCP servers with IDDM data connector development, providing a streamlined workflow for rapid connector creation and deployment. We welcome:
- Feedback: On usability and feature requests
- Examples: Additional connector patterns and templates
- Testing: Real-world usage scenarios and edge cases
- Documentation: Improvements and additional examples
See LICENSE file for details.