Skip to main content
Glama
fpgaZeroMCP

fpgaZeroMCP

by lcapossio

fpgaZeroMCP

CI License: MIT Python MCP

Ein Open-Source-Model Context Protocol-Server, der KI-Assistenten eine vollständige FPGA-Toolchain bietet — Linting, Simulation, Synthese, Place-and-Route, Bitstream-Programmierung und ein Live-Register für IP-Cores, das von GitHub gespeist wird.

Bitte deine KI, nach Cores zu suchen, sie herunterzuladen, HDL zu linten, ein Mehrdateien-VHDL- oder Verilog-Projekt von der Festplatte zu synthetisieren, eine Simulation auszuführen und anschließend den Bitstream auf dein Board zu flashen — einfach so, ohne dein Chatfenster zu verlassen.

Funktionen

  • Mehrsprachig: Verilog, SystemVerilog und VHDL (via ghdl-yosys-plugin)

  • Drei Eingabemodi: Inline-code-String, files-Dictionary mit mehreren Dateien oder project_dir-Pfad auf der Festplatte

  • Filelist-Unterstützung: files.f/sources.f mit +incdir+, +define+ und verschachtelten -f-Direktiven

  • Board-Presets: 11 integrierte Boards (iCEBreaker, ULX3S, TinyFPGA BX, Tang Nano usw.) — setzt Target/Device/Package/Clock automatisch

  • Automatische Constraint-Erkennung: findet .pcf/.lpf/.pdc/.cst in deinem Projektverzeichnis

  • Bitstream-Programmierung: Flashen via iceprog (iCE40) oder openFPGALoader (ECP5/Gowin/Nexus/Xilinx)

  • Vivado: Stapel-Läufe über start_build, Xilinx-Builds über LiteX, strukturiertes Parsergebnis der Vivado-Logs in build_status

  • Auswertung der Simulationsergebnisse: PASS/FAIL/UVM-Mustererkennung mit VCD-Signalzusammenfassung

  • Hintergrund-Builds: langlaufende Synthese/PnR mit Statusabfrage und einer strikten Whitelist, die ausschließlich EDA-Befehle erlaubt

  • Parallele Anfragen: ping, Build-Status und Abbrechen werden beantwortet, während ein langsamer Tool-Aufruf noch läuft; notifications/cancelled bricht einen in Bearbeitung befindlichen Aufruf ab

  • Maschinenlesbare Ergebnisse: structuredContent bei den Tool-Ergebnissen (MCP 2025-06-18) und eine einheitliche error_code-Taxonomie für erneute Versuche und Fallback

  • Fortschritts-Benachrichtigungen: notifications/progress an den Projektphasen-Übergängen von Synthese, Place-and-Route und LiteX-Läufen, wenn der Client ein progressToken sendet

  • IP-Core-Registry: Live-Suche und Import aus GitHub mit FuseSoC-CAPI2-Metadaten

  • Health-Check: erkennt, welche OSS-CAD-Suite-Werkzeuge installiert und erreichbar sind


Related MCP server: vivado-mcp-agent

Inhaltsverzeichnis


So funktioniert es

Der MCP-Server läuft als lokaler Subprozess. Deine KI ruft über JSON-RPC (stdio) dessen Tools auf. Der Server führt Yosys, nextpnr, iverilog, Verilator usw. aus der OSS CAD Suite aus — und kann Open-Source-FPGA-Cores direkt von GitHub holen.

Your AI assistant  <-->  fpgaZeroMCP (stdio MCP server)  <-->  OSS tools
                                    |
                           cores/   registry on GitHub
                           (uart_tx, fifo + any imported)

Voraussetzungen

Voraussetzung

Hinweise

Python 3.11+

OSS CAD Suite

Bündelt iverilog, Yosys, nextpnr, Verilator, Verible, GHDL zentral in einem Download

LiteX + litex-boards

Optional — nur für die LiteX-Werkzeuge erforderlich

Füge die OSS CAD Suite nach der Installation zu deinem PATH hinzu. Alle Tool-Wrapper reagieren sauber ab, wenn eines der Werkzeuge fehlt.

GitHub-API-Zugriff

