Enables programmatic compilation of Delphi projects, parsing .dproj files for build settings, executing the Delphi compiler with automatic configuration, and returning structured compilation results with filtered error output.
Delphi Build MCP Server
A Model Context Protocol (MCP) server that enables AI coding agents like Claude Code to compile Delphi projects programmatically.
Why Use This Server?
Calling the Delphi compiler directly from Claude Code works, but this MCP server provides significant advantages:
Advantage | Direct Compiler Call | This MCP Server |
Library Paths | Manually specify 80+ paths every time | Loaded automatically from config |
Command Line Limits | Fails silently at ~8000 chars | Auto-uses response files |
Build Settings | Must read .dproj manually | Parsed automatically |
Compiler Output | Raw text with warnings/hints | Filtered to errors only |
Error Format | Parse text yourself | Structured (file, line, column) |
Token Usage | Full verbose output | Minimal, focused response |
Localization | English output only | English + German support |
Path Portability | Hardcoded paths |
|
Platform Selection | Manual dcc32/dcc64 choice | Automatic based on target |
Consistency | Varies by invocation | Matches IDE settings exactly |
Key Benefits:
Reduced Token Usage - Filters out warnings, hints, and verbose output, keeping Claude's context focused and reducing API costs
No Command Line Limits - Automatically handles projects with 80+ library paths using response files
Zero Configuration Per-Call - All paths and settings loaded from a one-time generated config file
Precise Error Locations - Structured results enable Claude to navigate directly to the error location
Features
Automatic Configuration: Generate config from IDE build logs with multi-line parsing
Smart Compilation: Reads .dproj files for build settings and compiler flags
Filtered Output: Returns only errors, filters out warnings and hints
Multi-Language Support: Parses both English and German compiler output
Response File Support: Handles command lines >8000 characters automatically
Multi-Platform: Supports Win32 and Win64 compilation
80+ Library Paths: Successfully handles projects with extensive dependencies
Environment Variables: Auto-expands
${USERNAME}in pathsMCP Compatible: Works with Claude Code, Cline, and other MCP clients
Quick Start
1. Install
2. Generate Configuration
In Delphi IDE:
Tools -> Options -> Building -> Show compiler progress -> "Verbose"
Build your project
View -> Messages -> Right-click -> Copy All
Save to
build.log
Then generate config:
Or use the Python API:
3. Configure Claude Code
Edit %APPDATA%\Claude\claude_desktop_config.json:
Using UV (Recommended):
Or use direct Python path:
4. Use in Claude Code
Tools
compile_delphi_project
Compile a Delphi project and return parsed results.
Parameters:
project_path(required): Path to .dpr or .dproj fileforce_build_all: Force rebuild all unitsoverride_config: Override build config (Debug/Release)override_platform: Override platform (Win32/Win64)additional_search_paths: Extra search pathsadditional_flags: Additional compiler flags
Returns:
success: Whether compilation succeedederrors: List of compilation errors (warnings/hints filtered)compilation_time_seconds: Time takenoutput_executable: Path to compiled EXEstatistics: Compilation statistics
generate_config_from_build_log
Generate delphi_config.toml from an IDE build log.
Parameters:
build_log_path(required): Path to build log fileoutput_config_path: Output file path (default: delphi_config.toml)use_env_vars: Replace paths with ${USERNAME} (default: true)
Returns:
success: Whether generation succeededconfig_file_path: Path to generated configstatistics: Paths found and processeddetected_info: Delphi version, platform, build config
Documentation
QUICKSTART.md - 5-minute setup guide
DOCUMENTATION.md - Complete reference
PRD.md - Product requirements and specifications
Project Structure
Requirements
Python 3.10+
Delphi 11, 12, or 13
MCP-compatible client (Claude Code, Cline, etc.)
How It Works
Note: The server automatically handles response files for projects with 80+ library paths (command lines >8000 chars) and parses both English and German compiler output.
Example Usage
Compile a Project
Generate Config from Build Log
Troubleshooting
"Configuration file not found"
Generate it from a build log:
"Unit not found"
Regenerate config from a fresh IDE build log that includes all dependencies.
"Compiler not found"
Verify delphi.root_path in delphi_config.toml points to your Delphi installation.
Development
Install Development Dependencies
Run Tests
Test Sample Projects
Two sample projects are included for testing:
sample/working/Working.dproj - Compiles successfully
sample/broken/Broken.dproj - Intentionally has errors for testing error parsing
Code Formatting
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
License
Apache-2.0 License - see LICENSE file for details.
Support
Documentation: DOCUMENTATION.md
Quick Start: QUICKSTART.md
Issues: https://github.com/Basti-Fantasti/delphi-build-mcp-server/issues
Acknowledgments
Built with Model Context Protocol
Designed for Claude Code
Supports Embarcadero Delphi