AP

ariklapid/pyslang-mcp

开发工具

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

21 stars 4 forks 质量 70 趋势 14Apache-2.0

pyslang-mcp 是一个只读的模型上下文协议服务器,用于编译器支持的 Verilog 和 SystemVerilog 分析。

概览

pyslang-mcp 是一个本地模型上下文协议服务器,为 AI 代理提供编译器支持的只读上下文,用于 Verilog 和 SystemVerilog 项目。 它包裹了pyslang,使MCP客户端可以针对解析和详细的HDL提问,而非纯文本: - 这个文件列表中有哪些模块、接口和包?- 编译器前端报告哪些诊断?- 这个顶部下面的实例层级是什么?- 这个符号在哪里声明或引用?- 我的包含路径、定义和嵌套的.f文件是否如预期解决? 这不是模拟器、合成器、波形查看器、线条替换或RTL重构工具。它是一个用于本地HDL检查的小型语义分析服务。 这个只读边界是有意为之。它保持服务器的副作用自由,减少IP保护工作区的爆炸半径,并使其在本地和CI环境中更安全。 最终决定保持pyslang-mcp为只读。

概述(AI 翻译)

pyslang-mcp 是一个本地模型上下文协议服务器,提供人工智能代理 Verilog 和 SystemVerilog 项目的编译器支持、只读上下文。

它会封装pyslang,这样MCP客户端就可以请求 针对解析和详细HDL而非纯文本的问题:

  • 该文件列表中包含哪些模块、接口和包?
  • 编译器前端报告哪些诊断?
  • 这个顶部下面的实例层级是什么?
  • 该符号在哪里宣告或引用?
  • 我的包含路径、定义和嵌套.f文件是否如预期般解析?

这不是模拟器、合成器、波形浏览器、线边替换或 RTL 重构工具。这是一个针对本地 HDL 的小型语义分析服务 结账。

那个只读边界是有意为之。它保持服务器副作用的自由, 它减少了IP保护工作区的爆炸半径,并使使用更安全 在本地和集成环境中。

决定保持pyslang-mcp只读。LLM负责实际的RTL 编码,而pyslang-mcp则作为编译/elab支持的读者、检查器, 以及对已有代码的解释。换句话说,模型草稿

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

README

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

pyslang-mcp

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 .f files 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 .f file 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:

pip install pyslang-mcp

Run the local stdio server:

pyslang-mcp

For contributor setup, clone the repo and install it in editable mode:

在 GitHub 查看完整 README

安装

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

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

配置

{ "mcpServers": { "pyslang-mcp": { "command": "pyslang-mcp", "args": [] } } }