Claude Pascal MCP Server
Allows interaction with Android devices via ADB, enabling screenshots, touch input (tap, swipe), text typing, key events, app management (install, launch, stop, list packages), and file transfer (push/pull).
Supports compiling Delphi projects using dcc32 or dcc64, generates proper Delphi project structure (DPR, PAS, DFM) with automatic component and event handler wiring, and provides form parsing for DFM/FMX files.
Integrates with Lazarus IDE via the IDE Observer, enabling screenshot capture, reading compiler errors, and listing project files for better code assistance.
Integrates with Embarcadero RAD Studio IDE via the IDE Observer, enabling screenshot capture, reading compiler errors, and managing project files; also supports modern namespaced units in generated templates.
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., "@Claude Pascal MCP Servercompile and run hello world in Pascal"
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.
Claude Pascal MCP Server
An MCP (Model Context Protocol) server that lets Claude compile, run, and interact with Pascal/Delphi desktop applications. Supports Free Pascal (fpc), Delphi 32-bit (dcc32), and Delphi 64-bit (dcc64) compilers.
Features
Compiler Detection — automatically finds Pascal compilers on your system (PATH + known install locations)
Compile — compile single-file Pascal source or multi-file Delphi projects
Run — compile and execute console programs, capturing output
Launch GUI Apps — compile and launch VCL/FMX applications in background (without stealing focus)
Project Templates — generate proper Delphi project structure (DPR + PAS + DFM) automatically
Form Parser — read and understand DFM/FMX/LFM form files
Window Screenshots — capture running desktop app windows (non-intrusive, no focus stealing)
Windows App Interaction — click, type text, and send keyboard shortcuts to desktop app windows
Android Device Interaction — full ADB support: screenshots, tap, swipe, type, key events, app management, file transfer
IDE Observer — capture RAD Studio/Delphi/Lazarus IDE screenshots and read compiler errors
Preview Bridge — live preview of running Pascal apps through Claude's preview system
FPC Installer — download and install Free Pascal if no compiler is available
Tools
Tool | Description |
| Detect available compilers and show versions |
| Compile single-file source code |
| Compile proper Delphi project from templates (DPR + PAS + DFM) |
| Compile and execute console programs |
| Compile and launch GUI app in background |
| Syntax check only (no linking) |
| Parse DFM/FMX/LFM form files |
| Capture screenshot of a running app window |
| List visible windows on the desktop |
| Click on a Windows app window at screenshot pixel coordinates |
| Type text into a Windows app window |
| Send key or shortcut (e.g., |
| Capture IDE screenshot and scan project files |
| Read source code around compiler error locations |
| List source files in a Delphi/Lazarus project |
| List connected Android devices with model and version |
| Get detailed info for a specific Android device |
| Capture Android device screen |
| Tap a point on the Android device screen |
| Swipe on the Android device screen |
| Type text on the Android device |
| Send a key event (home, back, enter, etc.) to Android device |
| Install an APK on the Android device |
| List installed packages on the Android device |
| Launch an app on the Android device |
| Force-stop an app on the Android device |
| Push a file to the Android device |
| Pull a file from the Android device |
| Download and install Free Pascal (fallback) |
Preview Bridge
The preview bridge lets Claude see and interact with running Pascal desktop applications through its web-based preview system. It serves live screenshots of desktop app windows as a web page.
How it works
Claude Preview Tools (preview_start, preview_screenshot, preview_click)
| HTTP
v
Preview Bridge Server (Python/Starlette)
/ -> HTML page with live screenshot viewer
/api/screenshot -> PNG of target window
/api/controls -> enumerate child controls with positions
/api/click -> click at coordinates or by control hwnd
/api/type -> send keystrokes to target window
/api/move -> move window to screen position
/api/resize -> resize window
| Win32 PrintWindow API
v
Running Pascal Desktop ApplicationAPI Endpoints
Route | Method | Description |
| GET | HTML page with auto-refreshing screenshot viewer |
| GET | PNG screenshot of target window |
| GET | List visible windows |
| POST | Set target window by title |
| GET | Enumerate child controls (buttons, inputs, etc.) |
| POST | Click by coordinates or direct control hwnd |
| POST | Send text or key combos (e.g., |
| POST | Drag from one point to another |
| POST | Move target window |
| POST | Resize target window |
| GET | Window position, size, and client area offset |
| GET | Console output from launched apps |
| POST | Launch an executable |
Click Methods
The click endpoint supports three modes, from most to least reliable:
Direct control click (
{"hwnd": "12345"}) — sendsBM_CLICKdirectly to a control handle. Works regardless of DPI, monitors, or foreground state. Get hwnds from/api/controls.Client-area coordinates (
{"x": 200, "y": 142, "client": true}) — uses Win32ClientToScreenfor proper DPI handling.Window-relative coordinates (
{"x": 312, "y": 261}) — raw coordinates in the screenshot image space.
Windows App Interaction
The app_click, app_type, and app_key tools let Claude interact with running Windows desktop applications.
Workflow
Take a screenshot with
screenshot_appto see the current UIIdentify pixel coordinates of the target element (button, text field, etc.)
Use
app_clickwith those coordinates to clickUse
app_typeto enter text into a focused fieldUse
app_keyto send keyboard shortcuts (enter,ctrl+a,alt+f4, etc.)
Clicks use PostMessage with automatic child window targeting, so they reach the correct control. Typing and key events use SendInput for full Unicode and modifier support.
Android Device Interaction (ADB)
Full Android device interaction via ADB. All tools accept an optional device serial number — auto-selects when only one device is connected.
Device Management
adb_devices— list connected devices with model, Android version, screen sizeadb_device_info— detailed info for a specific device
Screenshots and UI Automation
adb_screenshot— capture the device screenadb_tap/adb_swipe— touch interaction at pixel coordinatesadb_type_text— type text (auto-escapes for adb shell)adb_key— send key events with aliases:home,back,enter,menu,power,volume_up,volume_down,tab,delete,space,escape,app_switch
App Management
adb_install— install APK filesadb_list_packages— list installed packages (with optional filter)adb_launch_app— launch an app by package nameadb_stop_app— force-stop an app
File Transfer
adb_push— push files from PC to deviceadb_pull— pull files from device to PC
Project Templates
The compile_delphi_project tool generates proper Delphi project structure automatically. You specify components and events, and it creates the correct DPR, PAS, and DFM files.
Templates automatically handle:
Modern Delphi (RAD Studio): namespaced units (
Vcl.Forms,System.SysUtils)Legacy Delphi (Delphi 7): non-namespaced units (
Forms,SysUtils)Form definitions (DFM) with proper component declarations
Event handler wiring between DFM and PAS files
Example
compile_delphi_project(
project_name="HelloWorld",
form_caption="My App",
components='[{"type": "TButton", "name": "btnHello", "caption": "Click Me",
"left": 100, "top": 100, "width": 120, "height": 35,
"event": "btnHelloClick"}]',
events='[{"name": "btnHelloClick", "body": "ShowMessage(\'Hello!\');"}]',
compiler="C:\\Path\\To\\dcc64.exe"
)This generates:
HelloWorld.dpr— project file with proper uses clauseuMain.pas— unit with form class, component declarations, event handlersuMain.dfm— form definition with component properties
Installation
Prerequisites
Python 3.11+
uv package manager
A Pascal compiler (Free Pascal, Delphi, or RAD Studio)
Option 1 — Run from PyPI (recommended)
Once a release is published to PyPI, no clone is needed:
uvx --from claude-pascal-mcp pascal-mcpOption 2 — Run straight from GitHub (no PyPI required)
uvx --from git+https://github.com/tina4stack/claude-pascal-mcp pascal-mcpPin to a tag for reproducibility: git+https://github.com/tina4stack/claude-pascal-mcp@v0.1.0.
Option 3 — Local development clone
git clone https://github.com/tina4stack/claude-pascal-mcp.git
cd claude-pascal-mcp
# Install dependencies
uv sync
# Run the MCP server (stdio mode)
uv run pascal-mcp
# Run the preview bridge (HTTP mode)
uv run pascal-previewRegister with Claude Code
PyPI install:
claude mcp add --transport stdio pascal-dev -- uvx --from claude-pascal-mcp pascal-mcpGit install:
claude mcp add --transport stdio pascal-dev -- uvx --from git+https://github.com/tina4stack/claude-pascal-mcp pascal-mcpLocal clone:
claude mcp add --transport stdio pascal-dev -- uv run --directory /path/to/claude-pascal-mcp pascal-mcpOr add to your project's .mcp.json — pick the form that matches how you installed:
{
"mcpServers": {
"pascal-dev": {
"command": "uvx",
"args": ["--from", "claude-pascal-mcp", "pascal-mcp"]
}
}
}{
"mcpServers": {
"pascal-dev": {
"command": "uvx",
"args": ["--from", "git+https://github.com/tina4stack/claude-pascal-mcp", "pascal-mcp"]
}
}
}{
"mcpServers": {
"pascal-dev": {
"command": "uv",
"args": ["run", "--directory", "/path/to/claude-pascal-mcp", "pascal-mcp"]
}
}
}Register with Claude Desktop
Add to your claude_desktop_config.json (pick the form matching your install):
{
"mcpServers": {
"pascal-dev": {
"command": "uvx",
"args": ["--from", "claude-pascal-mcp", "pascal-mcp"]
}
}
}{
"mcpServers": {
"pascal-dev": {
"command": "uv",
"args": ["run", "--directory", "C:/path/to/claude-pascal-mcp", "pascal-mcp"]
}
}
}Releasing
Maintainer notes — cutting a new release publishes to PyPI automatically.
Bump
versioninpyproject.toml.Commit and tag:
git tag v0.1.0 && git push origin v0.1.0.GitHub Actions (
.github/workflows/publish.yml) builds the sdist + wheel, publishes to PyPI via Trusted Publishing, and attaches the artifacts to a GitHub Release.
One-time PyPI Trusted Publisher setup (required before the first release):
Create the project on pypi.org (or reserve it via a first manual
uv publish).Under Project → Publishing → Add a new publisher, configure GitHub Actions:
Owner:
tina4stackRepository:
claude-pascal-mcpWorkflow:
publish.ymlEnvironment:
pypi
In the GitHub repo, create an environment named
pypi(Settings → Environments).
No API tokens needed — OIDC handles auth.
Preview Bridge Setup
Add to .claude/launch.json in your project root:
{
"version": "0.0.1",
"configurations": [
{
"name": "pascal-preview",
"runtimeExecutable": "/path/to/claude-pascal-mcp/.venv/Scripts/pythonw.exe",
"runtimeArgs": ["-m", "pascal_mcp.preview_bridge"],
"port": 18080,
"autoPort": true
}
]
}Then in Claude Code, use preview_start("pascal-preview") to open the preview panel.
Supported Compilers
The server automatically detects compilers in this priority order:
Free Pascal (fpc) — open source, cross-platform
Delphi 64-bit (dcc64) — RAD Studio command-line compiler
Delphi 32-bit (dcc32) — RAD Studio / Delphi 7 command-line compiler
You can also specify a full path to any compiler executable:
compile_pascal(source, compiler="C:\\Program Files (x86)\\Embarcadero\\Studio\\37.0\\bin\\dcc64.exe")Detection checks the system PATH first, then known installation directories:
C:\FPC\*\bin\*\fpc.exeC:\Lazarus\fpc\*\bin\*\fpc.exeC:\Program Files (x86)\Embarcadero\Studio\*\bin\dcc*.exe
License
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/tina4stack/claude-pascal-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server