Provides specialized tools for generating physics-based trajectory and motion data tailored for React-based 3D frameworks such as React Three Fiber and Remotion.
Generates precise physical motion paths and trajectory arrays compatible with Three.js-based visualization engines for realistic 3D animations.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Physics MCP ServerCalculate the trajectory of a soccer ball with 15mph wind and Magnus force."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Physics MCP Server
Features: 🌀 Magnus Force • 💨 Wind Effects • 🏔️ Altitude • 🌡️ Temperature • 🔄 Tumbling Drag • 🎮 Rigid-Body Sims • 📊 515 Tests
A Model Context Protocol (MCP) server that brings comprehensive physics simulation and calculation capabilities to Large Language Models.
Transform your LLM into a physics engine! This MCP server provides 55 specialized tools spanning classical mechanics, fluid dynamics, rotational motion, and rigid-body simulations. Built for seamless integration with Claude, ChatGPT, and any MCP-compatible AI system.
📚 Table of Contents
🌟 What is This?
Physics MCP Server enables LLMs to perform sophisticated physics calculations and simulations through a standardized protocol. Instead of hallucinating physics formulas or making calculation errors, LLMs can now:
Calculate precisely: Use validated physics formulas for exact results
Simulate realistically: Run rigid-body physics with the Rapier engine
Visualize motion: Generate trajectory data for React Three Fiber, Remotion, and other 3D frameworks
Teach interactively: Answer physics questions with real calculations, not memorized facts
Design intelligently: Analyze forces, collisions, and motion for engineering applications
Why MCP?
The Model Context Protocol provides a standardized way to extend LLM capabilities beyond text generation. This server implements MCP to give language models direct access to:
⚡ Instant physics calculations (projectile motion, forces, energy)
🎮 Rigid-body simulations (collisions, bounces, stacking)
📊 Motion analysis (trajectory fitting, kinematics, velocity profiles)
🌊 Fluid dynamics (drag, buoyancy, lift, Bernoulli)
🔄 Rotational mechanics (torque, angular momentum, gyroscopes)
⚖️ Static analysis (equilibrium, beam reactions, friction)
🔄 Unit conversions (62 unit types: velocity, distance, mass, time, acceleration, torque, frequency, data size, and more)
📦 What's Included
55 Physics Tools Across 10 Categories
Category | Tools | Description |
Basic Mechanics | 8 tools | Projectile motion, forces, energy, momentum, collisions |
Fluid Dynamics | 10 tools | Drag, buoyancy, terminal velocity, lift, Magnus force, Bernoulli |
Rotational Dynamics | 5 tools | Torque, moment of inertia, angular momentum, rotational KE |
Oscillations | 5 tools | Springs, pendulums, harmonic motion, damping |
Circular Motion | 5 tools | Centripetal force, orbits, banking angles, escape velocity |
Statics | 7 tools | Force balance, torque balance, friction, beam reactions |
Kinematics | 7 tools | Motion analysis, trajectory fitting, velocity calculations, projectile with drag |
Collisions | 2 tools | Elastic and inelastic 3D collisions with energy loss |
Conservation Laws | 4 tools | Energy, momentum, and angular momentum verification |
Unit Conversions | 2 tools | 62 unit types across 16 categories (velocity, distance, mass, time, acceleration, torque, frequency, data, etc.) |
Realistic vs Ideal Physics Comparison
See the dramatic difference when including real-world effects:
Sport | Scenario | Ideal (No Drag) | Realistic (With Enhancements) | Difference |
⚾ Baseball | 90 mph fastball | 87.5m | 52.3m (with drag) | -40% range |
⛳ Golf | Pro drive at sea level | 251m | 129m (with drag) | -49% range |
⛳ Golf | Same drive in Denver | 251m | 181m (drag + altitude) | -28% range |
⚽ Soccer | Free kick with wind | 25m straight | 26m + 5.6m curve (wind + spin) | Bends 5.6m! |
🎾 Tennis | Serve on hot day | 27m | 26.8m (less drag) | +2.3% vs cold |
💡 Key Insight: Real physics matters! Air resistance can reduce range by 20-70% depending on the sport.
Two Calculation Modes
Analytic Mode (Built-in, no setup)
Instant mathematical calculations
Perfect for education and quick answers
Exact solutions using physics formulas
Now includes: Advanced drag, spin (Magnus), wind, altitude effects
Simulation Mode (Requires Rapier service)
Full rigid-body dynamics
Complex multi-object interactions
Realistic material properties and constraints
🚀 Quick Start (30 seconds)
For Claude Desktop: Add to your config file:
Option 1: Public Hosted MCP Server (Easiest - No Installation)
Option 2: Local uvx (Recommended)
🎯 Use Cases
1. Interactive Physics Education
LLM as Physics Tutor
Real-World Problem Solving
Students ask physics questions in natural language
LLM calculates exact answers using the MCP tools
Can generate trajectory plots, force diagrams, energy graphs
Interactive "what-if" scenarios: "What if gravity was half?"
2. Game Development & Prototyping
Ballistics Design
Collision Detection
Rapid Iteration
Test different launch angles, speeds, masses without coding
Verify collision logic before implementation
Generate realistic physics data for procedural content
3. 3D Visualization & Animation (React Three Fiber)
Automated Animation Data Generation
Rigid-Body Simulations
Use Cases:
Product visualizations (dropping phones, bouncing balls)
Architectural collapse simulations (building demolition previews)
Sports analytics visualizations (ball trajectories, collision analysis)
Sci-fi effects (asteroid fields, debris clouds)
4. Engineering & Design Analysis
Vehicle Crash Prediction
Safety Analysis
Calculate impact forces for crash test scenarios
Predict collision times for autonomous vehicle planning
Analyze momentum transfer in industrial equipment
Structural Testing (with Rapier simulations)
Simulate falling objects hitting structures
Test load-bearing capacity under dynamic loads
Model chain reactions (domino effects)
5. Sports & Athletics
Realistic Ball Trajectories with Air Resistance
Golf Drive Analysis
Basketball 3-Pointer
Shot Analysis Applications
Baseball: Pitch trajectories, drag reduces 90mph fastball range by 40%
Golf: Drive distance with dimpled ball (Cd=0.25 vs smooth ball Cd=0.47)
Basketball: Arc optimization for free throws and 3-pointers
Soccer: Penalty kick trajectories, minimal drag at short distances
Track & field: Javelin, shot put with realistic air resistance
Tennis: Serve and groundstroke trajectory analysis
6. Astrophysics & Space Exploration
Orbital Mechanics (Simplified)
Applications:
Asteroid impact prediction
Satellite collision avoidance
Debris field analysis
Launch trajectory planning (simplified cases)
7. Fluid Dynamics & Marine/Aerospace Engineering
Underwater Torpedo Simulation
Terminal Velocity & Drag Analysis
Buoyancy & Float/Sink Predictions
Applications:
Marine engineering: Submarine drag, torpedo trajectories, underwater vehicles
Aerospace: Parachute descent, atmospheric re-entry, drag optimization
Sports science: Swimming efficiency, diving trajectories
Product design: Floatation devices, drag reduction, hydrodynamics
Environmental: Particle settling rates, pollutant dispersion
8. Film & VFX Pre-visualization
Stunt Planning
Destruction Sequences
Building collapses with rigid-body sim
Explosion debris trajectories
Vehicle stunts and crashes
Realistic object interactions
8. Military & Defense (Training/Education)
Ballistics Training
Collision Avoidance
Projectile trajectory analysis
Impact point prediction
Intercept course calculations
9. Robotics & Automation
Path Planning
Collision Detection
Multi-robot coordination
Object catching/throwing
Assembly line optimization
10. Data Science & Research
Physics Simulations for ML Training Data
Use Cases:
Generate labeled physics data for ML models
Validate physics-informed neural networks
Test scientific hypotheses with rapid iteration
Monte Carlo simulations (vary parameters, aggregate results)
🚀 Real-World Example Workflows
Workflow 1: Basketball Shot Optimizer
Workflow 2: Car Crash Investigation
Workflow 3: Game Level Design with Physics Simulation
Workflow 4: Satellite Collision Warning
🎨 Visualization Integration
React Three Fiber (R3F) Example
📊 Trajectory Data Format
All trajectory recordings follow a canonical schema for maximum interoperability with R3F, Remotion, Three.js, and other animation systems.
Schema Definition
JSON Example
Usage in React Three Fiber
Usage in Remotion
Design Notes
Quaternions for rotation: More compact and interpolation-friendly than Euler angles
Absolute time: Each frame has absolute time
t, making scrubbing easierConstant dt: Frames are evenly spaced, simplifying playback
Optional velocities: Include if needed for motion blur or physics visualization
Qualified body_id: Format is
rapier://sim-{id}/{body_id}for traceability
🛠️ Installation
Prerequisites
Python 3.11+
For simulations: Rapier service (see RAPIER_SERVICE.md)
Public service available at:
Or run locally with Docker (see below)
Quick Start with uvx (Recommended)
The fastest way to try chuk-mcp-physics without installation:
Installation Methods
Option 1: Install from PyPI (Recommended)
Option 2: Install from Source
With Claude Desktop
Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
Option 1: Using uvx (Recommended - No Installation Required)
Option 2: Using Installed Package
Option 3: Analytic Only (No External Service)
📖 Available Tools
Tool Organization
Tools are organized into two tiers to help you choose the right abstraction:
1️⃣ Analytic Primitives (No External Service)
Best for: Quick calculations, education, simple scenarios
Direct formula-based calculations that return instant results:
Tool | What It Does | Example Use Case |
| Ballistic trajectory using kinematic equations | "How far does a cannonball go?" |
| Predict if two spheres will collide | "Will these asteroids hit?" |
| F = ma calculations | "What force accelerates this car?" |
| KE = ½mv² | "How much energy in this crash?" |
| p = mv | "What's the momentum transfer?" |
| PE = mgh | "What's the energy at height?" |
| Work (F·d) and power (W/t) | "How much work lifting this box?" |
| 1D elastic collision (conserves energy & momentum) | "Pool balls colliding?" |
| Air/water resistance (F = ½ρv²C_dA) | "What's the drag on this car?" |
| Will it float? (Archimedes) | "Does a steel ball float in water?" |
| Maximum fall speed | "How fast does a skydiver fall?" |
| Underwater trajectory with drag & buoyancy | "How far does a torpedo travel?" |
Characteristics:
⚡ Instant execution (< 1ms)
📦 No external dependencies
🎯 Exact mathematical solutions
✅ Always available (no service required)
Limitations:
Only spherical objects (for collisions)
No complex shapes
No multi-body interactions
No friction or material properties
2️⃣ Simulation Primitives (Requires Rapier Service)
Best for: Complex physics, multi-body dynamics, visualization data
Low-level building blocks for rigid-body simulations:
Tool | What It Does | When to Use |
| Initialize physics world | Start any simulation |
| Add objects (box, sphere, capsule, etc.) | Build scene |
| Advance time | Run physics |
| Capture motion for R3F/Remotion | Generate animation data |
| Cleanup resources | End simulation |
Characteristics:
🦀 Requires Rapier service
🔄 Stateful (track simulation ID)
🧩 Composable (combine for complex scenarios)
💪 Full rigid-body dynamics
Typical workflow:
📋 Complete Tool Reference
Basic Mechanics (8 tools)
Tool | Purpose | Example |
| Ballistic trajectories | "How far does a cannonball travel?" |
| Predict sphere collisions | "Will these asteroids hit?" |
| F = ma calculations | "What force accelerates this car?" |
| KE = ½mv² | "Energy in moving object?" |
| p = mv | "Momentum of moving object?" |
| PE = mgh | "Energy at height?" |
| Work (F·d) and power (W/t) | "Work done lifting object?" |
| 1D elastic collision | "Pool ball velocities after impact?" |
Fluid Dynamics (10 tools)
Tool | Purpose | Example |
| Air/water resistance | "Drag on car at speed?" |
| Will it float? (Archimedes) | "Does steel ball float?" |
| Maximum fall speed | "Skydiver terminal velocity?" |
| Underwater trajectory | "How far does torpedo travel?" |
| Aerodynamic lift | "Lift on aircraft wing?" |
| Force on spinning ball | "Why does curveball curve?" |
| Pressure in flowing fluid | "Pressure in pipe constriction?" |
| Hydrostatic pressure | "Pressure at 30m depth?" |
| Flow regime classification | "Is flow turbulent?" |
| Flow through constriction | "Velocity in throat?" |
Rotational Dynamics (5 tools)
Tool | Purpose | Example |
| τ = r × F (cross product) | "Torque from wrench?" |
| Rotational inertia | "MOI of spinning disk?" |
| L = Iω | "Angular momentum of wheel?" |
| Rotational KE = ½Iω² | "Energy in flywheel?" |
| α = τ/I | "How fast does it spin up?" |
Oscillations & Waves (5 tools)
Tool | Purpose | Example |
| Spring force F = -kx | "Force in compressed spring?" |
| Oscillation period | "How fast does mass oscillate?" |
| Position at time t | "Where is mass at t=2s?" |
| Motion with damping | "How quickly does it settle?" |
| Pendulum swing time | "Period of 1m pendulum?" |
Circular Motion & Orbits (5 tools)
Tool | Purpose | Example |
| F_c = mv²/r | "Force for circular motion?" |
| Kepler's 3rd law | "Satellite orbital period?" |
| Optimal curve angle | "Banking for highway curve?" |
| Escape from gravity | "Earth escape velocity?" |
| Complete orbital analysis | "Analyze ISS orbit?" |
Statics & Equilibrium (7 tools)
Tool | Purpose | Example |
| Verify ΣF = 0 | "Are forces balanced?" |
| Verify Στ = 0 | "Will seesaw balance?" |
| Balance point | "Where is center of mass?" |
| Max friction force | "Will object slip?" |
| Force on incline | "Normal force on ramp?" |
| Force + torque balance | "Is structure stable?" |
| Support forces | "Reaction forces on beam?" |
Kinematics Analysis (7 tools)
Tool | Purpose | Example |
| Derive from position data | "Acceleration from motion capture?" |
| Rate of acceleration change | "How jerky is motion?" |
| Find trajectory equation | "Fit parabola to data?" |
| Position/velocity/accel graphs | "Generate motion graphs?" |
| Speed along path | "Average speed on route?" |
| Velocity at exact time | "Speed at t=2.5s?" |
| Realistic projectile with air resistance | "How far does baseball actually go?" |
Advanced Collisions (2 tools)
Tool | Purpose | Example |
| 3D perfect collision | "Pool balls in 3D?" |
| 3D collision with energy loss | "Car crash analysis?" |
Conservation Laws (4 tools)
Tool | Purpose | Example |
| Verify energy conserved | "Is collision realistic?" |
| Verify momentum conserved | "Is momentum preserved?" |
| Verify L conserved | "Is rotation valid?" |
| Energy loss over time | "Where did energy go?" |
Unit Conversions (2 tools)
Tool | Purpose | Supported Units |
| Convert between units | Velocity: m/s, km/h, mph, ft/s, knots Distance: m, km, mi, ft, yd, in Mass: kg, g, lb, oz Force: N, kN, lbf Energy: J, kJ, cal, BTU, kWh Power: W, kW, hp Temperature: K, C, F Angle: rad, deg Pressure: Pa, kPa, bar, psi, atm Area: m², km², ft², acre Volume: m³, L, gal, ft³ Time: s, min, hr, day Acceleration: m/s², g, ft/s² Torque: N·m, lb·ft, lb·in Frequency: Hz, kHz, MHz, GHz Data Size: B, KB, MB, GB |
| Get all supported units | Returns complete list of conversions |
Examples:
Features:
⚡ Instant conversions (no external service needed)
🔄 Automatic indirect conversions (e.g., mph → km/h via m/s)
📐 70+ unit types across 16 categories
🎯 Perfect for natural language physics queries
🚀 Includes engineering units (torque, acceleration, frequency)
Common Drag Coefficients (Cd) Reference
For use with calculate_projectile_with_drag tool:
Object | Drag Coefficient (Cd) | Notes |
Sports Balls | ||
Baseball | 0.4 | Stitched surface |
Golf ball (dimpled) | 0.25 | Dimples reduce drag by ~50% |
Golf ball (smooth) | 0.47 | Without dimples (don't use!) |
Basketball | 0.55 | Large, textured surface |
Soccer ball | 0.25 | Modern, smooth panels |
Tennis ball | 0.55 | Fuzzy surface |
Football (American) | 0.05-0.15 | Highly streamlined, orientation-dependent |
Generic Shapes | ||
Sphere (smooth) | 0.47 | Default reference |
Flat plate (perpendicular) | 1.28 | Maximum drag |
Streamlined body | 0.04 | Teardrop/airfoil |
Cylinder (perpendicular) | 1.15 | Like a pole |
Vehicles | ||
Car (modern) | 0.25-0.35 | Aerodynamic design |
Truck | 0.6-0.9 | Boxy shape |
Bicycle + rider | 0.9 | Upright position |
Human Body | ||
Skydiver (belly-down) | 1.0-1.3 | Maximum drag |
Skydiver (head-down) | 0.7 | Streamlined |
Projectiles | ||
Bullet (supersonic) | 0.295 | Pointed nose |
Artillery shell | 0.15-0.25 | Streamlined |
Basic Usage Example:
Advanced Projectile Features
The calculate_projectile_with_drag tool supports optional enhancements for ultra-realistic simulations:
🌀 Magnus Force (Spin Effects)
Spin creates a pressure differential that deflects the ball's path. Essential for:
Baseball: Curveballs (topspin drops), fastballs (backspin lifts)
Golf: Backspin increases carry, sidespin causes slices/hooks
Soccer: Bending free kicks around defensive walls
Tennis: Topspin brings ball down faster
Spin Parameters:
spin_rate: Rotation speed in rad/s (convert from RPM: rpm × 2π/60)spin_axis: Unit vector [x, y, z] indicating spin direction[0, 0, 1]= Backspin (lifts)[0, 0, -1]= Topspin (drops)[0, 1, 0]= Sidespin (hooks/slices)
💨 Wind Effects
Constant wind vector affects trajectory throughout flight:
Wind Types:
Tailwind:
[+X, 0]- increases rangeHeadwind:
[-X, 0]- decreases rangeCrosswind:
[X, 0]- lateral deflectionUpdraft:
[0, +Y]- increases height and flight timeDowndraft:
[0, -Y]- decreases height
🏔️ Altitude & Temperature Effects
Air density varies with elevation and temperature, dramatically affecting drag:
Real-World Impact:
Denver (1600m): ~10% longer drives than sea level
Hot day (+20°C): ~2-3% less drag than cold day
Everest Base Camp (5300m): ~50% less air density!
Air Density Formula:
Where:
ρ₀ = sea level density (1.225 kg/m³)
h = altitude (meters)
T = temperature (Kelvin)
M = molar mass of air (0.029 kg/mol)
g = gravity (9.81 m/s²)
R = gas constant (8.314 J/(mol·K))
🌟 Combined Effects Example
See Examples:
examples/sports_projectiles_with_drag.py- Basic drag effectsexamples/advanced_projectile_effects.py- Magnus force, wind, altitude
🔄 Orientation-Dependent Drag (Rapier Simulations)
For tumbling objects like footballs, frisbees, and javelins, drag varies dramatically based on orientation. A football in a perfect spiral has 3-6× less drag than when tumbling end-over-end!
Available via Rapier rigid-body simulations using the add_rigid_body tool with orientation-dependent drag parameters.
How It Works
Objects moving through air experience drag that depends on their orientation:
Football spiral: Streamlined along flight path → low drag (~0.1 Cd)
Football tumbling: Broadside to airflow → high drag (~0.6 Cd)
Frisbee flat: Minimal cross-section → low drag (~0.08 Cd)
Frisbee tilted: Larger cross-section → higher drag
New
Example: Football Spiral vs Tumble
Result: Spiral can travel 20-40% farther than tumble!
Common drag_axis_ratios Patterns
The drag_axis_ratios parameter specifies how drag varies along each body-local axis [X, Y, Z]:
Object | Ratios | Streamlined Axis | Use Case |
Football spiral |
| Y (length) | Perfect pass |
Javelin |
| Y (length) | Optimal flight |
Frisbee flat |
| Y (vertical) | Stable throw |
Sphere |
| None | Basketball, etc. |
Disc tumbling |
| Less variation | Wobbly throw |
Physical Meaning:
0.2= 20% of base drag along that axis (very streamlined)1.0= 100% of base drag (normal)1.5= 150% of base drag (higher resistance)
Real-World Examples
⚽ Football Throw (spiral vs tumble):
🥏 Frisbee (stable vs wobbling):
🏹 Javelin (optimal vs poor technique):
Important Notes
⚠️ Requires Rapier Service: Orientation-dependent drag calculations are performed by the Rapier physics service (Rust implementation). The Python MCP server defines the API and passes parameters to Rapier.
🎯 When to Use:
Sports simulations (football, frisbee, discus)
Projectile accuracy (javelin, arrows, darts)
Aerospace applications (rocket tumbling, debris)
🔬 Physics: The drag force is calculated in the Rapier service using the body's current orientation (quaternion) to transform body-local drag coefficients into world-space drag forces.
Hybrid Drag Implementation: Rapier uses a hybrid approach to handle extreme drag cases:
Normal drag (ratio < 2.0): Force-based orientation-dependent drag with full anisotropic behavior
Extreme drag (ratio ≥ 2.0): Damping-based drag for stability when drag-to-weight ratio is very high
Automatically activates for objects like ping pong balls (high drag, low mass)
Prevents numerical instabilities while maintaining realistic energy dissipation
Logged as INFO when triggered:
"Body 'name' has extreme drag (ratio=X.XX), using damping"
Where drag_ratio = 0.5 * fluid_density * drag_coefficient * drag_area * v_typical^2 / (mass * g)
Measurement Notes:
When analyzing trajectories, use max(x_positions) instead of final_x to measure range. Rapier's solver may occasionally jitter backward slightly near ground impact, but this is a measurement artifact, not a physics error. The drag forces always oppose motion correctly.
See Example:
examples/tumbling_projectiles.py- Football, frisbee, and javelin orientation effects
✨ Phase 1 Features (Production Ready)
All Phase 1 features are complete, tested (98% coverage), and deployed to production!
Phase 1.1: Bounce Detection 🏀
Automatically detect and analyze bounces in ball trajectories with energy loss calculations.
What it does:
Detects bounce events from trajectory data (velocity reversals near ground)
Calculates energy loss percentage for each bounce
Provides before/after velocities and heights
Perfect for answering "how many bounces?" and "when does it stop?"
Tool: record_trajectory_with_events
Example:
Output:
Use Cases:
Sports analytics (basketball arc, tennis serve bounces)
Product testing (phone drop tests, durability simulations)
Game development (realistic ball physics)
Education (demonstrate energy conservation)
See: examples/06_bounce_detection.py for full demo
Phase 1.2: Contact Events 📊
Real-time collision tracking with detailed contact information from the physics engine.
What it does:
Tracks all contact events between bodies during simulation
Reports contact start, ongoing, and end events
Provides impulse magnitudes, normals, and relative velocities
Essential for collision analysis and force calculations
Included in: All trajectory recordings (record_trajectory, record_trajectory_with_events)
Contact Event Data:
Example:
Use Cases:
Collision analysis (car crashes, sports impacts)
Force calculations (derive forces from impulses)
Interaction tracking (which objects touched what)
VFX triggers (spark effects on collisions)
See: examples/07_contact_events.py for full demo
Phase 1.3: Joints & Constraints 🔗
Connect rigid bodies with realistic joints for complex mechanical systems.
What it does:
Create constraints between bodies (hinges, sliders, ball-and-socket, fixed)
Build complex systems (pendulums, chains, ragdolls, machinery)
Realistic mechanical motion (doors, wheels, linkages)
Perfect for simulating articulated structures
Tool: add_joint
Joint Types:
Type | Description | Example Uses |
FIXED | Rigid connection (glue) | Attach hat to head, weld joints |
REVOLUTE | Hinge rotation around axis | Doors, pendulums, wheels |
SPHERICAL | Ball-and-socket rotation | Ragdoll shoulders, gimbal mounts |
PRISMATIC | Sliding along axis | Pistons, elevators, sliders |
Example - Simple Pendulum:
Example - Multi-Link Chain:
Use Cases:
Mechanical systems (engines, gears, levers)
Character animation (ragdolls, inverse kinematics)
Vehicle suspension (wheels, shocks)
Architectural simulations (doors, drawbridges)
See: examples/08_pendulum.py for full demo
Phase 1.4: Damping & Advanced Controls 🌬️
Realistic energy dissipation through linear and angular damping.
What it does:
Simulates air resistance (linear damping)
Simulates rotational friction (angular damping)
Makes simulations more realistic and stable
Perfect for settling physics and reducing "floaty" motion
Parameters: Added to add_rigid_body tool
Damping Parameters:
Effect of Linear Damping:
0.0= No air resistance (vacuum physics)0.1-0.3= Light damping (tennis ball in air)0.5-0.7= Moderate damping (underwater motion)0.9+= Heavy damping (very viscous fluid)
Effect of Angular Damping:
0.0= Spins forever (vacuum)0.1-0.3= Realistic friction (rolling ball)0.5-0.7= High friction (rough surface)0.9+= Almost no rotation (sticky surface)
Comparison:
Use Cases:
Realistic object motion (not "floaty" game physics)
Faster settling (less simulation time needed)
Underwater simulations (high damping)
Space simulations (zero damping)
See: examples/09_phase1_complete.py for all Phase 1 features combined
Phase 1.5: Fluid Dynamics 🌊
Analytical fluid calculations for drag, buoyancy, and underwater motion.
What it does:
Calculates drag forces (quadratic air/water resistance)
Computes buoyancy using Archimedes' principle
Determines terminal velocity for falling objects
Simulates underwater projectile motion with drag and buoyancy
Tools Available:
1. calculate_drag_force - Air/Water Resistance
Calculate the force opposing motion through a fluid.
Common drag coefficients:
Sphere: 0.47
Streamlined (torpedo): 0.04
Flat plate: 1.28
Human (standing): 1.0-1.3
Car: 0.25-0.35
Optional viscosity parameter (for accurate Reynolds number):
Water at 20°C:
1.002e-3Pa·sAir at 20°C:
1.825e-5Pa·sMotor oil:
0.1Pa·sIf omitted, estimated from density (water-like if >100 kg/m³, else air-like)
2. calculate_buoyancy - Will it Float?
Determine buoyant force and whether objects float or sink.
3. calculate_terminal_velocity - Maximum Fall Speed
Calculate the speed where drag equals weight.
4. simulate_underwater_motion - Full Fluid Simulation
Simulate motion through fluids with drag and buoyancy forces.
Use Cases:
Marine engineering: Torpedo trajectories, submarine drag
Aerospace: Skydiving, parachute descent, atmospheric re-entry
Sports: Swimming, diving, underwater ballistics
Product design: Drag optimization, floatation devices
Environmental: Particle settling, pollutant dispersion
Physics Models:
Quadratic drag: F_drag = 0.5 * ρ * v² * C_d * A
Buoyancy: F_b = ρ_fluid * V * g (Archimedes)
Terminal velocity: v_t = √(2mg / ρC_dA)
Numerical integration for complex underwater motion
See: examples/10_fluid_dynamics.py for comprehensive demonstrations
🎉 Phase 1 Complete Summary
Status: ✅ All features production-ready
Feature | Status | Tool | Coverage |
Bounce Detection | ✅ Shipped |
| 100% |
Contact Events | ✅ Shipped | All trajectory tools | 100% |
Joints & Constraints | ✅ Shipped |
| 100% |
Damping Controls | ✅ Shipped |
| 100% |
Fluid Dynamics | ✅ Shipped |
| 100% |
Test Coverage: 98% (350 tests passing)
Deployment:
🌐 MCP Server: https://physics.chukai.io/mcp
🦀 Rapier Service: https://rapier.chukai.io
Examples: See examples/06_bounce_detection.py through examples/10_fluid_dynamics.py
🚀 Phase 2 Features (Production Ready)
All Phase 2 features are complete, tested (98% coverage), and deployed to production!
Phase 2.1: Rotational Dynamics 🔄
Complete rotational motion calculations including torque, moment of inertia, angular momentum, and rotational kinetic energy.
Tools Available:
Tool | Description | Example Use |
| Calculate torque from force and position (τ = r × F) | "What torque does this wrench apply?" |
| Moment of inertia for common shapes (disk, sphere, rod, etc.) | "What's the rotational inertia?" |
| Angular momentum (L = Iω) | "How much rotational momentum?" |
| Rotational KE (½Iω²) | "Energy in spinning flywheel?" |
| Angular acceleration (α = τ/I) | "How fast does it spin up?" |
Example - Calculate Torque:
Use Cases:
Mechanical engineering (gear systems, engines)
Robotics (joint torques, motor sizing)
Sports science (bat swings, golf clubs)
Aerospace (satellite attitude control)
Phase 2.2: Oscillations & Waves 🌊
Harmonic motion and spring systems with damping effects.
Tools Available:
Tool | Description | Example Use |
| Spring force and potential energy (F = -kx) | "How much force in compressed spring?" |
| Period and frequency of spring-mass system | "How fast does it oscillate?" |
| Position, velocity, acceleration at time t | "Where is the mass at t=2s?" |
| Damped harmonic motion (underdamped, critically damped, overdamped) | "How quickly does it settle?" |
| Period of simple pendulum | "How long is one swing?" |
Example - Spring-Mass System:
Use Cases:
Mechanical design (suspension systems, vibration isolation)
Seismology (earthquake oscillations)
Electronics (LC circuits, resonance)
Horology (pendulum clocks)
Phase 2.3: Circular Motion & Orbits 🌍
Circular motion, orbital mechanics, and centripetal forces.
Tools Available:
Tool | Description | Example Use |
| Force required for circular motion | "What force keeps car on curve?" |
| Period and velocity for circular orbit | "How long is satellite orbit?" |
| Optimal banking for curved road | "What angle for this turn?" |
| Minimum velocity to escape gravity | "Can rocket escape Earth?" |
| Complete orbital analysis (altitude, period, velocity) | "Analyze ISS orbit" |
Example - Satellite Orbit:
Use Cases:
Space missions (orbital calculations, satellite deployment)
Astrophysics (planetary motion, binary stars)
Transportation (highway curve design)
Amusement parks (loop-the-loop, centrifuges)
Phase 2.4: Advanced Collisions 💥
3D collision calculations with elastic and inelastic collisions.
Tools Available:
Tool | Description | Example Use |
| 3D elastic collision (energy conserved) | "Pool ball collisions in 3D" |
| 3D inelastic collision with restitution | "Car crash with energy loss" |
Example - Car Crash:
Phase 2.5: Conservation Laws ⚖️
Verify and track conservation of energy, momentum, and angular momentum.
Tools Available:
Tool | Description | Example Use |
| Verify total energy is conserved | "Is this collision realistic?" |
| Verify momentum is conserved | "Does this violate physics?" |
| Verify angular momentum conserved | "Is rotation energy conserved?" |
| Track energy loss over trajectory | "Where did the energy go?" |
Example - Validate Collision:
Phase 2.6: Statics & Equilibrium ⚖️
Static equilibrium analysis for structures and forces.
Tools Available:
Tool | Description | Example Use |
| Verify ΣF = 0 (force equilibrium) | "Are these forces balanced?" |
| Verify Στ = 0 (torque equilibrium) | "Will this seesaw balance?" |
| Find center of mass for system | "Where is the balance point?" |
| Maximum friction force, will object slip? | "Will box slide down ramp?" |
| Normal force on inclined plane | "What force on ramp?" |
| Complete equilibrium check (force + torque) | "Is structure stable?" |
| Reaction forces for simply supported beam | "What are support forces?" |
Example - Beam Analysis:
Use Cases:
Structural engineering (bridges, buildings)
Mechanical design (levers, balances)
Architecture (load analysis)
Safety analysis (stability checks)
Phase 2.7: Kinematics Analysis 📊
Analyze motion data to extract velocities, accelerations, and trajectories.
Tools Available:
Tool | Description | Example Use |
| Derive velocity and acceleration from position data | "Analyze motion capture data" |
| Calculate jerk (rate of change of acceleration) | "How jerky is this motion?" |
| Fit polynomial to trajectory (linear, quadratic, cubic) | "Find trajectory equation" |
| Generate position/velocity/acceleration graphs | "Visualize kinematics" |
| Average speed along path | "What's average speed?" |
| Velocity at specific time with interpolation | "Speed at exact moment?" |
Example - Motion Analysis:
Use Cases:
Motion capture analysis (sports, biomechanics)
Robotics (trajectory planning, motion smoothness)
Autonomous vehicles (trajectory optimization)
Scientific research (particle tracking)
Phase 2.8: Advanced Fluid Dynamics 💨
Extended fluid calculations including lift, Magnus force, Bernoulli, and viscous flow.
Tools Available:
Tool | Description | Example Use |
| Aerodynamic lift (L = ½ρv²C_LA) | "What lift on wing?" |
| Force on spinning ball | "Why does curveball curve?" |
| Bernoulli's equation for flowing fluids | "Pressure in pipe constriction?" |
| Hydrostatic pressure | "Pressure at 30m depth?" |
| Flow regime (laminar/turbulent) | "Is flow turbulent?" |
| Flow through constriction | "Velocity in throat?" |
Example - Aircraft Wing:
Use Cases:
Aerospace engineering (aircraft design, aerodynamics)
Marine engineering (hull design, submarine motion)
Sports science (ball trajectories, swimming efficiency)
HVAC design (airflow optimization)
🎉 Phase 2 Complete Summary
Status: ✅ All features production-ready
Feature Area | Tools | Coverage |
Rotational Dynamics | 5 tools | 100% |
Oscillations | 5 tools | 100% |
Circular Motion | 5 tools | 100% |
Advanced Collisions | 2 tools | 100% |
Conservation Laws | 4 tools | 100% |
Statics | 7 tools | 100% |
Kinematics Analysis | 6 tools | 100% |
Advanced Fluids | 6 tools | 100% |
Total Tools: 79 tools across all categories Test Coverage: 98% overall (350 tests passing)
Next Up: Phase 3 - Performance Optimization & Visualization
Batch simulation API for ML training data
Parameter sweep utilities
Enhanced visualization exports
Performance profiling and optimization
🎓 Example Conversations
Projectile Motion
Collision Detection
Force & Energy Calculations
Momentum Analysis
Complex Multi-Step Problems
Rigid Body Simulations
💡 Try These Prompts
Copy and paste these into your LLM chat to see the physics tools in action:
Projectile Motion
A golf ball is hit at 70 m/s at 15 degrees. How far does it go and what's the flight time?What angle gives maximum range for a cannonball fired at 100 m/s?If I throw a javelin at 28 m/s from 2 meters high, what angle gives maximum distance?A basketball player shoots from 2m high at 7 m/s toward a hoop 3.05m high and 4.6m away. What angles work?
Collision Detection
Two cars 500m apart, one at 60 mph, other at 45 mph heading toward each other. When do they collide?Two asteroids: one at (0,0,0) moving at 1000 m/s in x direction, another at (50000, 100, 0) moving at -800 m/s in x. Will they collide?Spaceship A at (10000,0,0) moving at (-50,0,0) m/s, spaceship B at (-10000,100,0) moving at (45,0,0) m/s. Collision check?
Force, Energy & Momentum
What force is needed to accelerate a 1500 kg car at 3 m/s²?What's the kinetic energy of a 2000 kg car traveling at 30 m/s?Calculate the momentum of a 70 kg runner sprinting at 10 m/sHow much energy does a 0.145 kg baseball have when pitched at 45 m/s?
Real-World Applications
I'm designing a water fountain. Water shoots up at 15 m/s. How high does it go?A cannon on a 50 meter cliff fires horizontally at 200 m/s. How far from the base does the projectile land?Two cars crash: Car A (1500kg) at 30 m/s, Car B (1200kg) at 25 m/s. What's the total kinetic energy at impact?
Simulations (Requires Rapier Service)
Create a simulation of a ball dropping from 10 meters height and bouncing on the groundSimulate 5 boxes stacked on top of each other, then have another box hit them from the sideCreate a Newton's cradle with 5 spheres and record their motionSimulate a sphere rolling down a 30-degree ramp
📝 Example Scripts
The examples/ directory contains working demonstration scripts:
Ready to Run (No External Services Required)
These examples use the built-in analytic provider and work immediately:
00_quick_start.py- Quick demo of all 5 analytic tools01_simple_projectile.py- Cannonball trajectories, basketball shots, angle comparisons02_collision_detection.py- Car crashes, near misses, asteroid collisions03_force_energy_momentum.py- F=ma, kinetic energy, momentum conservation04_r3f_visualization.py- Generate React Three Fiber visualization data
Requires Rapier Service
These examples demonstrate rigid-body simulations and Phase 1 features. They need the Rapier service running:
05_rapier_simulation.py- Bouncing balls, collisions, stacking boxes06_bounce_detection.py- Phase 1.1: Automatic bounce detection and energy analysis07_contact_events.py- Phase 1.2: Real-time contact tracking and collision events08_pendulum.py- Phase 1.3: Joints and constraints (pendulums, chains)09_phase1_complete.py- Phase 1.4: All Phase 1 features (damping, bounces, contacts, joints)10_fluid_dynamics.py- Phase 1.5: Fluid calculations (drag, buoyancy, terminal velocity)11_rotational_dynamics.py- Phase 2.1: Torque, angular momentum, gyroscopes12_oscillations.py- Phase 2.2: Springs, pendulums, harmonic motion, damping13_circular_motion.py- Phase 2.3: Orbital mechanics, centripetal force14_statics.py- Phase 2.6: Static equilibrium, force balance, beam analysis15_kinematics_analysis.py- Phase 2.7: Motion analysis, trajectory fitting16_roulette_simulation.py- 🎰 Casino Roulette - Complete showcase of multi-body physics, collisions, and energy dissipation
Note:
Examples 00-04 work instantly (no external services)
Examples 05-09 showcase advanced rigid-body physics with Rapier
Use the public Rapier service at
https://rapier.chukai.ioor run your own
⚙️ Configuration
Environment Variables
YAML Configuration
Create physics.yaml in your working directory or ~/.config/chuk-mcp-physics/:
🛡️ Safety & Limits
Recommended Ranges
Understanding these limits helps prevent timeouts, instabilities, and confusion:
Parameter | Recommended | Maximum | Notes |
Units | meters, kg, seconds | - | SI units throughout |
dt | 0.008 - 0.033 | 0.001 - 0.1 | <0.008 = overkill, >0.033 = unstable |
steps | 100 - 5000 | 10,000 | Depends on dt and complexity |
bodies | 1 - 100 | 1,000 | Performance degrades >100 |
gravity | -20 to 0 m/s² | -100 to +100 | Earth = -9.81 |
velocity | 0 - 100 m/s | 1,000 m/s | Very high speeds may cause tunneling |
mass | 0.1 - 10,000 kg | 1e-6 - 1e6 | Extreme ratios cause instability |
Public Service Limits
The public Rapier service at https://rapier.chukai.io has these limits:
Max steps per call: 5,000
Max bodies per simulation: 100
Max concurrent simulations: 10 per IP
Request timeout: 30 seconds
Max simulation lifetime: 1 hour (auto-cleanup)
For larger simulations, run your own Rapier service (see RAPIER_SERVICE.md).
Common Pitfalls
❌ Simulation explodes or bodies fly away
Symptoms:
Bodies gain extreme velocities
Objects disappear from view
NaN values in positions
Causes:
dttoo large for the forces involvedVery high mass ratios (1g object hitting 1000kg object)
Extreme initial velocities
Solutions:
Reduce
dtto 0.008 or lowerUse more similar masses (within 2-3 orders of magnitude)
Limit initial velocities to <100 m/s
❌ Simulation runs very slowly
Symptoms:
Request takes >10 seconds
Timeout errors
High CPU usage
Causes:
Too many bodies (>100)
Very small
dt(<0.005)Complex mesh colliders
Too many steps (>5000)
Solutions:
Reduce body count or simplify shapes
Increase
dt(balance accuracy vs. speed)Break large step counts into multiple calls
Use primitive shapes (sphere, box) instead of meshes
❌ Objects tunnel through each other
Symptoms:
Fast-moving objects pass through walls
Collisions not detected
Objects appear inside each other
Causes:
Very high velocities + large
dtThin colliders (<0.1m)
Disabled continuous collision detection (CCD)
Solutions:
Reduce
dtfor high-speed scenariosThicken colliders (minimum 0.1m recommended)
Reduce velocities
Enable CCD if available (future feature)
Best Practices
Start simple: Test with 2-3 bodies before scaling up
Validate inputs: Check for NaN, Inf, extreme values before simulation
Monitor performance: Track step time, adjust
dt/steps accordinglyCleanup: Always
destroy_simulationwhen done (prevent memory leaks)Use analytic when possible: For simple scenarios, analytic is faster and exact
🔧 Development
🐳 Docker Deployment
☁️ Production Deployment
Live Public Services
Current Production Services:
MCP Physics Server: https://physics.chukai.io/mcp
Public hosted MCP server endpoint
No local installation required
Pre-configured with Rapier service
Ready to use in Claude Desktop
Rapier Physics Engine: https://rapier.chukai.io
Public API for physics simulations
No authentication required for basic usage
Rate limits may apply
Quick Test:
Deploy Your Own Rapier Service
If you need your own private Rapier service instance:
1. Deploy Rapier Service to Fly.io with Redis
Redis Benefits:
✅ Horizontal scaling (multiple service instances share state)
✅ Automatic cleanup (TTL-based simulation expiration)
✅ Distributed coordination across instances
✅ Session persistence within TTL window
Configuration:
The service uses Redis automatically on Fly.io (see rapier-service/fly.toml). For local development, it defaults to in-memory storage.
See rapier-service/FLY_REDIS_SETUP.md for detailed Redis setup guide, monitoring, and troubleshooting.
2. Configure chuk-mcp-physics to Use Your Service
Why deploy your own?
🔒 Private instance for production workloads
📈 Custom scaling and resource allocation
🌍 Deploy closer to your users (different regions)
💾 Persistent simulations and custom configurations
See DEPLOYMENT.md for complete deployment guide, scaling strategies, and CI/CD setup.
🦀 Rapier Service Setup
For full rigid-body simulations, you have several options:
Option 1: Use Public Service (Easiest)
Option 2: Run Locally with Docker
Option 3: Build from Source
See RAPIER_SERVICE.md for:
Complete API specification
Rust implementation guide
Docker deployment details
Testing examples
📊 Comparison: Analytic vs Rapier
Feature | Analytic Provider | Rapier Provider |
Projectile motion | ✅ Exact (kinematic eqs) | ✅ Simulated |
Simple collisions | ✅ Exact (sphere-sphere, elastic) | ✅ Simulated |
Force/energy/momentum | ✅ F=ma, KE, PE, momentum, work/power | ✅ Can derive from sim |
Fluid dynamics | ✅ Drag, buoyancy, terminal velocity | ❌ Not supported |
Rigid-body dynamics | ❌ Not supported | ✅ Full 3D/2D physics |
Complex shapes | ❌ Spheres only | ✅ Box, capsule, mesh, etc |
Friction/restitution | ❌ Not modeled | ✅ Full material properties |
Multi-body systems | ❌ Not supported | ✅ Unlimited bodies |
Constraints/joints | ❌ Not supported | ✅ Hinges, sliders, etc |
Performance | ⚡ Instant | 🐇 Fast (Rust) |
Setup | 📦 Built-in | 🦀 Requires Rapier service |
Recommendation:
Use Analytic for simple calculations, education, quick answers
Use Rapier for complex simulations, games, visualizations, multi-body dynamics
🤝 Contributing
Contributions welcome! Please see CONTRIBUTING.md.
📄 License
MIT License - see LICENSE for details.
🙏 Acknowledgments
Rapier - Fast 2D/3D physics engine in Rust
chuk-mcp-server - MCP server framework
Model Context Protocol - Protocol specification
📚 See Also
RAPIER_SERVICE.md - Rapier microservice specification
Examples - Example usage patterns
API Documentation - Detailed tool reference