
pyslang-mcp
io.github.ariklapid由 GitHub 帳號 ariklapid 發布v0.1.0更新於 Oct 24, 2026
Compiler-backed read-only Verilog and SystemVerilog project analysis.
概覽
一個本機、唯讀的 MCP 伺服器,透過 pyslang 讓助理取得以編譯器為基礎的 Verilog 與 SystemVerilog 專案分析。
- 可以做什麼
- 載入並解析 HDL 原始碼,可直接指定檔案,或使用含 include 與 define 的 .f 檔案清單,並回報前置處理中繼資料與不支援的清單項目。取得解析與語意診斷,依錯誤碼分組,並列出或描述模組、介面與套件。走訪展開後的實例階層,輸出單一實例的埠連接。尋找符號宣告與引用、單元內成員以及訊號賦值,並追蹤有界結構連通性。產生語法樹摘要與精簡的專案概覽。
- 適用情境
- 當助理需要針對既有 RTL 的編譯器前端證據而非文字搜尋時適用:排查診斷、確認檔案清單展開結果、列出設計單元、定位宣告,或取得階層與埠上下文用於審查與除錯。對於單純的命名或註解問題,一般文字搜尋或直接讀取檔案通常更快。
- 執行需求
- 以本機 stdio 程序執行,需與能看到 RTL 程式碼庫的同一台機器、虛擬機或開發容器。從 PyPI 安裝 pyslang-mcp 套件(CI 涵蓋 Python 3.11 與 3.12),透過主控台指令或 python -m pyslang_mcp 啟動。每次工具呼叫都必須提供 project_root,路徑須位於其下。未宣告驗證、環境變數或標頭。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 pyslang-mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
pyslang-mcp
[CI] [PyPI] [Python] [Status] [Transport]
pyslang-mcp is a local Model Context Protocol server that gives AI agents
compiler-backed, read-only context for Verilog and SystemVerilog projects.
It wraps pyslang so an MCP client can ask
questions against parsed and elaborated HDL instead of plain text:
- What modules, interfaces, and packages are in this filelist?
- What diagnostics does the compiler frontend report?
- What is the instance hierarchy below this top?
- Where is this symbol declared or referenced?
- Did my include paths, defines, and nested
.ffiles resolve as expected?
This is not a simulator, synthesizer, waveform viewer, linter replacement, or RTL refactoring tool. It is a small semantic analysis service for local HDL checkouts.
That read-only boundary is intentional. It keeps the server side-effect free, reduces the blast radius in IP-protected workspaces, and makes it safer to use in local and CI environments.
It was decided to keep pyslang-mcp read-only. The LLM handles the actual RTL
coding, while pyslang-mcp serves as the compile/elab-backed reader, checker,
and explainer for code that already exists. In other words, the model drafts
the RTL and the MCP server verifies what the compiler frontend sees.
[!NOTE] The project is currently early-stage and published on PyPI and the MCP Registry for local stdio use.
Why ASIC And EDA Engineers Might Care
Most AI coding tools are good at searching text. HDL usually needs more than that.
In real projects, useful answers often depend on filelists, packages, includes,
defines, generate blocks, and hierarchy. pyslang-mcp gives an agent a compact
compiler-backed view of that structure, while keeping the server read-only and
scoped to a project root you provide.
Good fits:
- triaging parse and semantic diagnostics before asking an agent to reason about RTL
- checking what a
.ffile expands to - listing design units in a block or small IP
- finding a declaration without chasing comments and stale grep hits
- getting hierarchy and port-connection context for review/debug prompts
- giving workflow agents HDL context without handing them an EDA runtime
Quickstart
Install the package:
Run the local stdio server:
For contributor setup, clone the repo and install it in editable mode:
Run the checkout stdio server:
The installed console script works too:
Run tests:
MCP Client Config
Use local stdio. The MCP client should launch the server on the same machine,
VM, or dev container that can see your RTL checkout.
For editable checkout installs, point the command at the checkout virtual environment instead:
Tool calls must provide a project_root. Source paths, filelists, and include
directories may be absolute or relative, but they must stay under that root.
Minimal Tool Payloads
Analyze explicit files:
Analyze a filelist:
Find a symbol:
Tools
Typical flow:
- Start with
pyslang_parse_filelistorpyslang_parse_files. - Run
pyslang_get_diagnostics. - Use
pyslang_list_design_unitsto see what the compiler frontend found. - Use
pyslang_describe_design_unit,pyslang_get_hierarchy, orpyslang_find_symbolfor the actual review/debug question.
Verilog/SystemVerilog Analysis And Debugging Flow
- Use
pyslang_summarize_diagnostics_by_codeto separate repeated frontend warnings from unresolved dependency errors. - Use
pyslang_find_memberto locate local names such asresponse__vld. - Use
pyslang_get_assignmentsto inspect visible continuous or procedural drivers and loads. - Use
pyslang_get_instance_connectionsfor one instance's port binding context. - Use
pyslang_trace_connectivityfor bounded structural paths through assignments and instance port bindings.
Connectivity tracing is structural frontend evidence. It is not simulation, formal proof, CDC/RDC signoff, timing signoff, or a complete netlist-level driver/load database.
Filelist Support
The current parser intentionally supports a practical subset used by many RTL flows:
- source file entries
- nested filelists with
-fand-F - include directories with
+incdir+...,-I dir, and-Idir - defines with
+define+...,-D NAME, and-DNAME
Unsupported filelist tokens are reported in the tool output instead of being silently ignored.
Example Agent Prompts
Use this server when compiler-backed context matters:
- "Parse
compile/project.fwith+define+DEBUGand group diagnostics by source file." - "List every design unit in this project and identify the likely top modules."
- "From
top, show the instance hierarchy down to depth 4." - "Describe module
axi_dma_top: ports, child instances, and declared names." - "Find the declaration and references for
payload_valid." - "Confirm whether
legacy_widgetis instantiated anywhere the elaborator sees it." - "Show the resolved files, include dirs, defines, and unsupported entries from this filelist."
For single-line questions, comments, naming searches, or partial/incomplete
source sets, regular rg, editor search, or direct file reading is usually
faster and clearer.
Guardrails
- Read-only MCP tools. No RTL edits, formatting, simulation, or synthesis.
- Strict project-root scoping. Paths outside
project_rootare rejected. - Compact JSON responses with truncation metadata for large result sets.
- Process-local cache keyed by project config and tracked file mtimes.
pyslang_preprocess_filesis summary-oriented. It returns preprocessing metadata and source excerpts, not a guaranteed full standalone preprocessed stream.streamable-httpremains experimental. The internal MaaS path wraps it with a bearer token for single-server use, but it is not a complete production hosted security boundary by itself.
Remote MaaS Direction
Remote MaaS is planned as two separate tracks, not as one generic hosted mode:
- Plan A: public OSS MaaS. A convenience/demo service for public open-source HDL repositories. This is not suitable for proprietary or confidential RTL.
- Plan B: internal MaaS. A self-hosted deployment pattern for companies to run inside their own network, close to internal repositories, auth, logging, and security controls.
Start with the internal MaaS quickstart for a single internal server. See REMOTE_DEPLOYMENT.md for the full Plan A / Plan B split.
Docker Compose is the recommended bring-up path because it avoids Python setup issues and mounts the RTL checkout read-only. Docker is not required; the quickstart also includes a native Python path for corporate servers where containers are not available.
HDL Example Corpus
The repo includes generated HDL examples under
examples/hdl:
- clean reference projects from single modules to small IP-style examples
- intentionally buggy variants labeled
easy,medium, andhard - local validation hooks for both
pyslangandverilator --lint-only
Run the full corpus validator:
Run the CI smoke subset:
Using With Broader RTL Skills
If your agent environment already has a broad RTL skill such as
rtl-analysis, rtl-audit, or llm-based-verilog-analysis, use
pyslang-verilog-context as the fine-grained compiler-evidence layer beneath
that broader skill.
Recommended setup:
- Configure the
pyslang-mcpserver in your MCP client so the agent can call the read-onlypyslang_*tools. - Install or copy the
pyslang-verilog-contextskill fromskills/pyslang-verilog-context. - Add a delegation note like this to your broader RTL skill:
The intended flow is:
This keeps high-level RTL review policy in the broad skill while grounding
Verilog/SystemVerilog structure, diagnostics, hierarchy, symbols, includes, and
filelists in pyslang.
Evaluation Benchmarks
The repo includes a pyslang-verilog-context skill eval suite under
skills/pyslang-verilog-context/evals
and comparison reports under reports/. The current benchmark
compares three local evidence modes:
- text/no skill: source and filelist text heuristics only
- MCP/no skill: targeted
pyslang-mcptool calls - skill + MCP:
pyslang-verilog-contextsequencing withpyslang-mcp
Latest local result from 2026-06-14:
The benchmark mixes deterministic repo-local HDL fixtures with real public RTL
source files. The local fixtures exercise targeted behaviors such as filelists,
hierarchy, symbols, diagnostics, clean-frontend functional bugs, and RTL coding
and bug-audit discipline. The real public RTL cases use source files from
lowrisc-ibex,
pulp-common-cells, verilog-axis, pulp-axi,
pulp-register-interface, and picorv32. They exercise frontend diagnostic
status, design-unit inventory, and first-unit port counts on real source files.
See docs/evaluation-benchmarks.md for the
prompt/task shapes and MCP functions used.
Verification commands used for the reported run:
These are deterministic scalar harnesses, not blind autonomous LLM-judge runs.
pyslang-mcp evidence remains frontend/compiler context only, not simulation,
synthesis, CDC/RDC, timing, formal, or full lint signoff.
Documentation-only eval/report updates do not require a PyPI release. A PyPI release is warranted when package code, public tool behavior, schemas, runtime dependencies, CLI behavior, or user-facing install/runtime docs change in a way published users need.
Project Status
Implemented:
FastMCPstdio server- CLI entrypoint via
python -m pyslang_mcpandpyslang-mcp - project loader with root checks and
.fparsing - pyslang-backed diagnostics and diagnostic grouping, design-unit and member lookup, assignment and instance-connection analysis, bounded structural connectivity, hierarchy, syntax summaries, and project summaries
- bounded in-memory cache
- fixture-backed tests and Ubuntu CI for Python 3.11 and 3.12
- package smoke CI from a built wheel
- manual PyPI Trusted Publishing release workflow with release-gate tests
- PyPI package:
pyslang-mcp - MCP Registry entry:
io.github.ariklapid/pyslang-mcp - internal MaaS bring-up artifacts: Dockerfile, Docker Compose config, native Python fallback instructions, systemd template, bearer-token HTTP option, and a single-server quickstart
Not done yet:
- schema freeze for a more mature API-stable release
- broad platform validation beyond the current Linux-focused CI path
- production MaaS hardening for broad team use: SSO, multi-workspace routing, Kubernetes deployment, source-safe metrics, and reverse-proxy examples
Development
Useful commands:
Architecture and contribution docs:
- docs/architecture.md
- docs/internal-maas-quickstart.md
- REMOTE_DEPLOYMENT.md
- docs/mcp-registry.md
- CONTRIBUTING.md
License
Apache-2.0. See LICENSE.
來源:README.md,提交 3effff5
工具
0版本歷史
1- v0.1.0最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分