GitHub-API-Anfragen sind standardmäßig nicht authentifiziert und unterliegen Rate Limits. Setze ein persönlichen Access-Token, um die Limits zu erhöhen:

# Linux/macOS
export GITHUB_TOKEN=ghp_...
# Windows (PowerShell)
$env:GITHUB_TOKEN = "ghp_..."

Installation

git clone https://github.com/lcapossio/fpgaZeroMCP
cd fpgaZeroMCP
pip install -e .

MCP-Client-Einrichtung

Claude Desktop

Füge dies zu claude_desktop_config.json hinzu:

{
  "mcpServers": {
    "fpgaZeroMCP": {
      "command": "python",
      "args": ["/path/to/fpgaZeroMCP/server.py"],
      "env": { "PYTHONPATH": "/path/to/fpgaZeroMCP" }
    }
  }
}

VS Code (GitHub Copilot)

Füge dies in deiner Workspace in .vscode/mcp.json hinzu:

{
  "servers": {
    "fpgaZeroMCP": {
      "type": "stdio",
      "command": "python",
      "args": ["/path/to/fpgaZeroMCP/server.py"],
      "env": { "PYTHONPATH": "/path/to/fpgaZeroMCP" }
    }
  }
}

Cursor / Windsurf

Füge dies in deinen MCP-Einstellungen hinzu (Settings → MCP Servers):

{
  "fpgaZeroMCP": {
    "command": "python",
    "args": ["/path/to/fpgaZeroMCP/server.py"],
    "env": { "PYTHONPATH": "/path/to/fpgaZeroMCP" }
  }
}

Beispiel-Prompts

  • „Such mir einen I2C-Master-Core und importiere ihn."

  • „Synthetisiere die VHDL-Dateien in ~/projects/my_fpga und nenne mir die LUT-Anzahl."

  • „Führe ein PnR für mein iCEBreaker-Board aus und flashe es danach."

  • „Mach ein Place-and-Route mit Seed 42, um das Timing zu verbessern."

  • „Linte dieses Verilog und behebe alle Fehler."

  • „Simuliere dieses FIFO und sage mir, ob die Testbench bestanden hat."

  • „Formatiere diese SystemVerilog-Datei."

  • „Welche OSS-CAD-Suite-Werkzeuge habe ich installiert?"


Tools

HDL-Qualität

Tool

Beschreibung

lint_hdl

Syntaxprüfung/Fehlercheck via iverilog (V/SV) oder GHDL (VHDL) — eine einzelne Datei

lint_project

Mehreere Dateien gemeinsam prüfen, damit modulübergreifende Referenzen aufgelöst werden

get_diagnostics

Strukturierte zeilenweise Diagnose — Verilator → verible-Fallback (V/SV), GHDL (VHDL)

format_hdl

Automatisch formatieren via verible-verilog-format (V/SV) oder vsg (VHDL)

Design-Flow

Tool

Beschreibung

simulate

Testbenches kompilieren und ausführen — iverilog (V/SV) oder GHDL (VHDL). Akzeptiert code, files oder project_dir. Liefert Verdict + VCD-Zusammenfassung

synthesize

Yosys-Synthese mit Ressourcen-Statistik. Akzeptiert code, files oder project_dir. Verilog, SV, VHDL

place_and_route

Yosys + nextpnr in einem Schritt. Board-Presets, automatische Constraint-Erkennung, Bitstream wird auf die Platte geschrieben (bitstream_path)

program_fpga

Bitstream über iceprog oder openFPGALoader flashen

list_boards

Viertelbare Board-Presets auflieten (target/device/package/clock)

IP-Core-Registry

Tool

Beschreibung

list_ip_cores

Lokale Registry durchs eintrag, nach Kategorie filtern

get_ip_core

Manifest und HDL-Quelle eines Cores abrufen

generate_ip

Parametrisierten Instanziierungs-Schnipsel + Quelldateien erzeugen

search_github_cores

GitHub nach MIT-lizenzierten FPGA-IP-Repos durchsuchen

import_github_core

GitHub-Repo in die lokale Registry übernehmen

import_fusesoc_core

Lokale FuseSoC-CAPI2-.core-Datei importieren

LiteX

Tool

Beschreibung

litex_build

