@sknoble/slvsx-mcp-server 0.1.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/LICENSE +40 -0
- package/README.md +181 -0
- package/dist/docs.json +69214 -0
- package/mcp-server.js +598 -0
- package/package.json +46 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# SLVSX License
|
|
2
|
+
|
|
3
|
+
SLVSX - A command-line interface for SolveSpace constraint solver
|
|
4
|
+
Copyright (C) 2024 Steven and Contributors
|
|
5
|
+
|
|
6
|
+
This program is free software: you can redistribute it and/or modify
|
|
7
|
+
it under the terms of the GNU General Public License as published by
|
|
8
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
(at your option) any later version.
|
|
10
|
+
|
|
11
|
+
This program is distributed in the hope that it will be useful,
|
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
GNU General Public License for more details.
|
|
15
|
+
|
|
16
|
+
You should have received a copy of the GNU General Public License
|
|
17
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
18
|
+
|
|
19
|
+
## Attribution
|
|
20
|
+
|
|
21
|
+
This software incorporates code from:
|
|
22
|
+
|
|
23
|
+
### SolveSpace
|
|
24
|
+
Copyright 2008-2024 SolveSpace contributors
|
|
25
|
+
Licensed under GPLv3
|
|
26
|
+
Source: https://github.com/solvespace/solvespace
|
|
27
|
+
|
|
28
|
+
The libslvs library included in this distribution is part of SolveSpace
|
|
29
|
+
and is used under the terms of the GPLv3 license.
|
|
30
|
+
|
|
31
|
+
### Original SolveSpace Authors
|
|
32
|
+
- Jonathan Westhues (original author)
|
|
33
|
+
- whitequark
|
|
34
|
+
- Paul Kahler
|
|
35
|
+
- Marc Britten
|
|
36
|
+
- And many other contributors
|
|
37
|
+
|
|
38
|
+
## Third-Party Dependencies
|
|
39
|
+
|
|
40
|
+
See Cargo.toml for a complete list of Rust dependencies and their licenses.
|
package/README.md
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# SLVSX - SolveSpace Constraint Solver CLI
|
|
2
|
+
|
|
3
|
+
[](https://github.com/snoble/slvsx-cli/actions)
|
|
4
|
+
[](https://codecov.io/gh/snoble/slvsx-cli)
|
|
5
|
+
|
|
6
|
+
A command-line tool that makes the SolveSpace geometric constraint solver accessible to AI agents and developers through a simple JSON interface.
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
- 🤖 **AI-Ready** - Designed for use by AI agents through subprocess calls
|
|
11
|
+
- 📦 **Static Binary** - Single executable with no dependencies
|
|
12
|
+
- 🔧 **JSON Interface** - Simple input/output format
|
|
13
|
+
- 🎯 **Constraint Solving** - Points, lines, circles, distances, angles, and more
|
|
14
|
+
- 📐 **Export Formats** - SVG, DXF, STL output
|
|
15
|
+
- 🚀 **Fast** - Native C++ solver wrapped in Rust
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
### Download Static Binary (Recommended)
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Linux (x86_64)
|
|
23
|
+
curl -L https://github.com/snoble/slvsx-cli/releases/latest/download/slvsx-linux.tar.gz | tar xz
|
|
24
|
+
sudo mv slvsx /usr/local/bin/
|
|
25
|
+
|
|
26
|
+
# macOS (Apple Silicon)
|
|
27
|
+
curl -L https://github.com/snoble/slvsx-cli/releases/latest/download/slvsx-macos-arm64.tar.gz | tar xz
|
|
28
|
+
sudo mv slvsx /usr/local/bin/
|
|
29
|
+
|
|
30
|
+
# macOS (Intel)
|
|
31
|
+
curl -L https://github.com/snoble/slvsx-cli/releases/latest/download/slvsx-macos-x86_64.tar.gz | tar xz
|
|
32
|
+
sudo mv slvsx /usr/local/bin/
|
|
33
|
+
|
|
34
|
+
# Test installation
|
|
35
|
+
slvsx --version
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Build from Source
|
|
39
|
+
|
|
40
|
+
See [docs/BUILDING.md](docs/BUILDING.md) for detailed build instructions.
|
|
41
|
+
|
|
42
|
+
## Quick Start
|
|
43
|
+
|
|
44
|
+
### Try It Now
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Solve a triangle from distances
|
|
48
|
+
slvsx solve examples/02_triangle.json
|
|
49
|
+
|
|
50
|
+
# Create a parametric hinge mechanism
|
|
51
|
+
slvsx solve examples/08_angles.json
|
|
52
|
+
|
|
53
|
+
# Design a symmetric arrowhead
|
|
54
|
+
slvsx solve examples/11_symmetric.json
|
|
55
|
+
|
|
56
|
+
# Export to SVG for visualization
|
|
57
|
+
slvsx export -f svg examples/08_angles.json -o output.svg
|
|
58
|
+
|
|
59
|
+
# Export 3D objects from multiple angles
|
|
60
|
+
slvsx export -f svg -v xy examples/04_3d_tetrahedron.json -o top.svg
|
|
61
|
+
slvsx export -f svg -v xz examples/04_3d_tetrahedron.json -o front.svg
|
|
62
|
+
slvsx export -f svg -v yz examples/04_3d_tetrahedron.json -o side.svg
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**🎨 See the [Visual Gallery](docs/VISUAL_GALLERY.md) for cool renders and 3D visualizations!**
|
|
66
|
+
|
|
67
|
+
### Basic Example: Triangle from Distances
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Create a simple constraint problem
|
|
71
|
+
cat > triangle.json << 'EOF'
|
|
72
|
+
{
|
|
73
|
+
"schema": "slvs-json/1",
|
|
74
|
+
"units": "mm",
|
|
75
|
+
"entities": [
|
|
76
|
+
{"type": "point", "id": "A", "at": [0, 0, 0]},
|
|
77
|
+
{"type": "point", "id": "B", "at": [100, 0, 0]},
|
|
78
|
+
{"type": "point", "id": "C", "at": [50, 50, 0]}
|
|
79
|
+
],
|
|
80
|
+
"constraints": [
|
|
81
|
+
{"type": "fixed", "entity": "A"},
|
|
82
|
+
{"type": "fixed", "entity": "B"},
|
|
83
|
+
{"type": "distance", "between": ["A", "C"], "value": 80},
|
|
84
|
+
{"type": "distance", "between": ["B", "C"], "value": 60}
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
EOF
|
|
88
|
+
|
|
89
|
+
# Solve it
|
|
90
|
+
slvsx solve triangle.json
|
|
91
|
+
|
|
92
|
+
# Export to SVG
|
|
93
|
+
slvsx export -f svg triangle.json > triangle.svg
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**What this does**: Given two fixed points and distances to a third point, SLVSX calculates where the third point must be. This is triangulation - the same math used in GPS!
|
|
97
|
+
|
|
98
|
+
See [SHOWCASE.md](SHOWCASE.md) for impressive examples, [docs/AI_GUIDE.md](docs/AI_GUIDE.md) for AI agent usage, and [docs/ITERATIVE_DESIGN.md](docs/ITERATIVE_DESIGN.md) for best practices on building constraint problems iteratively.
|
|
99
|
+
|
|
100
|
+
### Commands
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
slvsx solve input.json # Solve constraints
|
|
104
|
+
slvsx validate input.json # Check validity
|
|
105
|
+
slvsx export -f svg input.json # Export to SVG
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Use from Python
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
import json, subprocess
|
|
112
|
+
|
|
113
|
+
def solve(problem):
|
|
114
|
+
result = subprocess.run(
|
|
115
|
+
['slvsx', 'solve', '-'],
|
|
116
|
+
input=json.dumps(problem),
|
|
117
|
+
capture_output=True,
|
|
118
|
+
text=True
|
|
119
|
+
)
|
|
120
|
+
return json.loads(result.stdout) if result.returncode == 0 else None
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## For AI Agents
|
|
124
|
+
|
|
125
|
+
SLVSX is designed to be used by AI agents for solving geometric constraint problems. Perfect for:
|
|
126
|
+
|
|
127
|
+
- **Constraint-based design generation** - Describe what you want, not how to draw it
|
|
128
|
+
- **Mechanism validation** - Check if designs are physically possible
|
|
129
|
+
- **Parametric optimization** - Explore design spaces systematically
|
|
130
|
+
- **Mathematical precision** - Get exact solutions, not approximations
|
|
131
|
+
|
|
132
|
+
**Quick Links**:
|
|
133
|
+
- [AI Agent Guide](docs/AI_GUIDE.md) - Complete guide for AI usage
|
|
134
|
+
- [Showcase](SHOWCASE.md) - Impressive examples and use cases
|
|
135
|
+
- [MCP Integration Guide](docs/MCP_INTEGRATION.md) - Use with Claude Desktop
|
|
136
|
+
- [AI Examples](examples/ai-examples/) - Ready-to-use constraint problems
|
|
137
|
+
|
|
138
|
+
## Examples
|
|
139
|
+
|
|
140
|
+
The [`examples/`](examples/) directory contains many constraint problems:
|
|
141
|
+
|
|
142
|
+
### 🎯 Quick Wins
|
|
143
|
+
- **[Triangle Solver](examples/02_triangle.json)** - Triangulation from distances
|
|
144
|
+
- **[Angle Hinge](examples/08_angles.json)** - Parametric hinge mechanism
|
|
145
|
+
- **[Symmetric Arrow](examples/11_symmetric.json)** - Symmetry constraints
|
|
146
|
+
|
|
147
|
+
### 🔧 Real-World Applications
|
|
148
|
+
- **[Four-Bar Linkage](examples/ai-examples/four_bar_linkage.json)** - Classic kinematic mechanism
|
|
149
|
+
- **[Planetary Gears](examples/ai-examples/gear_meshing.json)** - Gear train positioning
|
|
150
|
+
- **[3D Tetrahedron](examples/04_3d_tetrahedron.json)** - Three-dimensional geometry
|
|
151
|
+
|
|
152
|
+
### 📚 Learning Path
|
|
153
|
+
- **[Tutorial Series](examples/README.md)** - Step-by-step learning guide
|
|
154
|
+
- **[Constraint Reference](examples/constraints/)** - Detailed constraint examples
|
|
155
|
+
|
|
156
|
+
See [SHOWCASE.md](SHOWCASE.md) for more impressive examples and use cases!
|
|
157
|
+
|
|
158
|
+
## Documentation
|
|
159
|
+
|
|
160
|
+
### Getting Started
|
|
161
|
+
- [Showcase](SHOWCASE.md) - What can you build? Impressive examples
|
|
162
|
+
- [Visual Gallery](docs/VISUAL_GALLERY.md) - 🎨 Cool renders and visualizations
|
|
163
|
+
- [AI Agent Guide](docs/AI_GUIDE.md) - Complete guide for AI usage
|
|
164
|
+
- [Examples Tutorial](examples/README.md) - Step-by-step learning
|
|
165
|
+
|
|
166
|
+
### Reference
|
|
167
|
+
- [Building from Source](docs/BUILDING.md)
|
|
168
|
+
- [MCP Integration](docs/MCP_INTEGRATION.md)
|
|
169
|
+
- [Development Guide](docs/DEVELOPMENT.md)
|
|
170
|
+
- [JSON Schema](schema/slvs-json.schema.json)
|
|
171
|
+
|
|
172
|
+
### For AI Agents
|
|
173
|
+
- [AI Guide](docs/AI_GUIDE.md) - Patterns, examples, best practices
|
|
174
|
+
- [MCP Integration](docs/MCP_INTEGRATION.md) - Use with Claude Desktop
|
|
175
|
+
- [AI Examples](examples/ai-examples/) - Ready-to-use problems
|
|
176
|
+
|
|
177
|
+
## License
|
|
178
|
+
|
|
179
|
+
GPLv3 - See [LICENSE](LICENSE) file for details.
|
|
180
|
+
|
|
181
|
+
Built on top of [SolveSpace](https://solvespace.com/)'s constraint solver library.
|