vivado-mcp-native 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vivado_mcp_native-0.2.0/LICENSE +21 -0
- vivado_mcp_native-0.2.0/PKG-INFO +248 -0
- vivado_mcp_native-0.2.0/README.md +219 -0
- vivado_mcp_native-0.2.0/__init__.py +67 -0
- vivado_mcp_native-0.2.0/__main__.py +23 -0
- vivado_mcp_native-0.2.0/doctor.py +163 -0
- vivado_mcp_native-0.2.0/pyproject.toml +51 -0
- vivado_mcp_native-0.2.0/server.py +2276 -0
- vivado_mcp_native-0.2.0/setup.cfg +4 -0
- vivado_mcp_native-0.2.0/vivado_mcp_native.egg-info/PKG-INFO +248 -0
- vivado_mcp_native-0.2.0/vivado_mcp_native.egg-info/SOURCES.txt +19 -0
- vivado_mcp_native-0.2.0/vivado_mcp_native.egg-info/dependency_links.txt +1 -0
- vivado_mcp_native-0.2.0/vivado_mcp_native.egg-info/entry_points.txt +5 -0
- vivado_mcp_native-0.2.0/vivado_mcp_native.egg-info/requires.txt +3 -0
- vivado_mcp_native-0.2.0/vivado_mcp_native.egg-info/top_level.txt +1 -0
- vivado_mcp_native-0.2.0/vivado_session.py +659 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Corey Hahn
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vivado-mcp-native
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Native cross-platform MCP server for AMD/Xilinx Vivado FPGA development
|
|
5
|
+
Author: Arthurzxy
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Arthurzxy/vivado_mcp_native
|
|
8
|
+
Project-URL: Repository, https://github.com/Arthurzxy/vivado_mcp_native
|
|
9
|
+
Project-URL: Issues, https://github.com/Arthurzxy/vivado_mcp_native/issues
|
|
10
|
+
Keywords: mcp,vivado,fpga,xilinx,amd,eda,ai
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: Microsoft :: Windows :: Windows 10
|
|
15
|
+
Classifier: Operating System :: Microsoft :: Windows :: Windows 11
|
|
16
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: mcp>=1.0.0
|
|
26
|
+
Requires-Dist: psutil>=5.9.0
|
|
27
|
+
Requires-Dist: typing-extensions>=4.6
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
# Vivado MCP Native
|
|
31
|
+
|
|
32
|
+
**English** | [简体中文](https://github.com/Arthurzxy/vivado_mcp_native/blob/master/README.zh-CN.md)
|
|
33
|
+
|
|
34
|
+
A cross-platform Model Context Protocol (MCP) server for **AMD/Xilinx Vivado**. It lets MCP-compatible AI clients start and manage Vivado, open projects, run synthesis and implementation, inspect timing and utilization, control simulation, and execute Tcl commands.
|
|
35
|
+
|
|
36
|
+
This project uses a persistent `subprocess` Tcl session that works natively on Windows and Linux. It does not depend on the Unix-only `pexpect` transport.
|
|
37
|
+
|
|
38
|
+
> [!IMPORTANT]
|
|
39
|
+
> Vivado is not included. Device support, licensed features, and available FPGA families are determined by the Vivado installation on the host machine.
|
|
40
|
+
|
|
41
|
+
> [!WARNING]
|
|
42
|
+
> The name `vivado-mcp` on PyPI belongs to a different project. Install this project as `vivado-mcp-native`.
|
|
43
|
+
|
|
44
|
+
## Highlights
|
|
45
|
+
|
|
46
|
+
- Native launch of Windows `vivado.bat` and `vivado.cmd` files.
|
|
47
|
+
- Direct Linux executable launch without an intermediate shell.
|
|
48
|
+
- One persistent Vivado Tcl process reused across MCP calls.
|
|
49
|
+
- UUID-framed command protocol that separates stdout, Tcl return values, return codes, and error stacks.
|
|
50
|
+
- UTF-8 hex transport for quotes, braces, backslashes, multiline Tcl, Unicode, and Windows paths.
|
|
51
|
+
- Full process-tree cleanup after command timeouts.
|
|
52
|
+
- Vivado discovery through `VIVADO_PATH`, PATH, and common installation directories.
|
|
53
|
+
- A `vivado-mcp-native-doctor` command for checking the local Python-to-Vivado connection.
|
|
54
|
+
|
|
55
|
+
## Requirements
|
|
56
|
+
|
|
57
|
+
| Component | Requirement |
|
|
58
|
+
|---|---|
|
|
59
|
+
| Operating system | Windows 10/11 or Linux |
|
|
60
|
+
| Python | 3.10–3.12 |
|
|
61
|
+
| Vivado | Local AMD/Xilinx Vivado installation |
|
|
62
|
+
| License | Appropriate for the operations and FPGA devices you use |
|
|
63
|
+
|
|
64
|
+
## Installation
|
|
65
|
+
|
|
66
|
+
### From PyPI — recommended
|
|
67
|
+
|
|
68
|
+
Install the isolated command-line application with `pipx`:
|
|
69
|
+
|
|
70
|
+
```powershell
|
|
71
|
+
py -m pip install --user --upgrade pipx
|
|
72
|
+
py -m pipx ensurepath
|
|
73
|
+
py -m pipx install vivado-mcp-native
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Linux:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
python3 -m pip install --user --upgrade pipx
|
|
80
|
+
python3 -m pipx ensurepath
|
|
81
|
+
python3 -m pipx install vivado-mcp-native
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Installed commands:
|
|
85
|
+
|
|
86
|
+
- `vivado-mcp-native` — start the MCP server;
|
|
87
|
+
- `vivado-mcp-native-doctor` — check the local Vivado connection;
|
|
88
|
+
- `vivado-mcp-win` and `vivado-mcp-win-doctor` — compatibility aliases.
|
|
89
|
+
|
|
90
|
+
### Install the latest source from GitHub
|
|
91
|
+
|
|
92
|
+
```powershell
|
|
93
|
+
py -m pipx install --force "https://github.com/Arthurzxy/vivado_mcp_native/archive/refs/heads/master.zip"
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Dedicated virtual environment
|
|
97
|
+
|
|
98
|
+
```powershell
|
|
99
|
+
$venv = "$env:LOCALAPPDATA\vivado-mcp-native"
|
|
100
|
+
py -3.11 -m venv $venv
|
|
101
|
+
& "$venv\Scripts\python.exe" -m pip install --upgrade pip
|
|
102
|
+
& "$venv\Scripts\python.exe" -m pip install --upgrade vivado-mcp-native
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Select the Vivado installation
|
|
106
|
+
|
|
107
|
+
`VIVADO_PATH` and the `start_session` tool's `vivado_path` argument may point to:
|
|
108
|
+
|
|
109
|
+
- the complete `vivado.bat`, `vivado.cmd`, `vivado.exe`, or Linux `vivado` launcher;
|
|
110
|
+
- the Vivado `bin` directory;
|
|
111
|
+
- the Vivado version directory.
|
|
112
|
+
|
|
113
|
+
Example:
|
|
114
|
+
|
|
115
|
+
```powershell
|
|
116
|
+
$env:VIVADO_PATH = "D:\Xilinx\Vivado\2025.2\bin\vivado.bat"
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Without an explicit path, the server checks PATH and common Windows locations such as:
|
|
120
|
+
|
|
121
|
+
```text
|
|
122
|
+
C:\Xilinx\Vivado\*\bin\vivado.bat
|
|
123
|
+
C:\AMD\Vivado\*\bin\vivado.bat
|
|
124
|
+
C:\Program Files\AMD\Vivado\*\bin\vivado.bat
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Check the Vivado connection
|
|
128
|
+
|
|
129
|
+
```powershell
|
|
130
|
+
vivado-mcp-native-doctor --vivado-path "D:\Xilinx\Vivado\2025.2\bin\vivado.bat"
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
The path may also be a Vivado `bin` directory or version directory. Machine-readable output is available with `--json`:
|
|
134
|
+
|
|
135
|
+
```powershell
|
|
136
|
+
vivado-mcp-native-doctor --vivado-path "D:\Xilinx\Vivado\2025.2" --json
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
The diagnostic command resolves the launcher, starts a persistent Tcl session, queries Vivado and Tcl versions, checks Tcl command transport and Unicode handling, verifies session health, and closes Vivado cleanly. It does not open or modify a user project.
|
|
140
|
+
|
|
141
|
+
## Configure an MCP client
|
|
142
|
+
|
|
143
|
+
Find the installed executable:
|
|
144
|
+
|
|
145
|
+
```powershell
|
|
146
|
+
(Get-Command vivado-mcp-native).Source
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Example configuration for a pipx installation:
|
|
150
|
+
|
|
151
|
+
```json
|
|
152
|
+
{
|
|
153
|
+
"mcpServers": {
|
|
154
|
+
"vivado": {
|
|
155
|
+
"command": "C:\\Users\\you\\.local\\bin\\vivado-mcp-native.exe",
|
|
156
|
+
"env": {
|
|
157
|
+
"VIVADO_PATH": "D:\\Xilinx\\Vivado\\2025.2\\bin\\vivado.bat"
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Example configuration for a virtual environment:
|
|
165
|
+
|
|
166
|
+
```json
|
|
167
|
+
{
|
|
168
|
+
"mcpServers": {
|
|
169
|
+
"vivado": {
|
|
170
|
+
"command": "C:\\Users\\you\\AppData\\Local\\vivado-mcp-native\\Scripts\\python.exe",
|
|
171
|
+
"args": ["-m", "vivado_mcp"],
|
|
172
|
+
"env": {
|
|
173
|
+
"VIVADO_PATH": "D:\\Xilinx\\Vivado\\2025.2\\bin\\vivado.bat"
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Using an absolute executable or Python path avoids depending on the MCP client's PATH environment.
|
|
181
|
+
|
|
182
|
+
## Capabilities
|
|
183
|
+
|
|
184
|
+
| Category | Representative tools | Purpose |
|
|
185
|
+
|---|---|---|
|
|
186
|
+
| Session management | `start_session`, `stop_session`, `session_status`, `get_host_status` | Start or stop Vivado and inspect session or host state |
|
|
187
|
+
| Project management | `open_project`, `close_project`, `get_project_info` | Open `.xpr` projects and read project information |
|
|
188
|
+
| Design flow | `run_synthesis`, `run_implementation`, `generate_bitstream` | Run synthesis, place-and-route, and bitstream generation |
|
|
189
|
+
| Reports | `get_timing_summary`, `get_timing_paths`, `get_utilization`, `get_clocks`, `get_messages` | Read timing, resource, clock, and message reports |
|
|
190
|
+
| Design queries | `get_design_hierarchy`, `get_ports`, `get_nets`, `get_cells` | Inspect hierarchy, ports, nets, and cells |
|
|
191
|
+
| Simulation | `launch_simulation`, `run_simulation`, `restart_simulation`, `get_signal_value` | Control xsim and inspect signals |
|
|
192
|
+
| Advanced | `run_tcl`, `generate_full_report`, `read_report_section` | Execute Tcl and read large reports |
|
|
193
|
+
|
|
194
|
+
## Architecture
|
|
195
|
+
|
|
196
|
+
```text
|
|
197
|
+
MCP-compatible client
|
|
198
|
+
│ MCP / stdio
|
|
199
|
+
▼
|
|
200
|
+
Vivado MCP server
|
|
201
|
+
│ persistent subprocess Tcl session
|
|
202
|
+
▼
|
|
203
|
+
AMD/Xilinx Vivado -mode tcl
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Each command is transported as UTF-8 hex and wrapped with unique markers. The server extracts stdout, the Tcl result, return code, and error stack without relying on the localized `Vivado%` prompt.
|
|
207
|
+
|
|
208
|
+
## Troubleshooting
|
|
209
|
+
|
|
210
|
+
### Vivado does not start
|
|
211
|
+
|
|
212
|
+
Verify the launcher directly:
|
|
213
|
+
|
|
214
|
+
```powershell
|
|
215
|
+
& "D:\Xilinx\Vivado\2025.2\bin\vivado.bat" -mode tcl
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Then run `vivado-mcp-native-doctor` and check the path, installation, permissions, environment, and license configuration.
|
|
219
|
+
|
|
220
|
+
### Chinese output is corrupted
|
|
221
|
+
|
|
222
|
+
Override the Windows output decoder when necessary:
|
|
223
|
+
|
|
224
|
+
```powershell
|
|
225
|
+
$env:VIVADO_MCP_OUTPUT_ENCODING = "gbk"
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Use `utf-8`, `gbk`, or the encoding that matches the Vivado Tcl console.
|
|
229
|
+
|
|
230
|
+
### A command times out
|
|
231
|
+
|
|
232
|
+
The server terminates the Vivado process tree after a timeout to avoid a desynchronized session. Start a new session and use a larger timeout for long synthesis or implementation runs.
|
|
233
|
+
|
|
234
|
+
More Windows guidance is available in [`WINDOWS_INSTALL.md`](WINDOWS_INSTALL.md).
|
|
235
|
+
|
|
236
|
+
## Security
|
|
237
|
+
|
|
238
|
+
`run_tcl` can execute arbitrary Tcl with the current user's permissions, including file operations and external process launches. Expose this server only to trusted MCP clients and review high-impact commands and paths.
|
|
239
|
+
|
|
240
|
+
## License
|
|
241
|
+
|
|
242
|
+
This project is available under the [MIT License](LICENSE).
|
|
243
|
+
|
|
244
|
+
## Acknowledgments
|
|
245
|
+
|
|
246
|
+
- Original project created by Corey Hahn.
|
|
247
|
+
- Built on the [Model Context Protocol](https://modelcontextprotocol.io/).
|
|
248
|
+
- Integrates with [AMD/Xilinx Vivado](https://www.amd.com/en/products/software/adaptive-socs-and-fpgas/vivado.html).
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
# Vivado MCP Native
|
|
2
|
+
|
|
3
|
+
**English** | [简体中文](https://github.com/Arthurzxy/vivado_mcp_native/blob/master/README.zh-CN.md)
|
|
4
|
+
|
|
5
|
+
A cross-platform Model Context Protocol (MCP) server for **AMD/Xilinx Vivado**. It lets MCP-compatible AI clients start and manage Vivado, open projects, run synthesis and implementation, inspect timing and utilization, control simulation, and execute Tcl commands.
|
|
6
|
+
|
|
7
|
+
This project uses a persistent `subprocess` Tcl session that works natively on Windows and Linux. It does not depend on the Unix-only `pexpect` transport.
|
|
8
|
+
|
|
9
|
+
> [!IMPORTANT]
|
|
10
|
+
> Vivado is not included. Device support, licensed features, and available FPGA families are determined by the Vivado installation on the host machine.
|
|
11
|
+
|
|
12
|
+
> [!WARNING]
|
|
13
|
+
> The name `vivado-mcp` on PyPI belongs to a different project. Install this project as `vivado-mcp-native`.
|
|
14
|
+
|
|
15
|
+
## Highlights
|
|
16
|
+
|
|
17
|
+
- Native launch of Windows `vivado.bat` and `vivado.cmd` files.
|
|
18
|
+
- Direct Linux executable launch without an intermediate shell.
|
|
19
|
+
- One persistent Vivado Tcl process reused across MCP calls.
|
|
20
|
+
- UUID-framed command protocol that separates stdout, Tcl return values, return codes, and error stacks.
|
|
21
|
+
- UTF-8 hex transport for quotes, braces, backslashes, multiline Tcl, Unicode, and Windows paths.
|
|
22
|
+
- Full process-tree cleanup after command timeouts.
|
|
23
|
+
- Vivado discovery through `VIVADO_PATH`, PATH, and common installation directories.
|
|
24
|
+
- A `vivado-mcp-native-doctor` command for checking the local Python-to-Vivado connection.
|
|
25
|
+
|
|
26
|
+
## Requirements
|
|
27
|
+
|
|
28
|
+
| Component | Requirement |
|
|
29
|
+
|---|---|
|
|
30
|
+
| Operating system | Windows 10/11 or Linux |
|
|
31
|
+
| Python | 3.10–3.12 |
|
|
32
|
+
| Vivado | Local AMD/Xilinx Vivado installation |
|
|
33
|
+
| License | Appropriate for the operations and FPGA devices you use |
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
### From PyPI — recommended
|
|
38
|
+
|
|
39
|
+
Install the isolated command-line application with `pipx`:
|
|
40
|
+
|
|
41
|
+
```powershell
|
|
42
|
+
py -m pip install --user --upgrade pipx
|
|
43
|
+
py -m pipx ensurepath
|
|
44
|
+
py -m pipx install vivado-mcp-native
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Linux:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
python3 -m pip install --user --upgrade pipx
|
|
51
|
+
python3 -m pipx ensurepath
|
|
52
|
+
python3 -m pipx install vivado-mcp-native
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Installed commands:
|
|
56
|
+
|
|
57
|
+
- `vivado-mcp-native` — start the MCP server;
|
|
58
|
+
- `vivado-mcp-native-doctor` — check the local Vivado connection;
|
|
59
|
+
- `vivado-mcp-win` and `vivado-mcp-win-doctor` — compatibility aliases.
|
|
60
|
+
|
|
61
|
+
### Install the latest source from GitHub
|
|
62
|
+
|
|
63
|
+
```powershell
|
|
64
|
+
py -m pipx install --force "https://github.com/Arthurzxy/vivado_mcp_native/archive/refs/heads/master.zip"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Dedicated virtual environment
|
|
68
|
+
|
|
69
|
+
```powershell
|
|
70
|
+
$venv = "$env:LOCALAPPDATA\vivado-mcp-native"
|
|
71
|
+
py -3.11 -m venv $venv
|
|
72
|
+
& "$venv\Scripts\python.exe" -m pip install --upgrade pip
|
|
73
|
+
& "$venv\Scripts\python.exe" -m pip install --upgrade vivado-mcp-native
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Select the Vivado installation
|
|
77
|
+
|
|
78
|
+
`VIVADO_PATH` and the `start_session` tool's `vivado_path` argument may point to:
|
|
79
|
+
|
|
80
|
+
- the complete `vivado.bat`, `vivado.cmd`, `vivado.exe`, or Linux `vivado` launcher;
|
|
81
|
+
- the Vivado `bin` directory;
|
|
82
|
+
- the Vivado version directory.
|
|
83
|
+
|
|
84
|
+
Example:
|
|
85
|
+
|
|
86
|
+
```powershell
|
|
87
|
+
$env:VIVADO_PATH = "D:\Xilinx\Vivado\2025.2\bin\vivado.bat"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Without an explicit path, the server checks PATH and common Windows locations such as:
|
|
91
|
+
|
|
92
|
+
```text
|
|
93
|
+
C:\Xilinx\Vivado\*\bin\vivado.bat
|
|
94
|
+
C:\AMD\Vivado\*\bin\vivado.bat
|
|
95
|
+
C:\Program Files\AMD\Vivado\*\bin\vivado.bat
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Check the Vivado connection
|
|
99
|
+
|
|
100
|
+
```powershell
|
|
101
|
+
vivado-mcp-native-doctor --vivado-path "D:\Xilinx\Vivado\2025.2\bin\vivado.bat"
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
The path may also be a Vivado `bin` directory or version directory. Machine-readable output is available with `--json`:
|
|
105
|
+
|
|
106
|
+
```powershell
|
|
107
|
+
vivado-mcp-native-doctor --vivado-path "D:\Xilinx\Vivado\2025.2" --json
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
The diagnostic command resolves the launcher, starts a persistent Tcl session, queries Vivado and Tcl versions, checks Tcl command transport and Unicode handling, verifies session health, and closes Vivado cleanly. It does not open or modify a user project.
|
|
111
|
+
|
|
112
|
+
## Configure an MCP client
|
|
113
|
+
|
|
114
|
+
Find the installed executable:
|
|
115
|
+
|
|
116
|
+
```powershell
|
|
117
|
+
(Get-Command vivado-mcp-native).Source
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Example configuration for a pipx installation:
|
|
121
|
+
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"mcpServers": {
|
|
125
|
+
"vivado": {
|
|
126
|
+
"command": "C:\\Users\\you\\.local\\bin\\vivado-mcp-native.exe",
|
|
127
|
+
"env": {
|
|
128
|
+
"VIVADO_PATH": "D:\\Xilinx\\Vivado\\2025.2\\bin\\vivado.bat"
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Example configuration for a virtual environment:
|
|
136
|
+
|
|
137
|
+
```json
|
|
138
|
+
{
|
|
139
|
+
"mcpServers": {
|
|
140
|
+
"vivado": {
|
|
141
|
+
"command": "C:\\Users\\you\\AppData\\Local\\vivado-mcp-native\\Scripts\\python.exe",
|
|
142
|
+
"args": ["-m", "vivado_mcp"],
|
|
143
|
+
"env": {
|
|
144
|
+
"VIVADO_PATH": "D:\\Xilinx\\Vivado\\2025.2\\bin\\vivado.bat"
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Using an absolute executable or Python path avoids depending on the MCP client's PATH environment.
|
|
152
|
+
|
|
153
|
+
## Capabilities
|
|
154
|
+
|
|
155
|
+
| Category | Representative tools | Purpose |
|
|
156
|
+
|---|---|---|
|
|
157
|
+
| Session management | `start_session`, `stop_session`, `session_status`, `get_host_status` | Start or stop Vivado and inspect session or host state |
|
|
158
|
+
| Project management | `open_project`, `close_project`, `get_project_info` | Open `.xpr` projects and read project information |
|
|
159
|
+
| Design flow | `run_synthesis`, `run_implementation`, `generate_bitstream` | Run synthesis, place-and-route, and bitstream generation |
|
|
160
|
+
| Reports | `get_timing_summary`, `get_timing_paths`, `get_utilization`, `get_clocks`, `get_messages` | Read timing, resource, clock, and message reports |
|
|
161
|
+
| Design queries | `get_design_hierarchy`, `get_ports`, `get_nets`, `get_cells` | Inspect hierarchy, ports, nets, and cells |
|
|
162
|
+
| Simulation | `launch_simulation`, `run_simulation`, `restart_simulation`, `get_signal_value` | Control xsim and inspect signals |
|
|
163
|
+
| Advanced | `run_tcl`, `generate_full_report`, `read_report_section` | Execute Tcl and read large reports |
|
|
164
|
+
|
|
165
|
+
## Architecture
|
|
166
|
+
|
|
167
|
+
```text
|
|
168
|
+
MCP-compatible client
|
|
169
|
+
│ MCP / stdio
|
|
170
|
+
▼
|
|
171
|
+
Vivado MCP server
|
|
172
|
+
│ persistent subprocess Tcl session
|
|
173
|
+
▼
|
|
174
|
+
AMD/Xilinx Vivado -mode tcl
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Each command is transported as UTF-8 hex and wrapped with unique markers. The server extracts stdout, the Tcl result, return code, and error stack without relying on the localized `Vivado%` prompt.
|
|
178
|
+
|
|
179
|
+
## Troubleshooting
|
|
180
|
+
|
|
181
|
+
### Vivado does not start
|
|
182
|
+
|
|
183
|
+
Verify the launcher directly:
|
|
184
|
+
|
|
185
|
+
```powershell
|
|
186
|
+
& "D:\Xilinx\Vivado\2025.2\bin\vivado.bat" -mode tcl
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Then run `vivado-mcp-native-doctor` and check the path, installation, permissions, environment, and license configuration.
|
|
190
|
+
|
|
191
|
+
### Chinese output is corrupted
|
|
192
|
+
|
|
193
|
+
Override the Windows output decoder when necessary:
|
|
194
|
+
|
|
195
|
+
```powershell
|
|
196
|
+
$env:VIVADO_MCP_OUTPUT_ENCODING = "gbk"
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Use `utf-8`, `gbk`, or the encoding that matches the Vivado Tcl console.
|
|
200
|
+
|
|
201
|
+
### A command times out
|
|
202
|
+
|
|
203
|
+
The server terminates the Vivado process tree after a timeout to avoid a desynchronized session. Start a new session and use a larger timeout for long synthesis or implementation runs.
|
|
204
|
+
|
|
205
|
+
More Windows guidance is available in [`WINDOWS_INSTALL.md`](WINDOWS_INSTALL.md).
|
|
206
|
+
|
|
207
|
+
## Security
|
|
208
|
+
|
|
209
|
+
`run_tcl` can execute arbitrary Tcl with the current user's permissions, including file operations and external process launches. Expose this server only to trusted MCP clients and review high-impact commands and paths.
|
|
210
|
+
|
|
211
|
+
## License
|
|
212
|
+
|
|
213
|
+
This project is available under the [MIT License](LICENSE).
|
|
214
|
+
|
|
215
|
+
## Acknowledgments
|
|
216
|
+
|
|
217
|
+
- Original project created by Corey Hahn.
|
|
218
|
+
- Built on the [Model Context Protocol](https://modelcontextprotocol.io/).
|
|
219
|
+
- Integrates with [AMD/Xilinx Vivado](https://www.amd.com/en/products/software/adaptive-socs-and-fpgas/vivado.html).
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Vivado MCP Native - Direct integration with AMD/Xilinx Vivado.
|
|
3
|
+
|
|
4
|
+
This package provides a Model Context Protocol (MCP) server that allows
|
|
5
|
+
AI assistants to interact with AMD/Xilinx Vivado FPGA development tools.
|
|
6
|
+
|
|
7
|
+
Features:
|
|
8
|
+
- Session Management: Start/stop persistent Vivado Tcl sessions
|
|
9
|
+
- Project Management: Open/close Vivado projects (.xpr files)
|
|
10
|
+
- Design Flow: Run synthesis, implementation, and bitstream generation
|
|
11
|
+
- Reports: Get timing summaries, utilization, and design analysis
|
|
12
|
+
- Design Queries: Explore design hierarchy, ports, nets, and cells
|
|
13
|
+
- Simulation: Control Vivado's integrated simulator (xsim)
|
|
14
|
+
- Raw Tcl: Execute arbitrary Vivado Tcl commands
|
|
15
|
+
|
|
16
|
+
Installation:
|
|
17
|
+
pip install vivado-mcp-native
|
|
18
|
+
|
|
19
|
+
Or install the isolated application with pipx:
|
|
20
|
+
pipx install vivado-mcp-native
|
|
21
|
+
|
|
22
|
+
Usage:
|
|
23
|
+
The server is typically launched by an MCP client.
|
|
24
|
+
|
|
25
|
+
Main commands:
|
|
26
|
+
- vivado-mcp-native
|
|
27
|
+
- vivado-mcp-native-doctor
|
|
28
|
+
|
|
29
|
+
Compatibility aliases:
|
|
30
|
+
- vivado-mcp-win
|
|
31
|
+
- vivado-mcp-win-doctor
|
|
32
|
+
|
|
33
|
+
The package can also be started with:
|
|
34
|
+
python -m vivado_mcp
|
|
35
|
+
|
|
36
|
+
Example workflow:
|
|
37
|
+
1. start_session - Launch Vivado
|
|
38
|
+
2. open_project - Open a .xpr file
|
|
39
|
+
3. run_synthesis - Synthesize the design
|
|
40
|
+
4. get_timing_summary - Check if timing is met
|
|
41
|
+
5. get_utilization - Check resource usage
|
|
42
|
+
6. stop_session - Clean up
|
|
43
|
+
|
|
44
|
+
Requirements:
|
|
45
|
+
- Python 3.10+
|
|
46
|
+
- mcp>=1.0.0
|
|
47
|
+
- psutil>=5.9.0
|
|
48
|
+
- AMD/Xilinx Vivado installed locally
|
|
49
|
+
|
|
50
|
+
Author: Arthurzxy
|
|
51
|
+
License: MIT
|
|
52
|
+
Version: 0.2.0
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
import asyncio
|
|
56
|
+
|
|
57
|
+
from .server import main as _async_main
|
|
58
|
+
|
|
59
|
+
__version__ = "0.2.0"
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def main():
|
|
63
|
+
"""Start the Vivado MCP Native stdio server."""
|
|
64
|
+
asyncio.run(_async_main())
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
__all__ = ["main", "__version__"]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Entry point for running the Vivado MCP server as a module.
|
|
3
|
+
|
|
4
|
+
This allows running the server with:
|
|
5
|
+
python -m vivado_mcp
|
|
6
|
+
|
|
7
|
+
Which is equivalent to:
|
|
8
|
+
vivado-mcp (after pip install)
|
|
9
|
+
|
|
10
|
+
The server communicates via stdin/stdout using the MCP protocol,
|
|
11
|
+
so it's typically launched by an MCP client like Claude Code rather
|
|
12
|
+
than run directly from the command line.
|
|
13
|
+
|
|
14
|
+
For testing, you can run it directly, but you'll need to send
|
|
15
|
+
properly formatted JSON-RPC messages to stdin.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
import asyncio
|
|
19
|
+
from .server import main
|
|
20
|
+
|
|
21
|
+
# Run the async main function when this module is executed directly
|
|
22
|
+
if __name__ == "__main__":
|
|
23
|
+
asyncio.run(main())
|