Skip to main content
Glama
README.md
<p align="center">
  <img src="./assets/logo.png" width="130" height="130" alt="3D Mesh Optimizer MCP Logo" />
</p>

# 3D Mesh Optimizer MCP

[![Smithery Compatible](https://img.shields.io/badge/Smithery-Compatible-blue.svg)](https://smithery.ai)
[![Model Context Protocol](https://img.shields.io/badge/MCP-Standard%20v1.0-emerald.svg)](https://modelcontextprotocol.io)
[![Base L2 Settlement](https://img.shields.io/badge/Base%20L2-USDC%20x402-blue.svg)](https://base.org)
[![Tools](https://img.shields.io/badge/Tools-5%20Curated-purple.svg)](#included-tools)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)

**Automated 3D mesh decimation, Draco compression, watertight manifold auditing, and exact CSG booleans for WebGL and spatial agents.**

Built specifically for Three.js, Babylon.js, WebGL developers, game asset pipelines, and 3D spatial computing agents.

---

## ⚡ Quickstart

### Smithery Install
```bash
smithery skill add whambammy/spatial-mesh-optimizer-mcp
```

### Claude Desktop / Cursor (`claude_desktop_config.json`)
```json
{
  "mcpServers": {
    "spatial-mesh-optimizer-mcp": {
      "command": "npx",
      "args": ["-y", "@whambammy/spatial-mesh-optimizer-mcp"],
      "env": {
        "PAYMENT_WALLET": "0x9793E7269b3301893318dEa8338576Ba612F39B3",
        "BASE_RPC_URL": "https://mainnet.base.org"
      }
    }
  }
}
```

---

## 🛠️ Included Tools

| Tool Name | Price (USDC) | Capability |
| :--- | :---: | :--- |
| `optimize_3d_mesh` | $0.05 | Bakes normal maps, decimates polycount, Draco-compresses GLTF models for 3D web engines and spatial metaverses. |
| `mesh_boolean_csg_exact` | $0.050 | Exact arbitrary-precision constructive solid geometry (CSG) mesh boolean operations (Union, Difference, Intersection) that resolve coplanar facets without crashing. |
| `mesh_watertight_manifold_auditor` | $0.035 | Audits 3D geometry for non-manifold edges, T-junctions, duplicate vertices, flipped surface normals, and boundary holes before simulation or 3D fabrication. |
| `mesh_decimate_quadric_simplifier` | $0.040 | Simplifies dense 3D meshes using Quadric Error Metrics (QEM), reducing polycounts by 50-90% while preserving silhouettes, UV borders, and vertex normals. |
| `gltf_draco_mesh_quantizer` | $0.035 | Applies Draco geometry quantization and Meshopt encoding to glTF/GLB assets, reducing file payload by up to 85% for real-time spatial streaming. |


---

## 🔄 End-to-End Workflow

An agent receives a raw CAD/OBJ model -> audits manifold watertightness -> applies exact CSG difference to carve out mounting holes -> decimates polygon count by 75% -> exports a web-ready Draco-compressed GLTF.

---

## 💰 The x402 Base L2 Micropayment Protocol

When an agent invokes a tool without payment, the server responds with a deterministic `HTTP 402 Payment Required` challenge containing:
- Target tool price in USDC
- Base Native USDC Contract: `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`
- Recipient payout wallet address
- Single-use cryptographic nonce

Once broadcasted on Base L2, resubmitting with `paymentSignature` unlocks deterministic execution.

---

## 📄 License
MIT License. Created by [Whambammy](https://github.com/Whambammy).