JL

jedt3d/lazfpc-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

7 stars 5 forks 质量 61 趋势 19NOASSERTION

The MCP for Lazarus IDE and Free Pascal Compiler and it wrap an LSP with it too. (Pascal Language Server)

概览

An MCP (Model Context Protocol) server for Lazarus and Free Pascal development. Provides AI coding agents (Claude, Cursor, OpenCode, etc.) with structured access to Lazarus build tools, form analysis, project metadata, and testing workflows. Built with the official FPC MCP framework and written entirely in Free Pascal. AI coding agents are powerful, but they lack native understanding of the Lazarus/Free Pascal ecosystem. This MCP server bridges that gap by exposing Lazarus-specific development workflows as MCP tools that any MCP-compatible client can invoke. The server uses TMCPStdIOApplication from the FPC MCP framework for stdio transport, making it compatible with all major MCP clients. - Free Pascal Compiler 3.2.2+ - Lazarus IDE with mcpbase.lpk package installed - FPC MCP framework (gitlab.com/freepascal.org/mcp) Open the following packages in Lazarus IDE and compile them: - mcp/Src/Base/mcpbase.lpk - Core MCP library - mcp/Src/IDE/mcpdesign.

README

以下为原文 README 节选,完整内容请查看原文。

lazfpc-mcp

An MCP (Model Context Protocol) server for Lazarus and Free Pascal development. Provides AI coding agents (Claude, Cursor, OpenCode, etc.) with structured access to Lazarus build tools, form analysis, project metadata, and testing workflows.

Built with the official FPC MCP framework and written entirely in Free Pascal.

Why This Exists

AI coding agents are powerful, but they lack native understanding of the Lazarus/Free Pascal ecosystem. This MCP server bridges that gap by exposing Lazarus-specific development workflows as MCP tools that any MCP-compatible client can invoke.

Architecture

                    AI Coding Agent
                   (Claude, Cursor, etc.)
                          |
                   MCP Protocol
                  (JSON-RPC 2.0 / stdio)
                          |
                   lazfpc-mcp
                  (Free Pascal binary)
                          |
          +---------------+---------------+
          |               |               |
     lazbuild/fpc    LfmParser      .lpi XML Parse
     (build tools)  (form analysis)  (project metadata)

The server uses TMCPStdIOApplication from the FPC MCP framework for stdio transport, making it compatible with all major MCP clients.

Tools

Phase 1 - Core

Tool Description Input Output
build_project Build a Lazarus .lpi project using lazbuild project_path, target_os?, target_cpu? success, output, errors[]
parse_lfm Parse a .lfm form file and return component tree lfm_path, max_depth? component tree JSON

Phase 2 - Analysis & Testing

Tool Description Input Output
parse_lpi Parse .lpi project file metadata lpi_path units[], dependencies[], options
run_fpcunit_tests Build and run FPCUnit test project test_project_path, suite_filter? pass/fail per test

Phase 3 - Discovery

Tool Description Input Output
search_fpc_help Search FPC RTL/FCL documentation query, max_results? docs with snippets
list_projects Scan directories for .lpi/.lpr files directory_path, recursive? project list

Prerequisites

  • Free Pascal Compiler 3.2.2+
  • Lazarus IDE with mcpbase.lpk package installed
  • FPC MCP framework (gitlab.com/freepascal.org/mcp)

Setup

1. Clone the FPC MCP Framework

cd /path/to/your/lazarus/workspace
git clone https://gitlab.com/freepascal.org/mcp.git

2. Install MCP Packages in Lazarus

Open the following packages in Lazarus IDE and compile them:

  • mcp/Src/Base/mcpbase.lpk - Core MCP library
  • mcp/Src/IDE/mcpdesign.lpk - Design-time components (optional)

3. Build lazfpc-mcp

FPC_VER=$(/path/to/fpc/bin/fpc -iV)
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "lazarus-dev": { "command": "/path/to/lazfpc-mcp/lazfpc-mcp", "args": [] } } }