pyNastran MCP Server
An MCP server that enables AI agents to interact with Nastran FEA models by reading, writing, and analyzing BDF and OP2 files. It provides tools for mesh quality assessment, geometric analysis, and automated report generation for structural engineering workflows.
README
pyNastran MCP Server
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
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
- pyNastran - The underlying Nastran interface library
- MCP Python SDK - FastMCP framework
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Please make sure to update tests as appropriate and follow the existing code style.
- pyNastran - The underlying Nastran interface library
- MCP Python SDK - FastMCP framework
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.