# UVM 1.2 MCP for Claude

An MCP (Model Context Protocol) server that gives Claude **source-code-level** knowledge of UVM 1.2 — the Universal Verification Methodology.

When active, Claude can browse actual UVM source files, trace class hierarchies, read method implementations, and retrieve curated expert insights — enabling answers far beyond what general documentation provides.

UVM 1.2 source code and the pre-built knowledge base are bundled in this repository. No additional downloads or build steps required.

---

## What Claude can do with this MCP

| Tool | What it does |
|------|-------------|
| `search_uvm_source` | Regex search across all `.sv` / `.svh` files |
| `get_uvm_class` | Full class source code |
| `get_uvm_class_hierarchy` | Ancestor / descendant tree |
| `list_uvm_class_methods` | All methods in a class |
| `get_uvm_method_source` | Exact method implementation |
| `list_uvm_classes` | Browse all 100+ UVM classes |
| `get_uvm_file` | Raw file content with line numbers |
| `list_uvm_files` | File tree by subsystem |
| `get_uvm_macro` | Macro definition from `uvm_macros.svh` |
| `semantic_search_uvm` | Natural-language search (RAG) |
| `explain_uvm_concept` | Deep dive combining source + expert knowledge |

---

## Requirements

- Python 3.10+
- ~200 MB free disk space (for the Python virtual environment)
- No GPU required
- No external API keys

---

## Installation

### 1. Clone the repository

```bash
git clone https://github.com/YOUR_USERNAME/UVM_MCP.git
cd UVM_MCP
```

### 2. Create a virtual environment and install dependencies

```bash
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
```

> The first run will automatically download the `all-MiniLM-L6-v2` embedding model (~90 MB).

---

## Configure Claude Code

Add the following to **`~/.claude/settings.json`** (create the file if it doesn't exist):

```json
{
  "mcpServers": {
    "uvm": {
      "command": "/absolute/path/to/UVM_MCP/.venv/bin/python",
      "args": ["/absolute/path/to/UVM_MCP/server.py"]
    }
  }
}
```

Replace `/absolute/path/to/UVM_MCP` with the actual path where you cloned the repo.

**Example** (if cloned to your home directory):

```json
{
  "mcpServers": {
    "uvm": {
      "command": "/Users/yourname/UVM_MCP/.venv/bin/python",
      "args": ["/Users/yourname/UVM_MCP/server.py"]
    }
  }
}
```

Restart Claude Code after saving.

---

## Verify

After restarting, open a new conversation and run:

```
/mcp
```

You should see `uvm` listed as a connected server.

Then try asking Claude:

> "Explain how `uvm_driver` communicates with the sequencer, and show me the relevant source code."

Claude will automatically call the UVM MCP tools to answer with actual source-level detail.

---

## UVM 1.2 Source

Source: [accellera/uvm @ UVM\_1\_2\_RELEASE](https://github.com/accellera/uvm/tree/UVM_1_2_RELEASE)  
License: Apache 2.0
