ngspice-mcp logo

ngspice-mcp

by gtnoble

ngspice-mcp is a Model Context Protocol (MCP) server that provides access to ngspice circuit simulation functionality through a standardized protocol interface. This server enables AI language models to interact with ngspice in a controlled and structured way.

View on GitHub

Last updated: N/A

What is ngspice-mcp?

ngspice-mcp is a Model Context Protocol (MCP) server designed to provide a standardized interface for accessing ngspice circuit simulation capabilities. It allows external applications, particularly AI language models, to interact with ngspice in a controlled and structured manner, facilitating automated circuit analysis and design.

How to use ngspice-mcp?

To use ngspice-mcp, first ensure you have the required dependencies installed, including a D compiler (DMD/LDC), the ngspice shared library, the d-mcp-server library, and the D build system (dub). Clone the repository, build the server using dub build --config=server, and then start the server with ./ngspice-mcp [options]. You can then use the available tools, such as loadCircuit, runSimulation, and getVectorData, to load circuits, execute simulations, and access simulation results.

Key features of ngspice-mcp

  • Integration with ngspice's shared library interface

  • Standardized MCP protocol implementation

  • Synchronous operation with structured data access

  • Comprehensive output capture and redirection

  • Vector data handling with multiple representation formats

  • Support for both server and library usage modes

  • Built-in test suite

Use cases of ngspice-mcp

  • Automated circuit analysis by AI language models

  • Remote execution of ngspice simulations

  • Integration of ngspice with other software tools

  • Development of custom circuit simulation workflows

FAQ from ngspice-mcp

What is MCP?

MCP stands for Model Context Protocol, a standardized protocol for interacting with simulation models.

What compilers are supported?

The server supports DMD and LDC D compilers.

How do I load a circuit?

Use the loadCircuit tool to load netlists directly or loadNetlistFromFile to load from a file.

How do I run a simulation?

Use the runSimulation tool with commands like op, dc, ac, or tran.

How do I access simulation data?

Use getPlotNames to list plots, getVectorNames to list vectors, and getVectorData to retrieve vector data in various formats.