Skip to main content

FPGA Testbench Knowledge MCP Server

为 FPGA 验证工程师服务的 MCP Server —— 让 Agent 在生成 Verilog testbench 代码前,一次调用即可拿到生成所需的全部上下文:

  1. 编码规范全文:coding-standards 类目下的全部规范条款,每次调用都会原样返回,确保生成代码严格遵循。
  2. 向量检索的相关知识片段:根据待测模块描述,对其余知识文章按二级标题切分后做语义检索,返回 Top-K 最相关的小节。

底层使用 ChromaDB 持久化向量库;首次启动会自动下载默认嵌入模型 all-MiniLM-L6-v2(约 80 MB,需联网),随后所有查询都是本地计算。

暴露的 MCP 工具

Tool 入参 返回
generate_testbench_context(description, top_k=5) description: str 待测模块描述;top_k: int 检索片段数 拼装好的 Markdown 字符串,可直接作为 LLM 生成 testbench 的上下文

返回 Markdown 结构:

# FPGA Testbench 生成上下文
> 待测模块描述: <description>

## 一、编码规范(必须严格遵循)
<整套 FPGA 编码规范的正文>

## 二、相关知识片段(语义检索 Top-K)
### 1. <文章标题> — <小节标题>
- 来源: knowledge://<category>/<article_id>
- 分类: <category>
- 相似度: 0.812
<chunk 正文>
...

安装

git clone <repo-url>
cd fpga-testbench-knowledge-mcp-server
uv sync

使用

开发调试 (MCP Inspector)

uv run mcp dev src/fpga_testbench_mcp/server.py

在 Inspector 的 Tools 面板调用 generate_testbench_context,输入待测模块描述即可。

配置 Claude Desktop

在 claude_desktop_config.json 中添加:

{
  "mcpServers": {
    "fpga-testbench-knowledge": {
      "command": "uv",
      "args": [
        "run",
        "--directory",
        "D:\\527\\fpga-testbench-knowledge-mcp-server",
        "fpga-testbench-mcp"
      ]
    }
  }
}

知识库内容

类别 用途
coding-standards 每次调用全文返回;FPGA RTL 编码规范、命名/注释/状态机/目录结构等
methodology 参与向量检索;定向测试方法、代码覆盖率基础
bus-protocols 参与向量检索;AXI4 / Avalon-MM 协议与 BFM
components 参与向量检索;时钟复位、BFM、结果检查等 testbench 组件设计
assertions 参与向量检索;SystemVerilog Assertion 入门
tools 参与向量检索;ModelSim / Vivado XSim 使用指南

开发

# 运行测试(首次会下载嵌入模型,需联网)
uv run python -m pytest tests/ -v

项目结构

src/fpga_testbench_mcp/
├── server.py                      # FastMCP 入口,注册唯一 Tool
├── resources/
│   ├── loader.py                  # index.yaml 解析、文章加载、编码规范拼装
│   └── vector_store.py            # ChromaDB 持久化索引与查询
└── knowledge_base/
    ├── index.yaml                 # 知识库总索引
    ├── coding-standards/          # 始终全文返回
    ├── methodology/               # 参与向量检索
    ├── bus-protocols/
    ├── components/
    ├── assertions/
    ├── tools/
    └── .chroma/                   # ChromaDB 持久化目录(git-ignored,按需重建)

重建索引:删除 src/fpga_testbench_mcp/knowledge_base/.chroma/ 后重启 server 即可。

Metadata

Release files for fpga-testbench-mcp 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fpga-testbench-mcp 0.2.1
File Size Uploaded Provenance Actions
fpga_testbench_mcp-0.2.1.tar.gz 569.3 kB Without provenance Details for fpga_testbench_mcp-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fpga-testbench-mcp 0.2.1
File Interpreter ABI Platform Actions
fpga_testbench_mcp-0.2.1-py3-none-any.whl Python 3 none any Details for fpga_testbench_mcp-0.2.1-py3-none-any.whl

Total release size: 1.0 MB

Release files / fpga_testbench_mcp-0.2.1.tar.gz

Download URL fpga_testbench_mcp-0.2.1.tar.gz
Size 569.3 kB
Tags Source
SHA-256 checksum
How to use checksums
be9f018809cac281ce0d9cfa338e93805b235b15918f7274004adbdc7a32bd76
BLAKE2b-256 checksum
How to use checksums
f108d269f6f21ef508df577cccba9719c78ff2367870c4ebe9bc3a3c5346b467
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / fpga_testbench_mcp-0.2.1-py3-none-any.whl

Download URL fpga_testbench_mcp-0.2.1-py3-none-any.whl
Size 447.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d601c0cae4ddef3ba9e377386d7ef0e84be2aafa345502585c1118fe32e218ac
BLAKE2b-256 checksum
How to use checksums
414613c483a49bf4d2f0238c1759a7834b57ae83f11fdb8c172d4838484d4348
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for fpga-testbench-mcp 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page