Ein LiteX-Board-Target mit --build ausrouten

litex_soc

Ein LiteX-SoC erzeugenung, ohne Gateware zu bauen

litex_flow

Ein LiteX-Board-Target mit vollständig eigenen Argumenten ausführen

Build-Verwaltung

Tool

Beschreibung

start_build

Langlaufenden Befeuer im Hintergrund starten (nur Whitelist für EDA-Werkzeuge)

build_status

Fortschritt abenfragen — Status, verstrichene Zeit, geparste phase/usage/timing

list_builds

Alle verfolgten Builds auflisten (laufend und beendet)

cancel_build

Laufenden Hintergrund-Build abbrechen

cleanup_build_logs

Alte Build-Logs nach Alter und Gesamtgröße löschen

Server / Registry

Tool

Beschreibung

check_tools

Meldet, welche OSS-CAD-Suite-Werkzeuge installiert sind, mit Pfaden und Versionen

reload_registry

Core-Verzeichnisse neu einlesen, ohne den Server neu zu asaden


IP-Core-Registry

Cores liegen in cores/<name>/ — einem core.json-Manifest und einer oder mehreren HDL-Dateien. Der Server erkennt sie automatisch beim Start und lädt die Registry nach jedem Import neu.

Zwei-Referenz-Cores sind enthalten (uart_tx, fifo), um das Format zu demonstrieren. Die Registry soll hier nicht wachsen — sie wird über GitHub gespeist.

Cores zur Laufzeit abrufen

# Find a RISC-V softcore
search_github_cores("riscv softcore", language="verilog")

# Pull it in
import_github_core("YosysHQ/picorv32")

# It is now in the local registry
get_ip_core("picorv32")
generate_ip("picorv32", {"COMPRESSED_ISA": 1})

Der Server nutzt automatisch die FuseSoC-CAPI2-Metadaten (.core-Dateien), wenn sie im Repo vorhanden sind, und bietet so reichhaltigere Parameter- und Portinformationen. Akzeptiert werden nur Repos mit einer erlaubten Lizenz.

Einen Core beitragen

Eröffne keine PRs, die Cores zu diesem Repo hinzufügen. Stattdessen:

  1. Veröffentliche dein HDL-Repo auf GitHub mit dem fpga-Topic und einer MIT-Lizenz

  2. Füge optional eine FuseSoC-CAPI2-.core-Datei hinzu, für umfangreichere Metadaten

  3. Danach kann jeder/jede direkt mit import_github_core("you/your-core") davon profitieren

So bleibt der Server schlank und die Community kann auf GitHub organisch wachsen.


Syntheseziele

Target

Hersteller / Familie

Vollständiges OSS PnR

ice40

Lattice iCE40

ja — nextpnr-ice40

ecp5

Lattice ECP5

ja — nextpnr-ecp5

nexus

Lattice Nexus (CrossLink-NX, CertusPro-NX)

ja — nextpnr-nexus

gowin

Gowin

ja — nextpnr-gowin

xilinx

Xilinx / AMD

Nur Synthese

intel

Intel / Altera

Nur Synthese

generic

Technologie-unabhängig

Nur Netzliste

Gängige device/package-Werte für place_and_route:

Target

device

package

ice40

hx1k hx8k up5k lp1k

tq144 qn84 sg48 cm81

ecp5

25k 45k 85k

CABGA256 CABGA381

nexus

LIFCL-40-9BG400C

(in den Geräte-String integriert)

gowin

GW1N-UV4LQ144C6/I5

(in den Geräte-String integriert)


LiteX

LiteX ist ein Python-SoC-Framework, das viele FPGA-Boards unterstützt. fpgaZeroMCP stellt drei dedizierte LiteX-Tools bereit und akzeptiert sowie backend="litex" in synthesize und place_and_route.

# Dedicated tools
litex_build(board="arty", args=["--build"])
litex_soc(board="arty", args=["--no-compile"])
litex_flow(board="arty", args=["--build", "--output-dir", "build_arty"])

# As a backend in existing flow tools
synthesize(code="...", top_module="top", backend="litex", litex_board="arty")
place_and_route(code="...", top_module="top", target="ice40", device="hx1k",
                backend="litex", litex_board="arty", litex_args=["--build"])

