Setting up The MCP Server

Overview

PySilicon is being designed with agentic assistance to help build and simulate modules with the package. To use this facility, you will have to set up the model context protocol or MCP server. For now the setup is designed for users in VS Code. The process can be adapted for other IDEs such as Claude Code.

Set-Up

To set up the MCP server on VS Code, first follow the instructions to create and activate a virtual environment, then install pysilicon into that environment. You can install from a cloned pysilicon repository or from a published package source, as long as the environment you activate contains pysilicon.

Independent of where the virtual environment is installed, navigate to the root folder of the repository where you wish to work:

  • If you are an user working in a repository with own project, say my_hw_project, navigate to that repository;
  • If you are a PySilicon developer working on the pysilicon repository itself, navigate to the root of the pysilicon repository.

From there run:

pysilicon_mcp_setup --workspace .

The function will copy a file, .vscode/mcp.json to the repostitory root that VS Code uses a configuration file for the MCP server. If .vscode/mcp.json already exists, rerun the command with --force to replace it:

pysilicon_mcp_setup --workspace . --force

The setup command discovers its own interpreter path, verifies that pysilicon.mcp.server can be imported from that interpreter, and then writes .vscode/mcp.json for the workspace.

In most cases this command only needs to be run once per workspace. If you later recreate or move the virtual environment, rerun pysilicon_mcp_setup --workspace . so .vscode/mcp.json points to the new interpreter path.

After the command is run, you can launch VS Code from the command line:

code .

Testing the MCP Server is Running

The simplest way to confirm that the MCP server is running is:

  1. In VS Code, Open the Command Palette.
  2. Run MCP: List Servers.
  3. Select pysilicon.
  4. Choose Restart, or Stop and then Start.

After changing mcp.json or reinstalling packages, you can also use the above procedure to restart the server in VS Code:

You usually do not need to close and reopen VS Code unless you changed the environment after VS Code was already open.


Optional OpenAI-backed semantic search for schema examples is documented separately in rag.md.


This site uses Just the Docs, a documentation theme for Jekyll.