Skip to main content
Glama
Shaoqigit

pyNastran MCP Server

by Shaoqigit

pyNastran MCP Server

Python 3.10+ License: MIT MCP

A Model Context Protocol (MCP) Server for pyNastran, built with FastMCP. Enables AI agents to interact with Nastran FEA models.

Features

  • šŸ”§ BDF Tools: Read, write, and analyze Nastran input files

  • šŸ“Š OP2 Tools: Extract results from Nastran output files

  • šŸ” Geometry Tools: Mesh quality checks and geometric analysis

  • šŸ“ Analysis Tools: Automated report generation

  • šŸš€ FastMCP: Built with modern FastMCP framework

  • 🌐 Multiple Transports: stdio, SSE, and streamable-http

Related MCP server: COMSOL MCP Server

Installation

pip install pynastran-mcp

Or install from source:

git clone https://github.com/Shaoqigit/pynastran-mcp.git
cd pynastran-mcp
pip install -e .

Quick Start

Stdio Transport (Default)

For MCP clients like Cherry Studio, Claude Desktop:

pynastran-mcp

SSE Transport

# Default: host=127.0.0.1, port=8080
pynastran-mcp --transport sse

# Custom host and port
pynastran-mcp --transport sse --host 0.0.0.0 --port 8080

Streamable HTTP Transport (Production)

# Default: host=127.0.0.1, port=8080
pynastran-mcp --transport streamable-http

# Custom host and port
pynastran-mcp --transport streamable-http --host 0.0.0.0 --port 8080

MCP Client Configuration

Cherry Studio / Cursor / Claude Desktop

Add to your MCP client configuration:

{
  "mcpServers": {
    "pynastran": {
      "command": "pynastran-mcp"
    }
  }
}

See CHERRY_STUDIO_TUTORIAL.md for detailed setup instructions.

Available Tools

BDF Tools

Tool

Description

read_bdf

Read BDF file and return model summary

get_model_info

Get detailed model information

write_bdf

Write model to new BDF file

get_nodes

Get node coordinates

get_elements

Get element connectivity

get_materials

Get material properties

get_properties

Get property definitions

OP2 Tools

Tool

Description

read_op2

Read OP2 result file

get_result_cases

List available result cases

get_stress

Extract stress results

get_displacement

Extract displacement results

Geometry Tools

Tool

Description

check_mesh_quality

Check mesh quality metrics

get_model_bounds

Get model bounding box

Analysis Tools

Tool

Description

generate_report

Generate comprehensive analysis report

Usage Examples

With AI Agents

Once configured, you can ask your AI assistant:

"Read the BDF file at /path/to/model.bdf and tell me about the mesh"
"Analyze the stress results from /path/to/results.op2"
"Check the mesh quality and suggest improvements"
"Generate a report for my Nastran model"

Programmatic Usage

from pynastran_mcp.tools.bdf_tools import BdfTools
from pynastran_mcp.tools.op2_tools import Op2Tools

async def analyze_model():
    # BDF Analysis
    bdf_tools = BdfTools()
    summary = await bdf_tools.read_bdf("wing.bdf")
    print(summary)
    
    # OP2 Results
    op2_tools = Op2Tools()
    stresses = await op2_tools.get_stress("results.op2", element_type="CQUAD4")
    print(stresses)

Project Structure

pynastran-mcp/
ā”œā”€ā”€ pynastran_mcp/
│   ā”œā”€ā”€ __init__.py
│   ā”œā”€ā”€ server.py          # FastMCP server with all tools
│   └── tools/
│       ā”œā”€ā”€ __init__.py
│       ā”œā”€ā”€ bdf_tools.py   # BDF file operations
│       ā”œā”€ā”€ op2_tools.py   # OP2 result operations
│       ā”œā”€ā”€ geometry_tools.py  # Mesh quality checks
│       └── analysis_tools.py  # Report generation
ā”œā”€ā”€ pyproject.toml
ā”œā”€ā”€ README.md
└── examples/
    └── example_usage.py

Requirements

  • Python 3.10+

  • pyNastran >= 1.4.0

  • mcp >= 1.0.0 (with FastMCP)

Development

# Setup
git clone https://github.com/Shaoqigit/pynastran-mcp.git
cd pynastran-mcp
pip install -e ".[dev]"

# Run tests
pytest

# Code formatting
black pynastran_mcp/

License

MIT License - see LICENSE file

Acknowledgments

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository

  2. Create your feature branch (git checkout -b feature/amazing-feature)

  3. Commit your changes (git commit -m 'Add some amazing feature')

  4. Push to the branch (git push origin feature/amazing-feature)

  5. Open a Pull Request

Please make sure to update tests as appropriate and follow the existing code style.

A
license - permissive license
Not graded
quality - not tested
C
maintenance

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    MCP server that exposes CAD geometry reasoning over STEP files to LLMs, allowing natural language queries about parts, assemblies, dimensions, holes, and mass properties.
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables natural language interaction with ANSYS Mechanical simulation software via gRPC, allowing users to manage geometry, mesh, boundary conditions, solve analyses, and generate reports through MCP-compatible AI clients.
    11
    Apache 2.0
  • A
    license
    Not graded
    quality
    C
    maintenance
    An MCP server that enables controlling a live Abaqus/CAE session through natural language, allowing model inspection, job submission, ODB analysis, and viewport capture.
    MIT

View all related MCP servers

Related MCP Connectors

  • MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.

  • MCP Server for Slima - AI Writing IDE for Novel Authors with AI Beta Reader.

  • MCP server for secureFlows: token-free URL builders and integration-linting tools for AI agents.

View all MCP Connectors

Latest Blog Posts

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/Shaoqigit/pynastran-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server