Lokale Core-Repositories

Du kannst die Registry auf zwei Arten auf deine eigenen lokalen HDL-Verzeichnisse ausrichten:

Umgebungsvariable:

Linux/macOS (mit Doppelpunkt getrennt):

export USERCORES_PATH=/home/you/my-cores:/home/you/work-cores

Windows (mit Semikolon getrennt, PowerShell):

$env:USERCORES_PATH = "C:\Users\you\my-cores;C:\Users\you\work-cores"

Konfigurationsdatei (config.json):

{
  "core_paths": [
    "/home/you/my-cores",
    "/home/you/work-cores"
  ]
}

All paths are scanned on startup alongside the built-in cores/ directory.

Zulässige Lizenzen

Standardmäßig akzeptiert import_github_core Repos mit einer dieser SPDX-Lizenzen:

MIT, BSD-2-Clause, BSD-3-Clause, Apache-2.0, ISC, GPL-2.0, GPL-3.0, LGPL-2.1, LGPL-3.0

Überschreiben mit der Umgebungsvariable FPGAZERO_ALLOWED_LICENSES (kommagetrennte SPDX-IDs):

# Linux/macOS
export FPGAZERO_ALLOWED_LICENSES=MIT
export FPGAZERO_ALLOWED_LICENSES=MIT,Apache-2.0
# Windows (PowerShell)
$env:FPGAZERO_ALLOWED_LICENSES = "MIT"
$env:FPGAZERO_ALLOWED_LICENSES = "MIT,Apache-2.0"

Lizenz-IDs folgen der SPDX-Notation. Die Prüfung erfolgt beim Import; search_github_cores liefert Ergebnisse unabhängig von der Lizenz, sodass Sie vor dem Import bewerten können.


Testen

pip install -e ".[dev]"
python -m pytest tests/ -v

Einige Tests benötigen OSS-CAD-Suite-Tools im PATH. Tests, die fehlende Tools benötigen, werden automatisch übersprungen.


Reduzierung des Speicherbedarfs

Der Server läuft als Subprozess mit einem Prozess pro Sitzung über den stdio-Transport (so starten ihn MCP-Clients wie Claude Desktop). Jede Sitzung belegt im Leerlauf auf Linux etwa 60-90 MB RSS, hauptsächlich durch Python-Interpreter und Abhängigkeiten.

Wenn Sie viele gleichzeitige MCP-Sitzungen ausführen, setzen Sie diese Umgebungsvariablen, bevor Sie Ihren MCP-Client starten:

# Linux — reduces glibc malloc arena fragmentation (can save 10-20 MB per session)
export MALLOC_ARENA_MAX=2

# Strip bytecode position annotations from tracebacks (saves a few MB)
export PYTHONNODEBUGRANGES=1

# Skip .pyc cache files (no memory impact, avoids disk writes)
export PYTHONDONTWRITEBYTECODE=1

Das sind Zero-Code-Änderungen und vollständig transparent.


Umgebungsvariablen

Variable

Beschreibung

GITHUB_TOKEN

GitHub-Personal-Access-Token — erhöht die API-Ratenlimits

USERCORES_PATH

Zusätzliche Core-Suchverzeichnisse (durch OS-Pfadtrenner getrennt)

FPGAZERO_ALLOWED_LICENSES

Kommagetrennte SPDX-IDs für import_github_core (Standard: MIT,BSD-2-Clause,BSD-3-Clause,Apache-2.0,ISC,GPL-2.0,GPL-3.0,LGPL-2.1,LGPL-3.0)

FPGAZERO_TMPDIR

Überschreibt das Stammverzeichnis des temporären Arbeitsbereichs

FPGAZERO_DATA_DIR

Stammverzeichnis für persistente Server-Artefakte — Build-Logs, LiteX-Ausgabe, temporäre Arbeitsbereiche (Standard: <install dir>/no_commit)

FPGAZERO_ALLOWED_DIRS

Durch OS-Pathsep getrennte Liste zusätzlicher Verzeichnisse, aus denen project_dir lesen darf und start_build/place_and_route als work_dir verwenden dürfen (zusätzlich zu cwd und $HOME)


