klayout-mcp
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., "@klayout-mcpopen 'chip.gds' and list all layers"
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.
klayout-mcp
Read-only MCP server for KLayout. It opens GDS/OAS layouts, inspects geometry and hierarchy, renders deterministic PNGs, and runs batch DRC with structured JSON output.
Install
Fastest one-off run:
uvx klayout-mcp@latestInstall once:
uv tool install klayout-mcpTraditional Python install:
python -m pip install klayout-mcpFor batch DRC, the klayout executable must be on PATH or exposed through KLAYOUT_BIN.
export KLAYOUT_BIN=/Applications/klayout.app/Contents/MacOS/klayoutRelated MCP server: mcp-kicad
Quick Start
klayout-mcp is a stdio MCP server. The default launch shape is:
command: uvx
args: klayout-mcp@latestIf your client cannot use uvx, install the tool once and launch klayout-mcp directly.
Typical workflow:
open_layoutlist_layerslist_cellsordescribe_cellquery_regionmeasure_geometryanalyze_waveguiderender_viewrun_drc_scriptextract_markersclose_session
Client Setup
More copy-paste examples live in examples/mcp/README.md.
Codex
[mcp_servers.klayout]
command = "uvx"
args = ["klayout-mcp@latest"]
[mcp_servers.klayout.env]
KLAYOUT_BIN = "/Applications/klayout.app/Contents/MacOS/klayout"Or add it with the CLI:
codex mcp add klayout \
--env KLAYOUT_BIN=/Applications/klayout.app/Contents/MacOS/klayout \
-- uvx klayout-mcp@latestClaude Code
{
"mcpServers": {
"klayout": {
"command": "uvx",
"args": ["klayout-mcp@latest"],
"env": {
"KLAYOUT_BIN": "/Applications/klayout.app/Contents/MacOS/klayout"
}
}
}
}Or add it with the CLI:
claude mcp add --transport stdio klayout \
--scope project \
--env KLAYOUT_BIN=/Applications/klayout.app/Contents/MacOS/klayout \
-- uvx klayout-mcp@latestCursor
Cursor is file-config based:
{
"mcpServers": {
"klayout": {
"command": "uvx",
"args": ["klayout-mcp@latest"],
"env": {
"KLAYOUT_BIN": "/Applications/klayout.app/Contents/MacOS/klayout"
}
}
}
}OpenCode
OpenCode is file-config based:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"klayout": {
"type": "local",
"command": ["uvx", "klayout-mcp@latest"],
"enabled": true,
"environment": {
"KLAYOUT_BIN": "/Applications/klayout.app/Contents/MacOS/klayout"
}
}
}
}Other MCP Hosts
Use:
command:uvxargs:["klayout-mcp@latest"]env:KLAYOUT_BINwhen needed
Tools
Session:
open_layout,close_sessionStructure:
list_layers,list_cells,describe_cellGeometry:
query_region,measure_geometry,analyze_waveguideView:
set_view,render_viewDRC:
run_drc_script,extract_markers
Configuration
Variable | Purpose | Default |
| Root directory for runtime artifacts |
|
| Session inactivity timeout |
|
| KLayout batch executable for DRC |
|
Behavior:
any absolute local path can be used for layouts and DRC scripts
artifact paths returned by tools are absolute
sessions expire lazily after inactivity
close_sessionremoves the session artifact directory
Artifacts And Errors
Artifacts are stored under .artifacts/sessions/<session_id>/ and include renders, DRC reports, marker crops, and logs.
Tool failures return structured JSON such as:
{
"code": "FILE_NOT_FOUND",
"message": "Layout file does not exist",
"details": {
"path": "/abs/path/to/missing.gds"
}
}Common codes: FILE_NOT_FOUND, SESSION_NOT_FOUND, INVALID_BOX, INVALID_LAYER, INVALID_TARGET, DRC_RUN_FAILED.
Development
For a source checkout:
uv sync --extra dev
uv run klayout-mcpIf an MCP client needs to launch the checkout directly:
command: uv
args: --directory /abs/path/to/klayout-mcp run klayout-mcpContributor workflow is in CONTRIBUTING.md. Release notes are in CHANGELOG.md.
Releases
Normal releases are automated with release-please.
merge Conventional Commits to
mainrelease-pleaseopens or updates a release PRmerging that release PR updates
pyproject.toml,CHANGELOG.md, creates the tag and GitHub release, and publishes to PyPI
To let the release PR run normal CI under branch protection, configure a repository secret named RELEASE_PLEASE_TOKEN with a GitHub token that can open pull requests. Without it, release-please falls back to github.token, which may not trigger PR workflows.
The manual release.yml workflow remains available for TestPyPI validation and recovery publishing.
Reference
Documentation Site
The repository is configured for Read the Docs with MkDocs.
Build the docs locally:
uv run --extra docs mkdocs build --strictServe the docs locally:
uv run --extra docs mkdocs serveAfter importing the GitHub repository into Read the Docs, it can build directly from the default branch using .readthedocs.yaml.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- 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/aycandv/klayout-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server