Get the FREE Ultimate OpenClaw Setup Guide →

Delphi-LSP

Allows AI agents to talk to Delphi 11, 12, 13 LSP Server (DelphiLSP.exe <- Requires a valid Delphi/Embarcadero license !)

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio skybuckflying-delphi-lsp-mcp-server DelphiLSPMCPServer.exe \
  --env LSP_PATH="Path to DelphiLSP.exe (e.g., C:\Tools\RAD Studio\37.0\bin64\DelphiLSP.exe)" \
  --env WORKSPACE="Path to Delphi project workspace (e.g., C:\MyDelphiProject)"

How to use

This MCP server acts as a bridge between MCP clients (such as AI assistants) and Delphi's Language Server Protocol (LSP) implementation provided by DelphiLSP.exe. It communicates via JSON-RPC 2.0 over standard input and output, enabling AI assistants to perform code intelligence operations on Delphi source code. Available tools mirror common LSP capabilities exposed through the Delphi LSP server, including navigation, references, hover information, completions, and workspace-wide symbol search. The server starts DelphiLSP.exe as a child process and forwards MCP requests to the LSP, returning results back to the MCP client.

To use the tools, connect your MCP client to this server and issue the standard MCP requests corresponding to the Delphi tools listed in the configuration. The primary tools provided are: delphi_goto_definition to locate symbol definitions, delphi_find_references to locate all symbol references, delphi_hover to retrieve documentation and type information at a position, delphi_completion to obtain code completion suggestions at a given cursor position, and delphi_workspace_symbols to search for symbols across the workspace. Each tool requires parameters such as file URI, zero-based line and character positions, and optional flags where applicable.

Configuration through the MCP client (as shown in the example integration) specifies the executable that runs the Delphi LSP bridge and any necessary arguments. Once running, MCP clients can issue requests to these tools and receive LSP-backed responses suitable for AI-assisted code understanding and editing tasks.

How to install

Prerequisites:

  • Windows operating system with Delphi RAD Studio installed (Delphi 13 or later).
  • DelphiLSP.exe (comes with RAD Studio).
  • Access to the DelphiLSPMCPServer.exe build artifact (the MCP server executable).

Installation steps:

  1. Obtain the Delphi LSP MCP Server executable (DelphiLSPMCPServer.exe). This is the MCP server component that interfaces with DelphiLSP.exe.
  2. Ensure DelphiLSP.exe is installed and accessible on your system.
    • Note the path to DelphiLSP.exe, which can be configured via CLI arguments or environment variables as shown in the example configuration.
  3. Place DelphiLSPMCPServer.exe in a suitable directory (e.g., C:\Tools\DelphiLSPMCPServer).
  4. Create a configuration file or environment setup for your MCP client to point to DelphiLSPMCPServer.exe with appropriate arguments (see example below).
  5. Start the MCP server instance and verify that DelphiLSP.exe launches as a child process and the MCP protocol messages flow over stdio.

Example run (manual):

  • Ensure DELPHI_LSP_PATH is set to the DelphiLSP.exe location and, if needed, set WORKSPACE to your Delphi project folder.

If you are packaging for distribution, include the DelphiLSPMCPServer.exe alongside a wrapper script that ensures the LSP path is provided and valid.

Additional notes

Tips and common issues:

  • Ensure the path to DelphiLSP.exe is correct via the LSP_PATH setting; incorrect paths will cause the LSP initialization to fail.
  • Logs are written to stderr; check for initialization or runtime errors if MCP requests do not return results.
  • The MCP server uses JSON-RPC over stdio. Ensure your MCP client correctly formats requests and handles Content-Length framing.
  • Line and position indices exposed by the tools are zero-based for MCP requests (Delphi IDE shows lines as 1-based; convert accordingly).
  • If you encounter issues, verify that DelphiLSP.exe can start independently outside the MCP server to isolate problems with the LSP component.
  • For production usage, consider adding error-handling and automatic restart logic if the LSP process crashes or becomes unresponsive.
  • This MCP server is Windows-only due to DelphiLSP.exe; cross-platform usage requires appropriate Delphi LSP support on the target platform.

Related MCP Servers

Sponsor this space

Reach thousands of developers