Skip to main content
Glama
Proteus-MCP

Proteus-MCP

by shfylqlby
README.md
# Proteus-MCP

**Model Context Protocol (MCP) server for Proteus 8 Professional EDA.**

Lets any MCP-capable AI agent — Claude Code, OpenCode, Cline, Cursor, Antigravity, Codex, Hermes — inspect `.pdsprj` projects, launch schematics, drive interactive simulation (F12 / Shift+F12 / Pause), search bundled sample circuits, and run batch SPICE netlists via `PROSPICE.EXE`.

No official Proteus API exists. This server automates the real application: it auto-detects the install through the Windows Registry, enumerates Proteus windows by process, sends Win32 virtual-key events, and reads `.pdsprj` files (ZIP archives) directly.

---

## Features

| Tool | What it does |
|------|--------------|
| `proteus_status` | Installed? running? active windows + PIDs |
| `proteus_launch` | Open Proteus, optionally load a `.pdsprj` |
| `proteus_start_sim` | Start / resume simulation (`F12`) |
| `proteus_stop_sim` | Stop simulation (`Shift+F12`) |
| `proteus_pause_sim` | Pause / unpause (`Pause`) |
| `proteus_inspect_project` | Read `.pdsprj` internals (XML, DSN, files) without the GUI |
| `proteus_list_samples` | Search installed sample projects |
| `proteus_close` | Graceful close (`WM_CLOSE`) or force kill |
| `proteus_run_prospice` | Batch SPICE on an `.sdf` netlist |

**Highlights**

- Dependency-light: only `psutil` (used to match windows to the `PDS.EXE` process).
- Auto-detects Proteus via registry (`HKLM\SOFTWARE\WOW6432Node\Labcenter Electronics\Proteus 8 Professional`), then falls back to standard install paths.
- Override with env vars `PROTEUS_HOME`, `PROTEUS_BIN`, `PROTEUS_DATA`.
- Pure stdio JSON-RPC 2.0 — works with every MCP client.
- Ships an agent **skill** (`skills/proteus-mcp/SKILL.md`) so agents know when and how to call the tools.

---

## Requirements

- **Windows** (Proteus 8 is Windows-only). Non-Windows hosts can still run the server for `proteus_inspect_project` / `proteus_list_samples` if paths are provided, but launch/simulation are Windows-only.
- **Python 3.8+**
- **Proteus 8 Professional** installed (tested on 8.13–8.15).

---

## Install

### From source (recommended until published to PyPI)

```powershell
git clone https://github.com/shfylqlby/Proteus-MCP.git
cd Proteus-MCP
pip install .
```

This installs the `proteus-mcp` console command. Verify:

```powershell
proteus-mcp --help    # not required; the server speaks stdio, not CLI flags
python -c "import proteus_mcp; print(proteus_mcp.__version__)"
```

You can also run it without installing, straight from a clone:

```powershell
python -m proteus_mcp
```

> `python -m proteus_mcp` runs the stdio server and waits for JSON-RPC input. It is normal for it to appear to "hang" — that is the protocol loop.

---

## Configure by harness

Every client below just needs to launch the same stdio command. Pick one form:

- Installed: `proteus-mcp`
- Module: `python -m proteus_mcp`
- Absolute script: `python C:\path\to\Proteus-MCP\proteus_mcp\server.py`

### Claude Code

```powershell
claude mcp add proteus -- python -m proteus_mcp
```

Or project/user scope with JSON (`~/.claude.json` → `mcpServers`):

```json
{
  "mcpServers": {
    "proteus": {
      "type": "stdio",
      "command": "python",
      "args": ["-m", "proteus_mcp"]
    }
  }
}
```

Verify inside Claude Code: `/mcp` → `proteus` should be connected.

### Claude Desktop

Edit `%APPDATA%\Claude\claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "proteus": {
      "command": "python",
      "args": ["-m", "proteus_mcp"]
    }
  }
}
```

Restart Claude Desktop fully (tray → Quit, then relaunch).

### OpenCode

`~/.config/opencode/opencode.json` (or project `opencode.json`):

```json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "proteus": {
      "type": "local",
      "command": ["python", "-m", "proteus_mcp"],
      "enabled": true
    }
  }
}
```

### Cline (VS Code extension)

Open the Cline panel → **MCP Servers** → **Configure MCP Servers** (edits `cline_mcp_settings.json`):

```json
{
  "mcpServers": {
    "proteus": {
      "command": "python",
      "args": ["-m", "proteus_mcp"],
      "disabled": false,
      "autoApprove": []
    }
  }
}
```

### Cursor

`%USERPROFILE%\.cursor\mcp.json` (global) or `.cursor/mcp.json` (project):

