analog_circuit_simulate_mcp_server

abelzhao/analog_circuit_simulate_mcp_server

3.1

If you are the rightful owner of analog_circuit_simulate_mcp_server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

A Model Context Protocol (MCP) server designed for analog circuit simulation, providing tools and interfaces for efficient simulation management.

analog-circuit-simulate-mcp-server

A Model Context Protocol (MCP) server for analog circuit simulation

Features

  • Provides MCP tools for running analog circuit simulations
  • REST API interface for simulation control
  • Supports parameterized circuit simulations
  • Returns simulation results in JSON format

Installation Guide (Linux only)

  1. Install ngspice (required for simulation backend):

    sudo apt-get install ngspice  # For Debian/Ubuntu systems
    
  2. Ensure Python 3.8+ is installed (see .python-version file) and install uv tool:

    pip install uv
    
  3. Create and activate virtual environment:

    uv venv .venv
    source .venv/bin/activate  # Linux/macOS
    
  4. Install dependencies using different methods:

    • Direct installation with uv:
      uv pip install -e .
      
    • Build with uv then install:
      uv build && pip install dist/analog_circuit_simulate_mcp_server-${version}-py3-none-any.whl
      # or uv build && pip install dist/analog_circuit_simulate_mcp_server-${version}.tar.gz
      
    • Traditional pip installation:
      pip install -e .
      

Usage

Starting the Server

Different ways to run the server:

  • Using uv run:
    uv run analog-circuit-simulate-mcp-server
    
  • Using uvx (requires uvx installation):
    uvx --from https://github.com/abelzhao/analog_circuit_simulate_mcp_server.git analog-circuit-simulate-mcp-server
    

NPX Configuration

{
  "mcpServers": {
    "ngspice-mcp-server": {
      "command": "uvx",
      "args": [
        "http://${server_ip}:4044/mcp/"
      ]
    }
  }
}

Configuration Options

Server configuration can be modified in .venv:

  • FASTMCP_PORT=4044
  • FASTMCP_JSON_RESPONSE=True

Development Guide

analog-circuit-simulate-mcp-server Project Structure

.
ā”œā”€ā”€ .gitignore
ā”œā”€ā”€ .python-version
ā”œā”€ā”€ high_pass_filter.cir         # Example circuit file
ā”œā”€ā”€ pyproject.toml              # Python project configuration
ā”œā”€ā”€ README.md                   # English documentation
ā”œā”€ā”€ README.zh-CN.md             # Chinese documentation
ā”œā”€ā”€ uv.lock                     # UV dependency lock file
ā”œā”€ā”€ build/                      # Build directory
└── src/                        # Source code directory
    └── analog_circuit_simulate_mcp_server/     # Main package source
        ā”œā”€ā”€ __init__.py         # Package initialization
        ā”œā”€ā”€ __main__.py         # CLI entry point
        ā”œā”€ā”€ server.py           # MCP server implementation
        └── simulate.py         # Simulation logic

File Descriptions

  • high_pass_filter.cir: Example circuit file for circuit simulation demo
  • src/analog_circuit_simulate_mcp_server/server.py: Contains MCP server implementation and REST API interface
  • src/analog_circuit_simulate_mcp_server/simulate.py: Contains circuit simulation logic and result processing
  • pyproject.toml: Defines Python package metadata, dependencies and build configuration

NPX

{
  "mcpServers": {
    "analog-circuit-simulate-mcp-server": {
      "command": "uvx",
      "args": [
        "http://${server_ip}:4044/mcp/"
      ]
    }
  }
}

Testing

Run test suite:

pytest

License

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.