Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ jobs:
- name: Build
run: npm run build

- name: Smoke test the built CLI
run: |
node dist/index.js --version
node dist/index.js --list

- name: Verify the demo runs
run: npm run demo

Expand Down
44 changes: 38 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

[![CI](https://github.com/DanielCuevas1208/engineer-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/DanielCuevas1208/engineer-mcp/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
[![TypeScript](https://img.shields.io/badge/TypeScript-5.9-blue.svg)](https://www.typescriptlang.org/)
[![TypeScript](https://img.shields.io/badge/TypeScript-5.8-blue.svg)](https://www.typescriptlang.org/)
[![Node](https://img.shields.io/badge/Node-%3E%3D22.13-brightgreen.svg)](package.json)
[![Version](https://img.shields.io/badge/version-0.3.0-blue.svg)](package.json)

Engineer MCP is a Model Context Protocol server for mechanical-engineering calculations.
It gives coding agents verified answers for beams, bolts, springs, shafts, bearings, stress, sections, and units.
It gives coding agents verified answers for beams, bolts, springs, shafts, bearings, stress, fatigue, sections, and units.
Every result shows the formula, the method, and the source.

## What it provides
Expand All @@ -23,6 +24,7 @@ The release covers these domains:
- Shaft torsion and first critical speed.
- Bearing rating life to ISO 281.
- von Mises equivalent stress.
- Fatigue safety factors for cyclic loads.
- Cross-section properties.
- Dimension-safe unit conversion.
- Material property lookup.
Expand Down Expand Up @@ -53,6 +55,7 @@ Warnings surface when a method uses an approximation.
| `shaft_analysis` | Torsion stress, twist, and critical speed. |
| `bearing_life` | ISO 281 rating life in revolutions and hours. |
| `von_mises` | Equivalent stress and yield safety factor. |
| `fatigue_analysis` | Endurance limit, fatigue criteria, and governing safety factor. |
| `unit_convert` | Conversion between compatible units. |
| `material_lookup` | Curated mechanical properties of materials. |

Expand Down Expand Up @@ -154,6 +157,28 @@ Error: Category mismatch: N·m is torque, J is energy.
Use a unit of the same quantity.
```

A call to `fatigue_analysis` for a machined 20 mm S355 rod under alternating bending:

```text
Unmodified endurance limit 245 MPa
Modified endurance limit 156.8 MPa
Equivalent alternating stress 80 MPa
Equivalent mean stress 120 MPa
Soderberg safety factor 1.179
Modified Goodman safety factor 1.324
Gerber safety factor 1.643
ASME-elliptic safety factor 1.634
Yield safety factor 1.775
Governing fatigue safety factor 1.179

Method: Stress-life fatigue analysis
Formula: Se' = 0.5 Sut, Se = ka kb kc kd ke kf Se', ...
References:
- Shigley's Mechanical Engineering Design (Tenth edition, 2015)
```

The fatigue report lists every Marin factor. It shows all four fatigue criteria plus the yield check. The governing factor is the minimum of the five.

## Development

| Command | Purpose |
Expand All @@ -169,9 +194,9 @@ Use a unit of the same quantity.
The test suite is deterministic and offline.
It covers the engines, the unit layer, the database, and the tools.

- 98 tests across 10 files.
- 134 tests across 11 files.
- All tests pass on Node 22 and Node 24.
- The CI workflow runs typecheck, tests, build, demo, and a package check.
- The CI workflow runs typecheck, tests, build, a CLI smoke test, the demo, and a package check.

Run `npm test` to reproduce the results.

Expand All @@ -184,6 +209,9 @@ Run `npm test` to reproduce the results.
- The critical speed is a first-mode approximation.
- The spring design covers static round-wire springs only.
It does not estimate fatigue life for cyclic loads.
- The fatigue analysis is a stress-life estimate for steel.
It does not model notch sensitivity, mean-stress scatter, or crack growth.
Verify the result with testing for a production part.
- The built-in SQLite module of Node.js is still experimental.

Check the cited sources for exact values.
Expand All @@ -197,12 +225,16 @@ Each release stays useful on its own.

- Helical compression spring design.
The `spring_design` tool reports the spring rate, the shear stress, and the safety factor.
- Fatigue analysis for cyclic loads.
The `fatigue_analysis` tool applies the Marin endurance-limit modifiers.
It reports the Soderberg, modified Goodman, Gerber, ASME-elliptic, and yield safety factors.
- Dynamic viscosity and thermal conductivity unit categories.
The `unit_convert` tool converts these quantities like every other registered category.

### Remaining

- Add fatigue analysis for cyclic loads.
- Add press-fit and interference-fit calculators.
- Add more unit categories, including viscosity and thermal conductivity.
- Add more unit categories, including kinematic viscosity and electric current.
- Add HTTP transport.
- Add a catalog of ISO and DIN standard sections.

Expand Down
2 changes: 1 addition & 1 deletion data/references.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"title": "Shigley's Mechanical Engineering Design",
"source": "McGraw-Hill Education",
"edition": "Tenth edition, 2015",
"section": "Chapters 3, 5, 8, 11, and 12",
"section": "Chapters 3, 5, 6, 8, 11, and 12",
"note": "Standard reference for strength, fatigue, fasteners, and bearings."
},
"roark-2011": {
Expand Down
5 changes: 3 additions & 2 deletions docs/integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ Engineer MCP grows in independent releases. Each release stays useful on its own
### Complete

- Helical compression spring design. The `spring_design` tool computes the spring rate, the shear stress, and the safety factor.
- Fatigue analysis for cyclic loads. The `fatigue_analysis` tool applies the Marin endurance-limit modifiers and reports the Soderberg, Goodman, Gerber, ASME-elliptic, and yield safety factors.
- Dynamic viscosity and thermal conductivity unit categories. The `unit_convert` tool converts these quantities like every other registered category.

### Remaining

- Add fatigue analysis for cyclic loads.
- Add press-fit and interference-fit calculators.
- Add more unit categories, including viscosity and thermal conductivity.
- Add more unit categories, including kinematic viscosity and electric current.
- Add HTTP transport in addition to stdio.
- Add a catalog of ISO and DIN standard sections.

Expand Down
36 changes: 36 additions & 0 deletions docs/mcp-tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,40 @@ Inputs:
- Cartesian mode uses `sigmaX`, `sigmaY`, `sigmaZ`, `tauXY`, `tauXZ`, `tauYZ`.
- `yieldStrength`: enables the safety factor.

## fatigue_analysis

Compute fatigue safety factors for a cyclic stress state.

The tool applies the Marin endurance-limit modifiers. It reports four fatigue criteria and the static yield check.

Inputs:

- `alternatingStress`: stress amplitude in pascals. For torsion, the shear amplitude.
- `meanStress`: mean stress in pascals. Use zero for fully reversed loading.
- `loading`: `bending`, `axial`, or `torsion`.
- `material`: material name from the database. Provides the ultimate and yield strength.
- `ultimateStrength` and `yieldStrength`: use these when you have no material.
- `surfaceCondition`: `ground`, `machined`, `cold_drawn`, `hot_rolled`, or `as_forged`. The default is `machined`.
- `diameterMm`: section diameter in millimetres. Sets the size factor.
- `reliabilityPct`: one of `50`, `90`, `95`, `99`, `99.9`, `99.99`, `99.999`, `99.9999`.
- `temperatureC`: operating temperature in degrees Celsius.
- `surfaceFactor`, `sizeFactor`, `loadFactor`, `temperatureFactor`, `reliabilityFactor`, `miscellaneousFactor`: explicit Marin factor overrides.

Example:

```json
{
"material": "Structural steel S355",
"alternatingStress": 80000000,
"meanStress": 120000000,
"loading": "bending",
"diameterMm": 20,
"reliabilityPct": 99
}
```

The tool reports the Soderberg, modified Goodman, Gerber, and ASME-elliptic safety factors. It also reports the yield safety factor. The governing factor is the minimum of all five. Torsion uses the von Mises equivalent stresses. A compressive mean stress is treated as zero, which is the conservative choice.

## unit_convert

Convert a value between two units.
Expand All @@ -158,6 +192,8 @@ Inputs:

The converter rejects mismatched dimensions and mismatched quantity categories. For example, it rejects a torque-to-energy conversion.

The registry covers length, mass, time, angle, temperature, force, pressure, torque, energy, power, velocity, acceleration, area, volume, density, stiffness, frequency, dynamic viscosity, and thermal conductivity.

## material_lookup

Look up mechanical properties of common engineering materials.
Expand Down
12 changes: 12 additions & 0 deletions examples/demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ type ToolHandlers = {
von_mises: Handler;
unit_convert: Handler;
material_lookup: Handler;
fatigue_analysis: Handler;
};

const toolHandlers = handlers as ToolHandlers;
Expand All @@ -91,6 +92,7 @@ const tools: NamedHandler[] = [
["unit_convert", toolHandlers.unit_convert],
["unit_convert (torque to energy)", toolHandlers.unit_convert],
["material_lookup", toolHandlers.material_lookup],
["fatigue_analysis", toolHandlers.fatigue_analysis],
];

const inputs: Array<Record<string, unknown>> = [
Expand Down Expand Up @@ -158,6 +160,16 @@ const inputs: Array<Record<string, unknown>> = [
{
query: "steel",
},
{
material: "Structural steel S355",
alternatingStress: 80e6,
meanStress: 120e6,
loading: "bending",
surfaceCondition: "machined",
diameterMm: 20,
reliabilityPct: 99,
outputUnits: { enduranceLimit: "MPa", unmodifiedEnduranceLimit: "MPa", equivalentAlternatingStress: "MPa", equivalentMeanStress: "MPa" },
},
];

console.log("Engineer MCP - demo run");
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@engineerkit/engineer-mcp",
"version": "0.2.0",
"version": "0.3.0",
"description": "MCP server for verified mechanical-engineering calculations, references, and material data.",
"type": "module",
"license": "MIT",
Expand Down
Loading
Loading