```json
{
  "mcpServers": {
    "proteus": {
      "command": "python",
      "args": ["-m", "proteus_mcp"]
    }
  }
}
```

Then **Cursor Settings → MCP** → toggle `proteus` on.

### Antigravity (Google)

Agent settings → **MCP Servers** → add a server with command `python`, args `["-m", "proteus_mcp"]`. Equivalent JSON where a config file is exposed:

```json
{
  "mcpServers": {
    "proteus": {
      "command": "python",
      "args": ["-m", "proteus_mcp"]
    }
  }
}
```

### Codex (OpenAI CLI)

`~/.codex/config.toml`:

```toml
[mcp_servers.proteus]
command = "python"
args = ["-m", "proteus_mcp"]
```

Verify: `codex mcp list` (or `/mcp` inside a Codex session).

### Hermes Agent

Two pieces: the MCP server **and** the skill.

1. **MCP server** — add to `%LOCALAPPDATA%\hermes\config.yaml`:

```yaml
mcp_servers:
  proteus:
    command: python
    args: ["-m", "proteus_mcp"]
```

Tools appear as `mcp_proteus_proteus_status`, etc.

2. **Skill** — copy the bundled skill into the Hermes skills dir:

```powershell
Copy-Item -Recurse .\skills\proteus-mcp "$env:LOCALAPPDATA\hermes\skills\proteus-mcp"
```

Hermes discovers `SKILL.md` + `skill-card.md` automatically. To make plain `python` resolvable inside Hermes, either use an absolute Python path in `command`, or add its `Scripts` dir to `mcp_servers.proteus.env.PATH`.

---

## Usage

Talk to your agent in natural language; it maps to tools:

- "cek status proteus" → `proteus_status`
- "buka C:\labs\counter.pdsprj" → `proteus_launch`
- "jalanin simulasinya" → `proteus_start_sim`
- "pause" → `proteus_pause_sim`
- "stop simulasinya" → `proteus_stop_sim`
- "cari sample arduino" → `proteus_list_samples(query="arduino")`
- "isi file project ini apa aja" → `proteus_inspect_project`
- "tutup proteus" → `proteus_close`

### Call tools directly (sanity check)

```python
import json, subprocess, sys

p = subprocess.Popen([sys.executable, "-m", "proteus_mcp"],
                     stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True)

def rpc(obj):
    p.stdin.write(json.dumps(obj) + "\n"); p.stdin.flush()
    return json.loads(p.stdout.readline())

rpc({"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {}})
print(rpc({"jsonrpc": "2.0", "id": 2, "method": "tools/call",
           "params": {"name": "proteus_status", "arguments": {}}})["result"]["content"][0]["text"])
p.terminate()
```

---

## Path detection & overrides

Resolution order for the install dir:

1. `PROTEUS_HOME` / `PROTEUS_BIN` env var
2. Windows Registry (`HKLM` 32-bit view → `HKLM` native → `HKCU`)
3. Standard paths: `C:\Program Files (x86)\Labcenter Electronics\Proteus 8 Professional`, plus `C:\Program Files\...` and `D:\...` variants

Samples dir: `PROTEUS_DATA` env var → registry `ProgramData` → `C:\ProgramData\Labcenter Electronics\Proteus 8 Professional\SAMPLES`.

Example override:

```powershell
$env:PROTEUS_HOME = "D:\Labcenter Electronics\Proteus 8 Professional"
```

---

## Troubleshooting

| Symptom | Fix |
|---------|-----|
| `installed: false` | Set `PROTEUS_HOME`; confirm `BIN\PDS.EXE` exists. |
| `Proteus is not running` on sim tools | Launch a schematic first; sim keys need an open capture window. |
| Simulation starts then stops instantly | Circuit has errors — check Proteus simulation log. |
| Tools missing in the agent | Re-check the MCP entry, restart the client, confirm `python -m proteus_mcp` starts. |
| `psutil` import error | `pip install psutil` |
| `python` not found inside a client | Use absolute interpreter path in the `command` field. |

---

## Development

```powershell
git clone https://github.com/shfylqlby/Proteus-MCP.git
cd Proteus-MCP
pip install -e .
python -m unittest discover -s tests -v
```

Layout:

```
proteus_mcp/
  __init__.py      # version
  __main__.py      # python -m proteus_mcp
  server.py        # stdio JSON-RPC server + tool handlers
skills/
  proteus-mcp/
    SKILL.md       # agent skill (Hermes / generic)
    skill-card.md  # Hermes skill card
tests/
  test_server.py   # protocol + tool tests
```

---

## License

MIT © 2026 Shofiyul Qalby