mcp-cocotb
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-cocotbRun the test_dff.py Cocotb tests against dff.v and show the failures"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
@zesun33/mcp-cocotb
Model Context Protocol (MCP) server for Python-based Cocotb co-simulation hardware testbenches.
mcp-cocotb equips AI coding agents and IDEs (Cursor, Windsurf, GitHub Copilot / OpenAI Codex, Claude Code, Google Antigravity, OpenCode, Cline) with structured tools to discover, generate, and run asynchronous Python testbenches against Verilog/SystemVerilog designs. By wrapping the complexity of simulator VPI compilation, Makefile orchestration, and JUnit XML parsing into deterministic JSON contracts, agents can execute closed-loop verification without drowning in simulator logs.
⚡ Quick Tour: See It in Action
Why AI Agents Need mcp-cocotb
Without | With |
Handcrafts brittle Makefiles with obscure | 1-Call Generation & Execution ( |
Parses hundreds of lines of mixed C/VPI/Python stdout | Structured JSON with test counts, pass/fail, duration |
Assertion failures lost in noisy simulator terminal scrollback | Direct Python exception traceback & line numbers |
Simulator hangs on coroutine deadlock or infinite clock loop | Automated timeout kill-switch ( |
Requires complex local Python 3.12 + C++ compiler toolchains | Zero host configuration (runs via isolated rootless Podman) |
Real Agent Scenarios in 60 Seconds
1. Probing the Environment (Zero-Config Verification)
// Tool Call: cocotb_toolchain_info
{
"runtime": "podman",
"image": "localhost/zesun33/verilog",
"cocotbVersion": "2.1.0",
"pythonVersion": "Python 3.12.3",
"simulator": "iverilog (Icarus Verilog)"
}2. Static Test Discovery (Inspect Test Matrix Without Running)
// Tool Call: cocotb_list_tests {"test_file": "test_dff.py"}
{
"file": "test_dff.py",
"totalTests": 3,
"tests": [
{ "name": "test_dff_reset", "doc": "Verify DFF reset behavior." },
{ "name": "test_dff_toggle", "doc": "Verify DFF data propagation across clock edges." },
{ "name": "test_dff_failing_assert", "doc": "Negative test fixture for assertion failure handling." }
]
}3. Automated Co-Simulation Runner (Passing Suite)
// Tool Call: cocotb_run {"verilog_sources": ["dff.v"], "toplevel": "dff", "python_module": "test_dff"}
{
"success": false,
"totalTests": 3,
"passedTests": 2,
"failedTests": 1,
"durationSeconds": 0.04,
"tests": [
{ "name": "test_dff_reset", "classname": "test_dff", "time": 0.012, "status": "pass" },
{ "name": "test_dff_toggle", "classname": "test_dff", "time": 0.018, "status": "pass" },
{
"name": "test_dff_failing_assert",
"classname": "test_dff",
"time": 0.010,
"status": "fail",
"failureMessage": "assert False, 'INTENTIONAL_ASSERTION_FAILURE'",
"traceback": "Traceback (most recent call last):\n File \"test_dff.py\", line 45, in test_dff_failing_assert\n assert False, 'INTENTIONAL_ASSERTION_FAILURE'\nAssertionError: INTENTIONAL_ASSERTION_FAILURE"
}
]
}4. Instant Agent Self-Repair Loop
Because mcp-cocotb captures the exact Python failure traceback (AssertionError: INTENTIONAL_ASSERTION_FAILURE at line 45), the LLM agent immediately knows what line and condition failed and can self-correct the RTL or testbench in a single turn without human intervention.
Related MCP server: EDA Tools MCP Server
Tools Exposed
Tool | Parameters | Engine | Description |
|
|
| Compiles DUT, creates temporary simulation runner, executes Python testbench, and returns parsed JUnit XML results with tracebacks. |
|
| AST Scanner | Fast static parser extracting all |
|
| Generator | Generates a clean, reproducible Cocotb simulation |
| none | Probe | Returns active container/host runtime and versions of Cocotb, Python 3, and simulator engines. |
Execution Runtime
mcp-cocotb automatically executes co-simulations inside the zesun33/verilog rootless Podman container (localhost/zesun33/verilog), ensuring identical, reproducible verification environments across any Linux host:
Container mount:
-v <workspace>:/workspace:Z -w /workspaceShared Python C library embedding:
libpython3.12Rootless storage option:
--storage-opt overlay.ignore_chown_errors=true
To force local host execution instead of Podman:
export MCP_COCOTB_RUNTIME=hostUniversal Client & AI IDE Setup
Because mcp-cocotb implements the standard Model Context Protocol (MCP), it connects seamlessly to any MCP-compliant AI IDE or agent interface:
Environment | Supported Tools | Setup Location |
AI IDEs | Cursor, Windsurf, Google Antigravity, Zed |
|
Extensions | GitHub Copilot / OpenAI Codex, Cline, Roo Code | VS Code MCP extension settings |
CLI Agents | Claude Code, OpenCode, Goose, Antigravity CLI ( | Global MCP configuration or CLI flags |
Desktop | Claude Desktop |
|
1. Cursor / Windsurf / Antigravity IDE
Add to your project's .cursor/mcp.json or .windsurf/mcp.json:
{
"mcpServers": {
"cocotb": {
"command": "node",
"args": ["/data/mxm6982/projects/personal-projects/mcp-cocotb/dist/index.js"]
}
}
}2. VS Code (GitHub Copilot / OpenAI Codex / Cline)
Add to your VS Code MCP settings or user configuration:
{
"mcpServers": {
"cocotb": {
"command": "node",
"args": ["/data/mxm6982/projects/personal-projects/mcp-cocotb/dist/index.js"]
}
}
}3. Claude Desktop & Claude Code
Add to claude_desktop_config.json:
{
"mcpServers": {
"cocotb": {
"command": "node",
"args": ["/path/to/personal-projects/mcp-cocotb/dist/index.js"]
}
}
}Verification & Testing
Run the full 6-gate verification suite:
./scripts/verify.shRun specific test tiers:
npm run test:unit # Fast unit tests (parsers & AST discovery)
npm test # Full test suite (including live container simulation)Available Tools
4 toolscocotb_generate_runnerB
Generates a deterministic, standard Cocotb simulation Makefile for a given Verilog DUT and Python test module.
| Name | Required | Description | Default |
|---|---|---|---|
| toplevel | Yes | Top-level Verilog module name. | |
| simulator | No | Simulator backend (default: 'icarus'). | |
| python_module | Yes | Python test module name (without .py). | |
| verilog_sources | Yes | List of Verilog source files. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden of behavioral disclosure. It mentions the output is 'deterministic' and 'standard', but does not disclose whether the tool writes a file to disk, returns Makefile content, overwrites existing files, or what side effects occur. This is a meaningful transparency gap for a generator tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single concise sentence that front-loads the core purpose and includes no filler or redundant phrasing. Every word contributes to the meaning.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
There is no output schema and no annotations, so the description should clarify what the caller receives. It is ambiguous whether 'generates' means writing a Makefile to disk or returning its contents, and there is no mention of file paths, overwrite behavior, or the deterministic output's meaning. The description is too thin for a tool an agent must invoke correctly without further context.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the input schema already documents all four parameters. The description adds the context that the tool targets a Verilog DUT and Python test module, which maps to the parameters, but it does not add deeper semantic detail beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description names a specific verb ('Generates'), a specific resource ('Cocotb simulation Makefile'), and key inputs ('Verilog DUT and Python test module'). This clearly differentiates the tool from its siblings like cocotb_run, which would execute simulations rather than create build artifacts.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided about when to use this tool versus alternatives such as cocotb_run or cocotb_list_tests. The description implies the tool is for producing a Makefile, but it does not state prerequisites, when generation is appropriate, or when another sibling should be chosen.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
cocotb_list_testsA
Discovers all @cocotb.test() coroutines and their docstrings in a Python testbench file without executing simulation.
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | Optional working directory. | |
| test_file | Yes | Path to the Python testbench file (e.g. 'test_dff.py'). |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the behavioral disclosure burden. It does disclose the main guarantee ('without executing simulation') and the scope of results, which is helpful. However, it omits the return format, whether the file is parsed versus imported (potential module-level side effects), and error behavior, leaving meaningful gaps.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single sentence states the operation, target, and key non-execution guarantee with no filler. Every word earns its place, and the structure is easy to scan.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple two-parameter tool, the description plus 100% schema coverage is nearly sufficient: it states what the tool returns conceptually (test coroutines and docstrings) and that it does not run simulation. It is missing an explicit routing note to cocotb_run and a precise output format, but the remaining gaps are minor.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so both test_file and cwd are already documented in the input schema. The description only reinforces that a Python testbench file is the target and adds no new parameter semantics, matching the baseline of 3.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb ('Discovers') and identifies the exact resource: all @cocotb.test() coroutines and their docstrings in a Python testbench file. The phrase 'without executing simulation' clearly separates it from siblings like cocotb_run, so an agent knows exactly what the tool does.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives clear usage context: use it when you need to inspect test cases and docstrings without running simulation. It does not explicitly name the alternative tool or provide when-not-to-use guidance, so it earns a 4 rather than a 5.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
cocotb_runA
Compiles a Verilog DUT, executes an asynchronous Python cocotb testbench, and parses results into structured JSON test reports with assertion tracebacks.
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | Working directory where the files reside. | |
| toplevel | Yes | Name of the top-level Verilog module. | |
| simulator | No | Simulator engine to use (default: 'icarus'). | |
| dump_waves | No | Whether to record VCD waveforms. | |
| timeout_ms | No | Maximum simulation timeout in milliseconds (default: 30000). | |
| python_module | Yes | Name of the Python test module (e.g. 'test_dff' for test_dff.py). | |
| verilog_sources | Yes | List of Verilog/SystemVerilog source files for the DUT. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It transparently states the main flow — compile, execute, parse — and even names the output shape. However, it omits side effects for a tool that compiles and runs external simulators: build artifacts, VCD files when dump_waves is set, spawned processes, timeout termination behavior, and compile-failure handling.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single well-structured sentence with zero filler. Each clause earns its place: compilation, execution, then result parsing with a specific output detail. The main action is front-loaded and the sentence is easily scannable.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a complex 7-parameter tool with no annotations and no output schema, the description covers the core flow and hints at the return value (JSON reports with tracebacks), which is a good start. But it is incomplete: no mention of prerequisites (simulator binaries, cocotb installation), filesystem side effects, failure modes, or how tests are discovered within python_module.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so every parameter already has a description, yielding a baseline of 3. The tool description adds marginal pipeline context (e.g., 'compiles the Verilog DUT' maps to verilog_sources and toplevel) but does not clarify parameter formats, defaults, or constraints beyond what the schema already provides.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description names three specific actions (compiles, executes, parses), specific resources (Verilog DUT, cocotb testbench), and a concrete output (structured JSON reports with assertion tracebacks). This clearly distinguishes it from siblings like cocotb_list_tests, cocotb_generate_runner, and cocotb_toolchain_info, which cover discovery, scaffolding, and environment info rather than the full simulation run.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The pipeline description implies usage: call this when you want to compile a DUT, run a testbench, and get JSON results. However, it never states when to prefer this over siblings (e.g., list tests first with cocotb_list_tests, generate a runner with cocotb_generate_runner) and gives no exclusions or prerequisites such as simulator installation.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
cocotb_toolchain_infoA
Returns active container or host execution runtime info and versions of Cocotb, Python, and simulator.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. The verb 'Returns' implies a read-only query with no side effects, which is reasonably transparent for a zero-parameter info tool. However, it does not explicitly state whether any environment setup or simulator connection is required, or how failures are reported.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single, front-loaded sentence that states the exact return value categories with no filler or repetition. Every word earns its place, and the structure is easy to scan.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool has zero parameters and no output schema, and the complexity is low. The description fully covers what the tool returns (runtime environment plus three version types), which is sufficient for an agent to call it correctly and interpret the result at a high level.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
There are zero parameters and schema coverage is trivially 100%, so no parameter documentation is needed. The description adds no parameter meaning, but none is required; the baseline of 4 applies.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb ('Returns') with a clear resource: active container/host runtime info and versions of Cocotb, Python, and simulator. It immediately identifies this as an info/query tool, which distinguishes it from the sibling tools that run tests, list tests, or generate runners.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description clearly implies the tool is for retrieving environment/version details, but it does not explicitly state when to choose it over alternatives or mention any exclusions. An agent can infer the use case from the return value description, but there is no explicit routing guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
4 tool updates
v0.1.0- First observed
cocotb_generate_runner - First observed
cocotb_list_tests - First observed
cocotb_run - First observed
cocotb_toolchain_info
TDQS
Each tool targets a distinct stage of the Cocotb workflow: test discovery, Makefile generation, simulation execution, and environment introspection. There is no meaningful overlap between the tools.
All tools share the cocotb_ prefix and mostly follow a verb_noun pattern. Minor deviations are cocotb_run (verb only) and cocotb_toolchain_info (noun phrase), but the names remain predictable and readable.
Four tools is well-scoped for a focused Cocotb simulation server. Each tool covers a necessary part of the workflow without redundancy or bloat.
The set provides end-to-end coverage: discover tests, generate a runner, execute simulations with parsed results, and inspect the runtime environment. No obvious core operation is missing for the stated domain.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Run, build, and validate firmware on virtual hardware from your AI agent. Hardware knowledge corpus.
Production-readiness for your AI coding agents.
Direct access to Cypress tests results and accessibility reports in your AI workflow.
Evaluate, benchmark, and simulate AI agents on the VerifyAX agent-evaluation platform.
Related MCP Servers
- AlicenseAqualityFmaintenanceEnables RTL simulation and hardware verification with Verilator through automatic testbench generation, natural language queries about simulations, waveform analysis, and protocol-aware testing for Verilog/SystemVerilog designs.44MIT
- FlicenseAqualityDmaintenanceEnables AI assistants to perform Electronic Design Automation (EDA) tasks including Verilog synthesis, simulation, ASIC design flows, and waveform analysis through a unified interface.6-
- AlicenseNot gradedqualityBmaintenanceProvides LLMs and AI agents safe, structured, read-only access to verification artifacts for deterministic triage and root-cause analysis. Supports UVM, cocotb, and SystemVerilog verification ecosystems.4Apache 2.0
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to parse and query VCD/FSDB simulation waveforms, search signals, analyze AXI transactions, render ASCII timing diagrams, and check protocol compliance through structured MCP tools.MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/zesun33/mcp-cocotb'
If you have feedback or need assistance with the MCP directory API, please join our Discord server