Standalone / Skripting

Die Python-API kann direkt ohne MCP-Client verwendet werden:

from registry.resolver import CoreRegistry
from tools.lint import lint_hdl

reg = CoreRegistry()

# Import a core from GitHub
reg.import_github_core("ben-marshall/uart")

# Generate a parameterized instantiation
result = reg.generate_ip("uart", {"CLKS_PER_BIT": 868})
print(result["instantiation"])

# Lint some HDL
lint_hdl(open("my_design.v").read())
python example.py   # runs the built-in demo

core.json-Schema

{
  "name": "my_core",
  "version": "1.0.0",
  "description": "...",
  "author": "you",
  "license": "MIT",
  "language": "verilog",
  "category": "communication",
  "tags": ["spi", "serial"],
  "parameters": {
    "DATA_WIDTH": { "type": "integer", "default": 8, "description": "..." }
  },
  "ports": {
    "clk": { "direction": "input", "width": 1, "description": "System clock" }
  },
  "files": ["my_core.v"]
}

Autor

Leonardo Capossio (bard0) — hello@bard0.com

Lizenz

MIT — siehe LICENSE.

Available Tools

25 tools
build_statusA

Check the progress of a background build. Returns status (running/success/failed), elapsed time, and recent log output.

Inputs: build_id (required), tail_lines, parse.

cancel_buildB

Cancel a running background build.

Inputs: build_id (required).

check_toolsA

Check which EDA tools are installed and reachable. Returns tool name, path, and version for each detected binary.

Inputs: no named parameters.

cleanup_build_logsA

Delete old build logs to reclaim disk space. Removes logs older than max_age_days, then trims oldest until under max_total_mb.

Inputs: max_age_days, max_total_mb.

format_hdlA

Format HDL source code and return the result. Verilog/SystemVerilog: uses verible-verilog-format. VHDL: uses vsg (pip install vsg). Returns the formatted code and whether it changed.

Inputs: code (required), language.

generate_ipB

Generate a parameterized instance of an IP core. Returns the HDL source files and a ready-to-paste Verilog instantiation snippet with the requested parameter values applied.

Inputs: name (required), parameters, instance_name.

get_diagnosticsB

Return structured lint diagnostics (line, column, severity, message) for HDL source. Verilog/SystemVerilog: uses Verilator (primary) with verible-verilog-lint as fallback. VHDL: uses GHDL. All tools are part of OSS CAD Suite.

Inputs: code (required), language.

get_ip_coreB

Fetch the full manifest and HDL source files for a named IP core.

Inputs: name (required).

import_fusesoc_coreA

Import a local FuseSoC CAPI2 .core file into the registry. HDL files referenced in the .core file must exist in the same directory. Useful when you already have FuseSoC cores checked out locally.

Inputs: path (required).

import_github_coreA

Download an open-source GitHub repository and add it to the local IP core registry. Automatically uses FuseSoC CAPI2 metadata (.core file) if one exists in the repo. After import, the core is immediately available via get_ip_core and generate_ip.

Inputs: repo (required), subdir, ref.

lint_hdlA

Lint HDL source code using iverilog/verilator (Verilog/SystemVerilog) or ghdl (VHDL). Use linter='verilator' to enable -Wall checks including multidriven net detection.

Inputs: code (required), language, top_module, linter.

lint_projectA

Lint multiple HDL files together so cross-module references resolve. Pass a dict of filename-to-source pairs. All files are compiled in one invocation of iverilog/verilator (Verilog/SystemVerilog) or ghdl (VHDL). Use linter='verilator' to enable -Wall checks including multidriven net detection.

Inputs: files (required), language, top_module, timeout, +1 more.

list_boardsA

List all known FPGA board presets with target, device, package, and clock frequency.

Inputs: no named parameters.

list_buildsA

List all tracked builds (running and finished) with status summary.

Inputs: no named parameters.

list_ip_coresA

List all available IP cores in the registry. Optionally filter by category.

Inputs: category.

litex_buildC

Run LiteX board target with --build. Returns logs and output directory.

Inputs: board (required), args, output_dir, timeout.

litex_flowA

Run a generic LiteX board target with caller-provided args.

