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.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Delphi Build MCP Servercompile the Delphi project at C:\Projects\InvoiceApp\InvoiceApp.dproj"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Delphi Build MCP Server
A Model Context Protocol (MCP) server that enables AI coding agents like Claude Code to compile Delphi projects programmatically.
Features
Automatic Configuration: Generate config from IDE build logs with multi-line parsing
Multi-Config Support: Generate unified config from multiple build logs (Debug/Release × Win32/Win64/Win64x/Linux64)
Extend Configuration: Add new platforms or libraries to existing config without regenerating
Smart Compilation: Reads .dproj files for build settings and compiler flags
Package Support: Compiles both application (.dpr) and package (.dpk) projects with correct output (.exe/.bpl)
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
Cross-Platform: Supports Win32, Win64, Win64x (LLVM), and Linux64 cross-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
Network Transport: Streamable HTTP support for remote access (e.g., WSL-Ubuntu to Windows host)
WSL Interop: Use from WSL-Ubuntu via stdio through Windows Python or via Streamable HTTP
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:
Single Build Log (simple projects):
Multiple Build Logs (multi-platform projects):
For projects targeting multiple platforms (Win32/Win64/Linux64), create build logs for each configuration:
Build in IDE with each Platform/Config combination
Save each build log separately (e.g.,
build_debug_win32.log,build_release_linux64.log)Generate config from all logs:
Platform-Specific Config Files:
The server supports platform-specific configuration files with automatic fallback:
Platform | Config File |
Win32 |
|
Win64 |
|
Win64x |
|
Linux64 |
|
Search order:
DELPHI_CONFIGenvironment variable (explicit override)delphi_config_{platform}.toml(platform-specific)delphi_config.toml(generic fallback)
Or use the Python API:
3. Configure Claude Code
Edit %APPDATA%\Claude\claude_desktop_config.json:
Server Options
The server supports two transport modes:
Flag | Default | Description |
|
| Transport type: |
|
| Bind address (streamable-http only) |
|
| Listen port (streamable-http only) |
Local (stdio, default):
Network (Streamable HTTP):
Configure Claude Code in WSL-Ubuntu
Two options for using the Delphi MCP server from WSL-Ubuntu:
Option 1: stdio via WSL Interop (Simplest)
WSL can execute Windows binaries directly. This uses stdio transport through the Windows Python -- no HTTP server needed, no manual start. Claude Code manages the server lifecycle automatically.
Edit ~/.claude.json (or project-level .mcp.json) in WSL:
Note: The
DELPHI_CONFIGpath must use Windows-style paths since the server runs as a Windows process.
Option 2: Streamable HTTP (Network Transport)
Run the MCP server as a persistent HTTP service on Windows and connect from WSL over the network.
1. Start the MCP server on Windows:
To start the server automatically at logon, place start_mcp_server.bat (included in this repository) in your Windows Startup folder (Win+R → shell:startup).
2. Find your Windows host IP from WSL:
3. Configure Claude Code in WSL:
Edit ~/.claude.json (or project-level .mcp.json):
Note: If the connection is refused, you may need to allow port 8080 through Windows Firewall:
netsh advfirewall firewall add rule name="Delphi MCP Server" dir=in action=allow protocol=TCP localport=8080
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/Win64x/Linux64)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 a single IDE build log.
Parameters:
build_log_path(required): Path to build log fileoutput_config_path: Output file path (overrides default platform-specific naming)use_platform_specific_name: Generate platform-specific filename (e.g., delphi_config_win64.toml) based on detected platform (default: true)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
generate_config_from_multiple_build_logs
Generate configuration from multiple IDE build logs for different configurations and platforms. By default, creates separate platform-specific files (e.g., delphi_config_win32.toml, delphi_config_win64.toml).
Parameters:
build_log_paths(required): Array of paths to IDE build log files (e.g., Debug-Win32, Release-Win64, Debug-Linux64)output_config_path: Output file path for unified config (only used when generate_separate_files=false)generate_separate_files: Generate separate platform-specific config files (default: true). Set to false for a single unified config.output_dir: Output directory for generated files (default: current directory)use_env_vars: Replace paths with ${USERNAME} (default: true)
Returns:
success: Whether generation succeededconfig_file_path: Path to generated config(s)build_logs_processed: Details of each processed log (path, config, platform, auto_detected)statistics: Configs found, platforms found, total library paths, files generated
extend_config_from_build_log
Extend an existing delphi_config.toml with settings from a new IDE build log. Useful for adding support for new platforms (e.g., Win64x) or libraries without regenerating the entire configuration.
Parameters:
existing_config_path(required): Path to existing delphi_config.tomlbuild_log_path(required): Path to IDE build log fileoutput_config_path: Output path (default: overwrites existing)use_env_vars: Replace paths with ${USERNAME} (default: true)
Returns:
success: Whether extension succeededconfig_file_path: Path to extended configpaths_added: Number of new paths addedpaths_skipped: Number of duplicates skippedplatforms_added: List of new platforms (e.g., ["Win64x"])settings_updated: Count of settings updated per section
Documentation
QUICKSTART.md - 5-minute setup guide
DOCUMENTATION.md - Complete reference
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
Generate Multi-Platform Config from Multiple Build Logs
Extend Existing Config with New Platform
Or via CLI:
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
MIT 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