cyclecad 0.2.2 โ 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/API-BUILD-MANIFEST.txt +339 -0
- package/API-SERVER.md +535 -0
- package/Architecture-Deck.pptx +0 -0
- package/CLAUDE.md +172 -11
- package/CLI-BUILD-SUMMARY.md +504 -0
- package/CLI-INDEX.md +356 -0
- package/CLI-README.md +466 -0
- package/COLLABORATION-INTEGRATION-GUIDE.md +325 -0
- package/CONNECTED_FABS_GUIDE.md +612 -0
- package/CONNECTED_FABS_README.md +310 -0
- package/DELIVERABLES.md +343 -0
- package/DFM-ANALYZER-INTEGRATION.md +368 -0
- package/DFM-QUICK-START.js +253 -0
- package/Dockerfile +69 -0
- package/IMPLEMENTATION.md +327 -0
- package/LICENSE +31 -0
- package/MARKETPLACE_QUICK_REFERENCE.txt +294 -0
- package/MCP-INDEX.md +264 -0
- package/QUICKSTART-API.md +388 -0
- package/QUICKSTART-CLI.md +211 -0
- package/QUICKSTART-MCP.md +196 -0
- package/README-MCP.md +208 -0
- package/TEST-TOKEN-ENGINE.md +319 -0
- package/TOKEN-ENGINE-SUMMARY.md +266 -0
- package/TOKENS-README.md +263 -0
- package/TOOLS-REFERENCE.md +254 -0
- package/app/index.html +373 -3
- package/app/js/TOKEN-INTEGRATION.md +391 -0
- package/app/js/agent-api.js +3 -3
- package/app/js/ai-copilot.js +1435 -0
- package/app/js/cad-vr.js +917 -0
- package/app/js/cam-operations.js +638 -0
- package/app/js/cam-pipeline.js +840 -0
- package/app/js/collaboration-ui.js +995 -0
- package/app/js/collaboration.js +1116 -0
- package/app/js/connected-fabs-example.js +404 -0
- package/app/js/connected-fabs.js +1449 -0
- package/app/js/dfm-analyzer.js +1760 -0
- package/app/js/gcode-generator.js +485 -0
- package/app/js/gdt-training.js +1144 -0
- package/app/js/machine-profiles.js +534 -0
- package/app/js/marketplace-v2.js +766 -0
- package/app/js/marketplace.js +1994 -0
- package/app/js/material-library.js +2115 -0
- package/app/js/misumi-catalog.js +904 -0
- package/app/js/section-view.js +666 -0
- package/app/js/sketch-enhance.js +779 -0
- package/app/js/stock-manager.js +482 -0
- package/app/js/text-to-cad.js +806 -0
- package/app/js/token-dashboard.js +563 -0
- package/app/js/token-engine.js +743 -0
- package/app/js/tool-library.js +593 -0
- package/app/test-agent.html +1801 -0
- package/app/tutorials/advanced.html +1924 -0
- package/app/tutorials/basic.html +1160 -0
- package/app/tutorials/intermediate.html +1456 -0
- package/bin/cyclecad-cli.js +662 -0
- package/bin/cyclecad-mcp +2 -0
- package/bin/server.js +242 -0
- package/cycleCAD-Architecture.pptx +0 -0
- package/cycleCAD-Investor-Deck.pptx +0 -0
- package/demo-mcp.sh +60 -0
- package/docs/API-SERVER-SUMMARY.md +375 -0
- package/docs/API-SERVER.md +667 -0
- package/docs/CAM-EXAMPLES.md +344 -0
- package/docs/CAM-INTEGRATION.md +612 -0
- package/docs/CAM-QUICK-REFERENCE.md +199 -0
- package/docs/CLI-INTEGRATION.md +510 -0
- package/docs/CLI.md +872 -0
- package/docs/MARKETPLACE-API-SCHEMA.json +564 -0
- package/docs/MARKETPLACE-INTEGRATION.md +467 -0
- package/docs/MARKETPLACE-SETUP.html +439 -0
- package/docs/MCP-SERVER.md +403 -0
- package/examples/api-client-example.js +488 -0
- package/examples/api-client-example.py +359 -0
- package/examples/batch-manufacturing.txt +28 -0
- package/examples/batch-simple.txt +26 -0
- package/linkedin-post-combined.md +31 -0
- package/model-marketplace.html +1273 -0
- package/package.json +14 -3
- package/server/api-server.js +1120 -0
- package/server/mcp-server.js +1161 -0
- package/test-api-server.js +432 -0
- package/test-mcp.js +198 -0
- package/~$cycleCAD-Investor-Deck.pptx +0 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
# cycleCAD CLI Quick Start
|
|
2
|
+
|
|
3
|
+
Get started with the cycleCAD command-line interface in 5 minutes.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Install globally
|
|
9
|
+
npm install -g cyclecad
|
|
10
|
+
|
|
11
|
+
# Or use locally in the project
|
|
12
|
+
cd ~/cyclecad
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Start the Server
|
|
16
|
+
|
|
17
|
+
In one terminal:
|
|
18
|
+
```bash
|
|
19
|
+
# Start mock server (for development)
|
|
20
|
+
node bin/server.js
|
|
21
|
+
|
|
22
|
+
# Output:
|
|
23
|
+
# cyclecad Agent API mock server running on http://localhost:3000
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Basic Commands
|
|
27
|
+
|
|
28
|
+
In another terminal, try these commands:
|
|
29
|
+
|
|
30
|
+
### 1. Create a Shape
|
|
31
|
+
```bash
|
|
32
|
+
node bin/cyclecad-cli.js shape.cylinder --radius 25 --height 80
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Output:
|
|
36
|
+
```
|
|
37
|
+
[10:37:35] โ Command executed: shape.cylinder
|
|
38
|
+
Entity ID: cylinder_1774521455193
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 2. Create a Box
|
|
42
|
+
```bash
|
|
43
|
+
node bin/cyclecad-cli.js shape.box --width 50 --height 40 --depth 30
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 3. Sketch Operations
|
|
47
|
+
```bash
|
|
48
|
+
# Start sketch
|
|
49
|
+
node bin/cyclecad-cli.js sketch.start --plane XY
|
|
50
|
+
|
|
51
|
+
# Draw a circle
|
|
52
|
+
node bin/cyclecad-cli.js sketch.circle --cx 0 --cy 0 --radius 15
|
|
53
|
+
|
|
54
|
+
# End sketch
|
|
55
|
+
node bin/cyclecad-cli.js sketch.end
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 4. Features
|
|
59
|
+
```bash
|
|
60
|
+
# Extrude
|
|
61
|
+
node bin/cyclecad-cli.js feature.extrude --height 10
|
|
62
|
+
|
|
63
|
+
# Add fillet
|
|
64
|
+
node bin/cyclecad-cli.js feature.fillet --radius 5 --edges all
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 5. Validation
|
|
68
|
+
```bash
|
|
69
|
+
# Check dimensions
|
|
70
|
+
node bin/cyclecad-cli.js validate.dimensions --target extrude_1
|
|
71
|
+
|
|
72
|
+
# Estimate cost
|
|
73
|
+
node bin/cyclecad-cli.js validate.cost --target extrude_1 --process CNC --material aluminum
|
|
74
|
+
|
|
75
|
+
# Estimate weight
|
|
76
|
+
node bin/cyclecad-cli.js validate.mass --target extrude_1 --material aluminum
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### 6. Export
|
|
80
|
+
```bash
|
|
81
|
+
# Export to STL
|
|
82
|
+
node bin/cyclecad-cli.js export.stl --filename my-part.stl --binary true
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Get Help
|
|
86
|
+
|
|
87
|
+
### List all commands
|
|
88
|
+
```bash
|
|
89
|
+
node bin/cyclecad-cli.js --list
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Get help for a specific command
|
|
93
|
+
```bash
|
|
94
|
+
node bin/cyclecad-cli.js --describe shape.cylinder
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Show version
|
|
98
|
+
```bash
|
|
99
|
+
node bin/cyclecad-cli.js --version
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Output Modes
|
|
103
|
+
|
|
104
|
+
### Pretty-printed (default)
|
|
105
|
+
```bash
|
|
106
|
+
node bin/cyclecad-cli.js shape.cylinder --radius 25 --height 80
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### JSON output (for scripts)
|
|
110
|
+
```bash
|
|
111
|
+
node bin/cyclecad-cli.js shape.cylinder --radius 25 --height 80 --json
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Quiet mode (suppress status messages)
|
|
115
|
+
```bash
|
|
116
|
+
node bin/cyclecad-cli.js shape.cylinder --radius 25 --height 80 --quiet
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Interactive REPL
|
|
120
|
+
|
|
121
|
+
Start an interactive session:
|
|
122
|
+
```bash
|
|
123
|
+
node bin/cyclecad-cli.js --interactive
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Then type commands directly:
|
|
127
|
+
```
|
|
128
|
+
cyclecad> shape.cylinder --radius 25 --height 80
|
|
129
|
+
โ Command executed: shape.cylinder
|
|
130
|
+
|
|
131
|
+
cyclecad> validate.cost --target cylinder_1 --process FDM
|
|
132
|
+
[10:37:35] โ Command executed: validate.cost
|
|
133
|
+
|
|
134
|
+
cyclecad> help
|
|
135
|
+
Available Commands
|
|
136
|
+
...
|
|
137
|
+
|
|
138
|
+
cyclecad> exit
|
|
139
|
+
Goodbye!
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Batch Mode
|
|
143
|
+
|
|
144
|
+
Create a script file `my-commands.txt`:
|
|
145
|
+
```
|
|
146
|
+
shape.cylinder --radius 25 --height 80
|
|
147
|
+
feature.fillet --radius 3 --edges all
|
|
148
|
+
validate.dimensions --target cylinder_1
|
|
149
|
+
export.stl --filename output.stl
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Execute it:
|
|
153
|
+
```bash
|
|
154
|
+
node bin/cyclecad-cli.js --batch my-commands.txt
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Use from Shell Scripts
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
#!/bin/bash
|
|
161
|
+
|
|
162
|
+
# Create and export a part
|
|
163
|
+
ENTITY=$(node bin/cyclecad-cli.js shape.cylinder --radius 25 --height 80 --json | jq -r '.entityId')
|
|
164
|
+
echo "Created entity: $ENTITY"
|
|
165
|
+
|
|
166
|
+
node bin/cyclecad-cli.js feature.fillet --radius 5 --edges all --quiet
|
|
167
|
+
node bin/cyclecad-cli.js export.stl --filename bracket.stl
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Next Steps
|
|
171
|
+
|
|
172
|
+
- Read the full [CLI documentation](docs/CLI.md)
|
|
173
|
+
- Check out example batch files in `examples/`
|
|
174
|
+
- Integrate with your CAD workflow
|
|
175
|
+
- Build automation scripts
|
|
176
|
+
|
|
177
|
+
## Troubleshooting
|
|
178
|
+
|
|
179
|
+
### "Connection failed"
|
|
180
|
+
Make sure the server is running in another terminal:
|
|
181
|
+
```bash
|
|
182
|
+
node bin/server.js
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### "Unknown command"
|
|
186
|
+
List available commands:
|
|
187
|
+
```bash
|
|
188
|
+
node bin/cyclecad-cli.js --list
|
|
189
|
+
node bin/cyclecad-cli.js --describe <command>
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### JSON parsing errors
|
|
193
|
+
Make sure you're in the right directory and have Node.js 14+ installed:
|
|
194
|
+
```bash
|
|
195
|
+
node --version
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Key Features
|
|
199
|
+
|
|
200
|
+
โ
**Zero dependencies** โ Pure Node.js built-ins
|
|
201
|
+
โ
**Colored output** โ Easy to read terminal UI
|
|
202
|
+
โ
**JSON support** โ Perfect for scripting
|
|
203
|
+
โ
**Interactive mode** โ Great for exploration
|
|
204
|
+
โ
**Batch processing** โ Automate workflows
|
|
205
|
+
โ
**Tab completion** โ Type less, do more
|
|
206
|
+
โ
**Command history** โ Replay previous commands
|
|
207
|
+
โ
**Extensible** โ Easy to add new commands
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
For the full API reference, see [docs/CLI.md](docs/CLI.md)
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# cycleCAD MCP Server โ Quick Start
|
|
2
|
+
|
|
3
|
+
## 30-Second Setup
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
# Terminal 1: Start cycleCAD web server
|
|
7
|
+
npm start
|
|
8
|
+
|
|
9
|
+
# Terminal 2: Start MCP server
|
|
10
|
+
npm run mcp
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Done! The server is now ready to receive MCP requests from Claude.
|
|
14
|
+
|
|
15
|
+
## Integration with Claude
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
import anthropic
|
|
19
|
+
|
|
20
|
+
client = anthropic.Anthropic()
|
|
21
|
+
|
|
22
|
+
response = client.messages.create(
|
|
23
|
+
model="claude-3-5-sonnet-20241022",
|
|
24
|
+
max_tokens=2048,
|
|
25
|
+
tools=[{
|
|
26
|
+
"type": "model_context_protocol",
|
|
27
|
+
"name": "cyclecad-mcp",
|
|
28
|
+
"uri": "stdio:///absolute/path/to/cyclecad/bin/cyclecad-mcp"
|
|
29
|
+
}],
|
|
30
|
+
messages=[{
|
|
31
|
+
"role": "user",
|
|
32
|
+
"content": "Design a bracket: 80x40mm rectangle, extrude 5mm, add a 3mm hole for a bolt"
|
|
33
|
+
}]
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
print(response.content[0].text)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Claude will automatically call cycleCAD tools to design the part.
|
|
40
|
+
|
|
41
|
+
## What You Can Do
|
|
42
|
+
|
|
43
|
+
### Ask Claude to design parts
|
|
44
|
+
- "Create a cylinder 50mm diameter, 100mm tall"
|
|
45
|
+
- "Design a bracket: 80x40mm, 5mm thick, with a hole"
|
|
46
|
+
- "Make a spring with 10mm radius, 20mm height, 5 turns"
|
|
47
|
+
|
|
48
|
+
### Ask Claude to analyze designs
|
|
49
|
+
- "Is this part printable with FDM?"
|
|
50
|
+
- "What's the weight if made from aluminum?"
|
|
51
|
+
- "Check the design for manufacturing issues"
|
|
52
|
+
|
|
53
|
+
### Ask Claude to modify designs
|
|
54
|
+
- "Add a 2mm fillet to all edges"
|
|
55
|
+
- "Chamfer the corners by 1mm"
|
|
56
|
+
- "Create 3 copies of this in a 10mm grid"
|
|
57
|
+
|
|
58
|
+
### Ask Claude to export
|
|
59
|
+
- "Export as STL for 3D printing"
|
|
60
|
+
- "Save as OBJ for rendering"
|
|
61
|
+
- "Export as glTF for web viewing"
|
|
62
|
+
|
|
63
|
+
## Debug Mode
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# See all requests and responses
|
|
67
|
+
DEBUG_MCP=1 npm run mcp
|
|
68
|
+
|
|
69
|
+
# Or
|
|
70
|
+
npx cyclecad-mcp --debug
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Configuration
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Custom cycleCAD server URL
|
|
77
|
+
npx cyclecad-mcp --ws-url ws://10.0.0.1:3000/api/ws
|
|
78
|
+
|
|
79
|
+
# Custom HTTP fallback URL
|
|
80
|
+
npx cyclecad-mcp --http-url http://10.0.0.1:3000/api/execute
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## All Tools (55+)
|
|
84
|
+
|
|
85
|
+
**Sketch** (8): start, end, line, rect, circle, arc, clear, entities
|
|
86
|
+
|
|
87
|
+
**Design** (20): extrude, revolve, primitive, fillet, chamfer, boolean, shell, pattern, material, sweep, loft, spring, thread, bend
|
|
88
|
+
|
|
89
|
+
**Transform** (3): move, rotate, scale
|
|
90
|
+
|
|
91
|
+
**View** (4): set, fit, wireframe, grid
|
|
92
|
+
|
|
93
|
+
**Export** (4): stl, obj, gltf, json
|
|
94
|
+
|
|
95
|
+
**Validate** (8): dimensions, wallThickness, printability, cost, mass, surfaceArea, centerOfMass, designReview
|
|
96
|
+
|
|
97
|
+
**Render** (5): snapshot, multiview, highlight, hide, section
|
|
98
|
+
|
|
99
|
+
**Query** (5): features, bbox, materials, session, log
|
|
100
|
+
|
|
101
|
+
**Assembly** (4): addComponent, removeComponent, mate, explode
|
|
102
|
+
|
|
103
|
+
**AI** (3): identifyPart, suggestImprovements, estimateCostAI
|
|
104
|
+
|
|
105
|
+
**Meta** (5): ping, version, schema, modules, history
|
|
106
|
+
|
|
107
|
+
**Scene** (2): clear, snapshot
|
|
108
|
+
|
|
109
|
+
## Full Documentation
|
|
110
|
+
|
|
111
|
+
- **Complete Reference**: `docs/MCP-SERVER.md`
|
|
112
|
+
- **Implementation Details**: `IMPLEMENTATION.md`
|
|
113
|
+
- **Examples & Workflows**: (See examples in this file)
|
|
114
|
+
|
|
115
|
+
## Troubleshooting
|
|
116
|
+
|
|
117
|
+
**"Connection refused"**
|
|
118
|
+
- Make sure cycleCAD is running: `npm start`
|
|
119
|
+
- Check it's on localhost:3000: `curl http://localhost:3000`
|
|
120
|
+
|
|
121
|
+
**"WebSocket not available"**
|
|
122
|
+
- MCP server falls back to HTTP automatically
|
|
123
|
+
- No action needed
|
|
124
|
+
|
|
125
|
+
**"No response from cycleCAD"**
|
|
126
|
+
- cycleCAD may not be running or Agent API not accessible
|
|
127
|
+
- Commands are queued and will execute when cycleCAD connects
|
|
128
|
+
- Check `DEBUG_MCP=1 npm run mcp` for more info
|
|
129
|
+
|
|
130
|
+
**"Tool not found"**
|
|
131
|
+
- Tool names use underscores: `sketch_rect` not `sketch.rect`
|
|
132
|
+
- See list of all tools above
|
|
133
|
+
|
|
134
|
+
## Performance
|
|
135
|
+
|
|
136
|
+
- **Startup**: ~100ms
|
|
137
|
+
- **Tool invocation**: <50ms
|
|
138
|
+
- **Command execution**: Varies (depends on cycleCAD operation)
|
|
139
|
+
- **Memory**: ~50MB
|
|
140
|
+
|
|
141
|
+
## Architecture
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
You (write prompts)
|
|
145
|
+
โ
|
|
146
|
+
Claude API
|
|
147
|
+
โ
|
|
148
|
+
Claude calls cycleCAD tools via MCP
|
|
149
|
+
โ
|
|
150
|
+
MCP Server (cyclecad-mcp)
|
|
151
|
+
โ
|
|
152
|
+
cycleCAD (Three.js scene)
|
|
153
|
+
โ
|
|
154
|
+
Design output (STL, OBJ, glTF, or rendered)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Environment Variables
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
CYCLECAD_WS_URL=ws://localhost:3000/api/ws
|
|
161
|
+
CYCLECAD_HTTP_URL=http://localhost:3000/api/execute
|
|
162
|
+
DEBUG_MCP=1 # Enable debug logging
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Next Steps
|
|
166
|
+
|
|
167
|
+
1. Start cycleCAD: `npm start`
|
|
168
|
+
2. Start MCP server: `npm run mcp`
|
|
169
|
+
3. Use with Claude API (see Integration section above)
|
|
170
|
+
4. Read full docs: `docs/MCP-SERVER.md`
|
|
171
|
+
|
|
172
|
+
## Example Interaction
|
|
173
|
+
|
|
174
|
+
**You to Claude:**
|
|
175
|
+
> "Design a simple bracket for mounting a motor. Make it 100x80mm base, 10mm thick, with 4 mounting holes (8mm diameter) spaced 10mm from the edges. Add 2mm fillets to all edges."
|
|
176
|
+
|
|
177
|
+
**Claude calls tools (automatically):**
|
|
178
|
+
1. `sketch.start` (XY plane)
|
|
179
|
+
2. `sketch.rect` (width: 100, height: 80)
|
|
180
|
+
3. `ops.extrude` (height: 10, material: aluminum)
|
|
181
|
+
4. `sketch.start` (XY plane)
|
|
182
|
+
5. `sketch.circle` (radius: 4, at each corner)
|
|
183
|
+
6. `ops.extrude` (height: 10)
|
|
184
|
+
7. `ops.boolean` (union) [x4 for each hole]
|
|
185
|
+
8. `ops.fillet` (radius: 2, all edges)
|
|
186
|
+
9. `validate.designReview` (check printability)
|
|
187
|
+
10. `export.stl` (filename: bracket.stl)
|
|
188
|
+
|
|
189
|
+
**Claude to you:**
|
|
190
|
+
> "I've designed a mounting bracket with the specifications you requested. It's 100x80mm with 10mm thickness, has 4 mounting holes at the corners with 2mm fillets on all edges. The design is optimized for 3D printing and the file has been exported as bracket.stl."
|
|
191
|
+
|
|
192
|
+
## Support
|
|
193
|
+
|
|
194
|
+
- **Issues**: https://github.com/vvlars-cmd/cyclecad/issues
|
|
195
|
+
- **Email**: vvlars@googlemail.com
|
|
196
|
+
- **Web**: https://cyclecad.com
|
package/README-MCP.md
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
# cycleCAD MCP Server
|
|
2
|
+
|
|
3
|
+
**Model Context Protocol (MCP) server** for cycleCAD Agent API.
|
|
4
|
+
|
|
5
|
+
Exposes all 55+ design commands as MCP tools that can be called by LLMs (Claude, GPT, Gemini, etc).
|
|
6
|
+
|
|
7
|
+
## โก Quick Start
|
|
8
|
+
|
|
9
|
+
### 1. Start cycleCAD web server
|
|
10
|
+
```bash
|
|
11
|
+
npm start
|
|
12
|
+
# Runs on http://localhost:3000
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### 2. Start MCP server
|
|
16
|
+
```bash
|
|
17
|
+
npx cyclecad-mcp
|
|
18
|
+
# Or: npm run mcp
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The MCP server reads JSON-RPC requests from stdin and writes responses to stdout.
|
|
22
|
+
|
|
23
|
+
### 3. Use with Claude API
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
import anthropic
|
|
27
|
+
|
|
28
|
+
client = anthropic.Anthropic()
|
|
29
|
+
|
|
30
|
+
response = client.messages.create(
|
|
31
|
+
model="claude-3-5-sonnet-20241022",
|
|
32
|
+
max_tokens=2048,
|
|
33
|
+
tools=[
|
|
34
|
+
{
|
|
35
|
+
"type": "model_context_protocol",
|
|
36
|
+
"name": "cyclecad-mcp",
|
|
37
|
+
"uri": "stdio:///path/to/cyclecad/bin/cyclecad-mcp"
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
messages=[
|
|
41
|
+
{
|
|
42
|
+
"role": "user",
|
|
43
|
+
"content": "Design a bracket: 80x40mm rectangle, 5mm tall, with a 3mm hole for a bolt"
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
print(response.content[0].text)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Claude will automatically call the MCP tools to design the bracket.
|
|
52
|
+
|
|
53
|
+
## ๐ Available Tools (55+)
|
|
54
|
+
|
|
55
|
+
### Sketch Tools (8)
|
|
56
|
+
- `sketch_start`, `sketch_end`
|
|
57
|
+
- `sketch_line`, `sketch_rect`, `sketch_circle`, `sketch_arc`
|
|
58
|
+
- `sketch_clear`, `sketch_entities`
|
|
59
|
+
|
|
60
|
+
### Design Tools (20)
|
|
61
|
+
- `ops_extrude`, `ops_revolve`, `ops_primitive`
|
|
62
|
+
- `ops_fillet`, `ops_chamfer`, `ops_boolean`
|
|
63
|
+
- `ops_shell`, `ops_pattern`, `ops_material`
|
|
64
|
+
- `ops_sweep`, `ops_loft`, `ops_spring`, `ops_thread`, `ops_bend`
|
|
65
|
+
|
|
66
|
+
### Transform Tools (3)
|
|
67
|
+
- `transform_move`, `transform_rotate`, `transform_scale`
|
|
68
|
+
|
|
69
|
+
### View Tools (4)
|
|
70
|
+
- `view_set`, `view_fit`, `view_wireframe`, `view_grid`
|
|
71
|
+
|
|
72
|
+
### Export Tools (4)
|
|
73
|
+
- `export_stl`, `export_obj`, `export_gltf`, `export_json`
|
|
74
|
+
|
|
75
|
+
### Validation Tools (8)
|
|
76
|
+
- `validate_dimensions`, `validate_wallThickness`
|
|
77
|
+
- `validate_printability`, `validate_cost`, `validate_mass`
|
|
78
|
+
- `validate_surfaceArea`, `validate_centerOfMass`
|
|
79
|
+
- `validate_designReview` (A/B/C/F scoring)
|
|
80
|
+
|
|
81
|
+
### Render Tools (5)
|
|
82
|
+
- `render_snapshot`, `render_multiview`
|
|
83
|
+
- `render_highlight`, `render_hide`, `render_section`
|
|
84
|
+
|
|
85
|
+
### Query Tools (5)
|
|
86
|
+
- `query_features`, `query_bbox`, `query_materials`
|
|
87
|
+
- `query_session`, `query_log`
|
|
88
|
+
|
|
89
|
+
### Assembly Tools (4)
|
|
90
|
+
- `assembly_addComponent`, `assembly_removeComponent`
|
|
91
|
+
- `assembly_mate`, `assembly_explode`
|
|
92
|
+
|
|
93
|
+
### AI Tools (3)
|
|
94
|
+
- `ai_identifyPart`, `ai_suggestImprovements`, `ai_estimateCostAI`
|
|
95
|
+
|
|
96
|
+
### Meta Tools (5)
|
|
97
|
+
- `meta_ping`, `meta_version`, `meta_schema`, `meta_modules`, `meta_history`
|
|
98
|
+
|
|
99
|
+
### Scene Tools (2)
|
|
100
|
+
- `scene_clear`, `scene_snapshot`
|
|
101
|
+
|
|
102
|
+
## ๐ง Configuration
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# Custom WebSocket URL
|
|
106
|
+
npx cyclecad-mcp --ws-url ws://10.0.0.1:3000/api/ws
|
|
107
|
+
|
|
108
|
+
# Custom HTTP URL (fallback)
|
|
109
|
+
npx cyclecad-mcp --http-url http://10.0.0.1:3000/api/execute
|
|
110
|
+
|
|
111
|
+
# Debug mode
|
|
112
|
+
npx cyclecad-mcp --debug
|
|
113
|
+
|
|
114
|
+
# Help
|
|
115
|
+
npx cyclecad-mcp --help
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Environment variables:
|
|
119
|
+
```bash
|
|
120
|
+
export CYCLECAD_WS_URL=ws://localhost:3000/api/ws
|
|
121
|
+
export CYCLECAD_HTTP_URL=http://localhost:3000/api/execute
|
|
122
|
+
export DEBUG_MCP=1
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## ๐ Documentation
|
|
126
|
+
|
|
127
|
+
- **Full API Reference**: See `docs/MCP-SERVER.md`
|
|
128
|
+
- **Example Workflows**: See `docs/EXAMPLES.md`
|
|
129
|
+
- **Architecture**: See `docs/ARCHITECTURE.md`
|
|
130
|
+
|
|
131
|
+
## ๐งช Testing
|
|
132
|
+
|
|
133
|
+
The MCP server can be tested without Claude API:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
# Test with stdio
|
|
137
|
+
echo '{"jsonrpc": "2.0", "id": 1, "method": "initialize"}' | npx cyclecad-mcp
|
|
138
|
+
|
|
139
|
+
# Get available tools
|
|
140
|
+
echo '{"jsonrpc": "2.0", "id": 1, "method": "initialize"}' | npx cyclecad-mcp
|
|
141
|
+
echo '{"jsonrpc": "2.0", "id": 2, "method": "tools/list"}' | npx cyclecad-mcp
|
|
142
|
+
|
|
143
|
+
# Call a tool
|
|
144
|
+
echo '{"jsonrpc": "2.0", "id": 1, "method": "initialize"}' | npx cyclecad-mcp
|
|
145
|
+
echo '{"jsonrpc": "2.0", "id": 3, "method": "tools/call", "params": {"name": "sketch_rect", "arguments": {"width": 50, "height": 30}}}' | npx cyclecad-mcp
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## ๐๏ธ Architecture
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
Claude API
|
|
152
|
+
โ
|
|
153
|
+
MCP Protocol (stdio)
|
|
154
|
+
โ
|
|
155
|
+
cyclecad-mcp Server
|
|
156
|
+
โโ JSON-RPC dispatch
|
|
157
|
+
โโ Tool definitions (55+)
|
|
158
|
+
โโ Connection management
|
|
159
|
+
โโ WebSocket (preferred)
|
|
160
|
+
โโ HTTP (fallback)
|
|
161
|
+
โ
|
|
162
|
+
cycleCAD (Browser or Server)
|
|
163
|
+
โโ Agent API
|
|
164
|
+
โโ Sketch module
|
|
165
|
+
โโ Operations module
|
|
166
|
+
โโ Viewport (Three.js)
|
|
167
|
+
โโ Assembly
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## ๐ Features
|
|
171
|
+
|
|
172
|
+
- โ
**55+ Tools** โ All Agent API commands as MCP tools
|
|
173
|
+
- โ
**JSON Schema** โ Full input validation
|
|
174
|
+
- โ
**Error Handling** โ Descriptive error messages
|
|
175
|
+
- โ
**Non-blocking** โ Works even if cycleCAD not running (queues commands)
|
|
176
|
+
- โ
**Dual Transport** โ WebSocket + HTTP fallback
|
|
177
|
+
- โ
**Debug Mode** โ Full request/response logging
|
|
178
|
+
- โ
**Zero Dependencies** โ Uses only Node.js built-ins
|
|
179
|
+
|
|
180
|
+
## ๐ฆ Package Scripts
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
npm start # Start cycleCAD web server
|
|
184
|
+
npm run mcp # Start MCP server
|
|
185
|
+
npm run dev # Dev mode
|
|
186
|
+
npm run cli # CLI mode
|
|
187
|
+
npm run server # API server
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## ๐ Related Docs
|
|
191
|
+
|
|
192
|
+
- [Full MCP Server Documentation](docs/MCP-SERVER.md)
|
|
193
|
+
- [Agent API Reference](docs/AGENT-API.md)
|
|
194
|
+
- [Examples & Workflows](docs/EXAMPLES.md)
|
|
195
|
+
|
|
196
|
+
## ๐ License
|
|
197
|
+
|
|
198
|
+
MIT โ See LICENSE in root
|
|
199
|
+
|
|
200
|
+
## ๐ค Contributing
|
|
201
|
+
|
|
202
|
+
Issues & PRs welcome at https://github.com/vvlars-cmd/cyclecad
|
|
203
|
+
|
|
204
|
+
## ๐ง Contact
|
|
205
|
+
|
|
206
|
+
- Email: vvlars@googlemail.com
|
|
207
|
+
- Web: https://cyclecad.com
|
|
208
|
+
- GitHub: https://github.com/vvlars-cmd/cyclecad
|