Inputs: board (required), args, timeout.

litex_socA

Generate LiteX SoC without building gateware. Returns logs and output directory.

Inputs: board (required), args, output_dir, timeout.

place_and_routeA

Synthesize HDL with Yosys then place-and-route with nextpnr in one step. Provide source as: code (single string), files (dict of filename→source), or project_dir (path to HDL files on disk). If backend=litex, runs LiteX build and ignores HDL inputs. Returns max frequency, critical path, resource utilization, bitstream, and full logs. Supported targets: ice40, ecp5, nexus, gowin. Common device/package values: ice40: device=hx1k|hx8k|up5k|lp1k package=tq144|qn84|sg48|cm81 ecp5: device=25k|45k|85k package=CABGA256|CABGA381 nexus: device=LIFCL-40-9BG400C (package embedded in device string) gowin: device=GW1N-UV4LQ144C6/I5 (package embedded in device string)

Inputs: top_module (required), code, files, project_dir, +12 more.

program_fpgaA

Flash a bitstream to an FPGA board using iceprog (ice40) or openFPGALoader (ecp5/gowin/nexus). Provide bitstream as base64 (from place_and_route output) or a file path on disk.

Inputs: target (required), bitstream_b64, bitstream_path, programmer, +2 more.

reload_registryA

Re-scan all core directories and rebuild the IP core cache. Call after adding cores to disk or editing config.json.

Inputs: no named parameters.

search_github_coresA

Search GitHub for open-source FPGA IP cores (MIT, BSD, Apache, GPL, etc). Returns repo names, star counts, descriptions and topics. Use import_github_core to download a result into the local registry.

Inputs: query (required), language, max_results.

simulateA

Compile and simulate HDL using Icarus Verilog (iverilog + vvp) or GHDL (VHDL). Provide the design source and a separate testbench. Returns all $display/$monitor output (Verilog) or report output (VHDL) and any runtime errors.

Inputs: code (required), testbench (required), language, timeout.

start_buildA

Start a long-running build command in the background. Returns a build_id to check progress with build_status. Use for synthesis, place-and-route, LiteX builds, or any command that takes minutes.

Inputs: cmd (required), label, work_dir.

synthesizeA

Synthesize HDL (Verilog, SystemVerilog, or VHDL) using Yosys or run LiteX backend. Provide source as: code (single string), files (dict of filename→source), or project_dir (path to HDL files on disk). Returns resource statistics and the list of inferred modules. Supported targets: generic, ice40, ecp5, gowin, xilinx, intel.

Inputs: top_module (required), code, files, project_dir, +6 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 25 tools

    Disambiguation5/5

    Each tool targets a distinct operation: build management, IP core management, HDL linting/simulation, synthesis/P&R, and LiteX flows. Overlaps like lint_hdl vs lint_project are clearly differentiated by single vs multi-file scope, so agents can reliably select the correct tool.

    Naming Consistency5/5

    All tool names follow consistent snake_case with a verb_noun pattern (e.g., list_boards, generate_ip, cancel_build). No camelCase or mixed styles, making naming predictable and easy to remember.

    Tool Count4/5

    25 tools cover a broad FPGA development workflow without being excessive. Each sub-domain (builds, IP cores, linting, synthesis, LiteX) is adequately represented, though the count is at the upper end of typical scopes.

    Completeness4/5

    The tool set covers the main FPGA flow: HDL linting, simulation, synthesis, place-and-route, and programming, plus build management and IP core discovery/import. Minor omissions like constraint file generation or waveform viewing exist, but core operations are well-supported.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Provides AI assistants with a complete FPGA toolchain for HDL linting, simulation, synthesis, and place-and-route across various hardware targets. It features a GitHub-backed IP core registry that enables users to search for and import MIT-licensed cores directly through their chat interface.
      15
      1
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      MCP server for deterministic Vivado FPGA automation including project scaffolding, simulation, synthesis, implementation, and gated bitstream generation.
      4
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      A minimal MCP server that provides 25 tools and 5 hooks to control Xilinx Vivado EDA for FPGA development, including session management, Tcl execution, smart diagnostics, and IP debugging.
      32
      166 PyPI
      181
      Apache 2.0