@bitbybit-dev/mcp 1.3.2-rc.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 +21 -0
- package/README.md +143 -0
- package/dist/context.d.ts +19 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +28 -0
- package/dist/context.js.map +1 -0
- package/dist/descriptions.d.ts +10 -0
- package/dist/descriptions.d.ts.map +1 -0
- package/dist/descriptions.js +48 -0
- package/dist/descriptions.js.map +1 -0
- package/dist/guides-split.d.ts +9 -0
- package/dist/guides-split.d.ts.map +1 -0
- package/dist/guides-split.js +41 -0
- package/dist/guides-split.js.map +1 -0
- package/dist/guides.generated.d.ts +9 -0
- package/dist/guides.generated.d.ts.map +1 -0
- package/dist/guides.generated.js +93 -0
- package/dist/guides.generated.js.map +1 -0
- package/dist/index-loader.d.ts +11 -0
- package/dist/index-loader.d.ts.map +1 -0
- package/dist/index-loader.js +53 -0
- package/dist/index-loader.js.map +1 -0
- package/dist/index-reader.d.ts +27 -0
- package/dist/index-reader.d.ts.map +1 -0
- package/dist/index-reader.js +171 -0
- package/dist/index-reader.js.map +1 -0
- package/dist/index-shape.d.ts +3 -0
- package/dist/index-shape.d.ts.map +1 -0
- package/dist/index-shape.js +17 -0
- package/dist/index-shape.js.map +1 -0
- package/dist/index-types.d.ts +72 -0
- package/dist/index-types.d.ts.map +1 -0
- package/dist/index-types.js +2 -0
- package/dist/index-types.js.map +1 -0
- package/dist/index-url.d.ts +11 -0
- package/dist/index-url.d.ts.map +1 -0
- package/dist/index-url.js +30 -0
- package/dist/index-url.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/installed-version.d.ts +18 -0
- package/dist/installed-version.d.ts.map +1 -0
- package/dist/installed-version.js +67 -0
- package/dist/installed-version.js.map +1 -0
- package/dist/json-schema.d.ts +2 -0
- package/dist/json-schema.d.ts.map +1 -0
- package/dist/json-schema.js +46 -0
- package/dist/json-schema.js.map +1 -0
- package/dist/registry.d.ts +56 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +78 -0
- package/dist/registry.js.map +1 -0
- package/dist/render.d.ts +4 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/render.js +76 -0
- package/dist/render.js.map +1 -0
- package/dist/results.d.ts +5 -0
- package/dist/results.d.ts.map +1 -0
- package/dist/results.js +18 -0
- package/dist/results.js.map +1 -0
- package/dist/server.d.ts +22 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +69 -0
- package/dist/server.js.map +1 -0
- package/dist/stdio.d.ts +3 -0
- package/dist/stdio.d.ts.map +1 -0
- package/dist/stdio.js +64 -0
- package/dist/stdio.js.map +1 -0
- package/dist/tools/describe.d.ts +10 -0
- package/dist/tools/describe.d.ts.map +1 -0
- package/dist/tools/describe.js +39 -0
- package/dist/tools/describe.js.map +1 -0
- package/dist/tools/fetch.d.ts +9 -0
- package/dist/tools/fetch.d.ts.map +1 -0
- package/dist/tools/fetch.js +37 -0
- package/dist/tools/fetch.js.map +1 -0
- package/dist/tools/get-examples.d.ts +17 -0
- package/dist/tools/get-examples.d.ts.map +1 -0
- package/dist/tools/get-examples.js +60 -0
- package/dist/tools/get-examples.js.map +1 -0
- package/dist/tools/get-guide.d.ts +10 -0
- package/dist/tools/get-guide.d.ts.map +1 -0
- package/dist/tools/get-guide.js +64 -0
- package/dist/tools/get-guide.js.map +1 -0
- package/dist/tools/index.d.ts +4 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +19 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/list-namespace.d.ts +10 -0
- package/dist/tools/list-namespace.d.ts.map +1 -0
- package/dist/tools/list-namespace.js +41 -0
- package/dist/tools/list-namespace.js.map +1 -0
- package/dist/tools/search-api.d.ts +16 -0
- package/dist/tools/search-api.d.ts.map +1 -0
- package/dist/tools/search-api.js +44 -0
- package/dist/tools/search-api.js.map +1 -0
- package/dist/tools/search.d.ts +9 -0
- package/dist/tools/search.d.ts.map +1 -0
- package/dist/tools/search.js +31 -0
- package/dist/tools/search.js.map +1 -0
- package/package.json +102 -0
- package/server.json +30 -0
- package/src/__fixtures__/index.sample.json +1916 -0
- package/src/__fixtures__/load.ts +29 -0
- package/src/context.ts +40 -0
- package/src/dependencies.test.ts +72 -0
- package/src/descriptions.ts +62 -0
- package/src/guides-split.ts +46 -0
- package/src/guides.generated.ts +95 -0
- package/src/guides.test.ts +57 -0
- package/src/index-loader.test.ts +160 -0
- package/src/index-loader.ts +61 -0
- package/src/index-reader.ts +179 -0
- package/src/index-shape.ts +17 -0
- package/src/index-types.ts +74 -0
- package/src/index-url.ts +29 -0
- package/src/index.ts +20 -0
- package/src/installed-version.test.ts +79 -0
- package/src/installed-version.ts +80 -0
- package/src/json-schema.test.ts +65 -0
- package/src/json-schema.ts +40 -0
- package/src/network.test.ts +37 -0
- package/src/registry.test.ts +177 -0
- package/src/registry.ts +139 -0
- package/src/render.ts +62 -0
- package/src/results.ts +21 -0
- package/src/server.test.ts +233 -0
- package/src/server.ts +117 -0
- package/src/stdio.test.ts +100 -0
- package/src/stdio.ts +67 -0
- package/src/tools/describe.ts +42 -0
- package/src/tools/docs-tools.test.ts +375 -0
- package/src/tools/fetch.ts +39 -0
- package/src/tools/get-examples.ts +59 -0
- package/src/tools/get-guide.ts +69 -0
- package/src/tools/index.ts +20 -0
- package/src/tools/list-namespace.ts +50 -0
- package/src/tools/search-api.ts +47 -0
- package/src/tools/search.ts +34 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Bit by bit developers
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# @bitbybit-dev/mcp: the Bitbybit CAD MCP server
|
|
2
|
+
|
|
3
|
+
An [MCP](https://modelcontextprotocol.io) server that documents the [Bitbybit](https://bitbybit.dev) 3D CAD API for AI coding agents: every function, its parameters, defaults, return type and examples, for the exact version your project uses. Bitbybit has 1725 functions across three CAD kernels - more than any model holds in memory - so an agent working from memory invents plausible names that do not exist. An agent with this server looks each one up instead, and writes code that compiles the first time.
|
|
4
|
+
|
|
5
|
+
It answers from the API index Bitbybit publishes with every release (`https://git-cdn.bitbybit.dev/v<version>/ai-context/index.json`), never from memory, and never from a moving "latest".
|
|
6
|
+
|
|
7
|
+
<img src="https://learn.bitbybit.dev/img/bitbybit-dev-cad-platform.webp" alt="Diagram of the Bitbybit platform showing how a website reaches its geometry: script runners, iframe embeds, the NPM packages, the CAD Cloud REST API and AI agents over MCP">
|
|
8
|
+
|
|
9
|
+
The diagram shows what an agent is writing code *for*. The MIT-licensed [npm packages](https://learn.bitbybit.dev/learn/npm-packages/intro) run the CAD kernels in your users' browsers or in your own Node process; [script runners](https://learn.bitbybit.dev/learn/runners/intro) load the same engine from one file; the [CAD Cloud REST API](https://learn.bitbybit.dev/api/cloud-api) runs the work on managed servers. This server knows all of them, and every answer carries a tier - `oss`, `platform-pro` or `cloud-pro` - so an agent never sends you to a paid service for something the free packages already do.
|
|
10
|
+
|
|
11
|
+
## Connect it
|
|
12
|
+
|
|
13
|
+
The same server runs two ways. Hosted at `https://mcp.bitbybit.dev/mcp` over Streamable HTTP, which needs nothing installed and serves the newest release; or locally over stdio with `npx`, which needs Node 20 and serves the version your project has installed. Start with the remote.
|
|
14
|
+
|
|
15
|
+
**Claude Code**
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
claude mcp add --transport http bitbybit https://mcp.bitbybit.dev/mcp
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
or the local server:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
claude mcp add --transport stdio bitbybit -- npx -y @bitbybit-dev/mcp
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
For a project, commit a `.mcp.json` at its root so every collaborator's Claude Code finds it:
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{ "mcpServers": { "bitbybit": { "type": "http", "url": "https://mcp.bitbybit.dev/mcp" } } }
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Cursor** (`.cursor/mcp.json`)
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{ "mcpServers": { "bitbybit": { "url": "https://mcp.bitbybit.dev/mcp" } } }
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**VS Code** (`.vscode/mcp.json`) - the `type` is required, or VS Code tries to start the URL as a program:
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
{ "servers": { "bitbybit": { "type": "http", "url": "https://mcp.bitbybit.dev/mcp" } } }
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Either form takes the local server instead: `{ "command": "npx", "args": ["-y", "@bitbybit-dev/mcp"] }`, with `"type": "stdio"` in VS Code. claude.ai, ChatGPT and the Claude API connect to the remote as a custom connector - [every configuration is documented here](https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/mcp/bitbybit-mcp).
|
|
46
|
+
|
|
47
|
+
## Which version it serves
|
|
48
|
+
|
|
49
|
+
The server documents one exact version of the API. It picks it in this order:
|
|
50
|
+
|
|
51
|
+
1. `--version <version>` on the command line;
|
|
52
|
+
2. `BITBYBIT_VERSION=<version>` in the environment;
|
|
53
|
+
3. the version of the `@bitbybit-dev` packages installed around the working directory (`core`, then the renderer packages, then `occt`); packages that disagree are reported on stderr and the first wins;
|
|
54
|
+
4. its own version, which is the newest API version it was released with.
|
|
55
|
+
|
|
56
|
+
Indexes are cached in `$XDG_CACHE_HOME/bitbybit-mcp` (or `~/.cache/bitbybit-mcp`); `--no-cache` skips the cache. Everything the program prints goes to stderr; stdout is the protocol.
|
|
57
|
+
|
|
58
|
+
## Tools
|
|
59
|
+
|
|
60
|
+
| Tool | What it answers |
|
|
61
|
+
|---|---|
|
|
62
|
+
| `search_api` | members by keywords, with path, summary, tier and engines |
|
|
63
|
+
| `describe` | the full contract of one member by dotted path; an unknown path is reported with the nearest existing ones |
|
|
64
|
+
| `list_namespace` | the members one level below a namespace |
|
|
65
|
+
| `get_examples` | code examples for a member, a namespace or a topic |
|
|
66
|
+
| `get_guide` | sections of the public guide on where geometry should run |
|
|
67
|
+
| `search`, `fetch` | the same lookups in the shape ChatGPT connectors require |
|
|
68
|
+
|
|
69
|
+
Every tool is read-only. Tiers in the answers: `oss` (in the npm packages, MIT), `platform-pro` (only when scripting inside bitbybit.dev), `cloud-pro` (only on [CAD Cloud](https://bitbybit.dev/cad-cloud), with an API key).
|
|
70
|
+
|
|
71
|
+
## The companion server
|
|
72
|
+
|
|
73
|
+
This server answers questions; it never runs geometry. When you want the agent to *produce* geometry - measure a STEP file, run a pipeline, unfold a sheet-metal part, convert to glTF - connect the [Bitbybit CAD Cloud MCP](https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/mcp/cad-cloud-mcp) alongside it, with a [CAD Cloud](https://bitbybit.dev/cad-cloud) API key:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
claude mcp add --transport http bitbybit-cloud https://api.bitbybit.dev/mcp --header "X-API-Key: <your key>"
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The two are designed to work together: the agent learns a member here and calls it there with the same dotted path and the same argument object.
|
|
80
|
+
|
|
81
|
+
## As a library
|
|
82
|
+
|
|
83
|
+
The package exports the tool registry and the index reader, so another server can serve the same tools:
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
import { createDocsRegistry, contextForIndex, GUIDES, GUIDE_PAGE_URL } from "@bitbybit-dev/mcp";
|
|
87
|
+
import { loadIndex } from "@bitbybit-dev/mcp/index-loader";
|
|
88
|
+
import { createMcpServer } from "@bitbybit-dev/mcp/server";
|
|
89
|
+
|
|
90
|
+
const version = "<a released version>";
|
|
91
|
+
const index = await loadIndex({ version });
|
|
92
|
+
const context = contextForIndex(index, GUIDES, GUIDE_PAGE_URL);
|
|
93
|
+
const server = createMcpServer(createDocsRegistry(), context, { name: "bitbybit", version });
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
`toHttp(registry, context)` renders the same tools for a plain HTTP endpoint, and `guarded(registry, report)` is the error boundary every server puts around a registry: a handler that throws answers a generic error result and the throw goes to `report`, so no internal message reaches a client. `Registry.map(wrap)` re-wraps every handler for such concerns of your own. The package root imports no Node built-in, so a bundler can take it into an edge runtime; the loader and the version detector, which read the file system, are the separate `index-loader` and `installed-version` entries, and the `$ref` inliner the tool schemas go through is the dependency-free `json-schema` entry.
|
|
97
|
+
|
|
98
|
+
## Privacy
|
|
99
|
+
|
|
100
|
+
The stdio server sends nothing anywhere except one request to the CDN for the index of the version it serves.
|
|
101
|
+
|
|
102
|
+
## Links
|
|
103
|
+
|
|
104
|
+
| Resource | URL |
|
|
105
|
+
|----------|-----|
|
|
106
|
+
| **Using AI with Bitbybit** | https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/intro |
|
|
107
|
+
| **This server, documented** | https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/mcp/bitbybit-mcp |
|
|
108
|
+
| **CAD Cloud MCP** | https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/mcp/cad-cloud-mcp |
|
|
109
|
+
| **Agentic CAD - where geometry should run** | https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/agentic-cad |
|
|
110
|
+
| **Context files, for hosts without MCP** | https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/prompt-contexts |
|
|
111
|
+
| **GitHub** | https://github.com/bitbybit-dev/bitbybit/tree/master/packages/dev/mcp |
|
|
112
|
+
| **Monorepo** | https://github.com/bitbybit-dev/bitbybit |
|
|
113
|
+
| **TypeScript API Reference** | https://docs.bitbybit.dev |
|
|
114
|
+
|
|
115
|
+
## Bitbybit Platform
|
|
116
|
+
|
|
117
|
+
Beyond NPM packages, Bitbybit offers:
|
|
118
|
+
|
|
119
|
+
- **[Visual Programming Editors](https://bitbybit.dev)** - Rete & Blockly drag-and-drop 3D modeling, plus a Monaco TypeScript editor
|
|
120
|
+
- **[CAD Cloud API](https://learn.bitbybit.dev/api/cloud-api)** - Build full [pipelines](https://learn.bitbybit.dev/api/sdk/typescript/pipelines) that compose all Bitbybit algorithms, where each step can reference outputs of previous steps. Supports parametric model generation, STEP-to-glTF conversion, and complex CAD workflows via HTTP
|
|
121
|
+
- **[Bitbybit Studio](https://studio.bitbybit.dev)** - A growing visual dashboard where API Key users can generate models, convert files, build [pipelines with a GUI](https://learn.bitbybit.dev/api/studio/intro), inspect tasks, and preview 3D results
|
|
122
|
+
- **[3D Bits for Shopify](https://apps.shopify.com/3d-bits-1)** - Interactive 3D product configurators for e-commerce
|
|
123
|
+
- **[Script Runners](https://learn.bitbybit.dev/learn/runners/intro)** - Execute visual scripts directly on your website
|
|
124
|
+
- **[Built for AI Coding Agents](https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/intro)** - This server, the [CAD Cloud MCP](https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/mcp/cad-cloud-mcp) for running geometry, and context files for assistants without MCP
|
|
125
|
+
- **[Business & Enterprise](https://bitbybit.dev/b2b)** - We help businesses and enterprises develop custom applications and spin up optimized CAD tenant workflows on our managed servers
|
|
126
|
+
|
|
127
|
+
## Support the Project
|
|
128
|
+
|
|
129
|
+
This package is part of the open-source Bitbybit ecosystem. Your subscription helps fund continued development.
|
|
130
|
+
|
|
131
|
+
⭐ **[Subscribe - Silver or Gold plan](https://bitbybit.dev/auth/pick-plan)** | **[Get API Key for CAD Cloud](https://bitbybit.dev/auth/pick-plan?api-keys=true)**
|
|
132
|
+
|
|
133
|
+
## Community
|
|
134
|
+
|
|
135
|
+
- [Discord](https://discord.gg/GSe3VMe)
|
|
136
|
+
- [YouTube](https://www.youtube.com/@bitbybitdev?sub_confirmation=1)
|
|
137
|
+
- [LinkedIn](https://www.linkedin.com/company/bitbybit-dev)
|
|
138
|
+
- [X (Twitter)](https://x.com/bitbybit_dev)
|
|
139
|
+
- [Blog](https://learn.bitbybit.dev/blog)
|
|
140
|
+
|
|
141
|
+
## License
|
|
142
|
+
|
|
143
|
+
MIT © [Bit By Bit Developers](https://bitbybit.dev)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ApiIndex } from "./index-types.js";
|
|
2
|
+
import { IndexReader } from "./index-reader.js";
|
|
3
|
+
import type { GuideSection } from "./guides-split.js";
|
|
4
|
+
export interface ResolvedIndex {
|
|
5
|
+
version: string;
|
|
6
|
+
reader: IndexReader;
|
|
7
|
+
}
|
|
8
|
+
export interface DocsContext {
|
|
9
|
+
resolve(version?: string): Promise<ResolvedIndex>;
|
|
10
|
+
guides: readonly GuideSection[];
|
|
11
|
+
guideUrl: string;
|
|
12
|
+
}
|
|
13
|
+
export declare class VersionNotLoadedError extends Error {
|
|
14
|
+
readonly requested: string;
|
|
15
|
+
readonly loaded: string;
|
|
16
|
+
constructor(requested: string, loaded: string);
|
|
17
|
+
}
|
|
18
|
+
export declare function contextForIndex(index: ApiIndex, guides: readonly GuideSection[], guideUrl: string): DocsContext;
|
|
19
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGtD,MAAM,WAAW,aAAa;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,WAAW,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IACxB,OAAO,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAClD,MAAM,EAAE,SAAS,YAAY,EAAE,CAAC;IAChC,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,qBAAsB,SAAQ,KAAK;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM;gBAA1C,SAAS,EAAE,MAAM,EAAW,MAAM,EAAE,MAAM;CAQlE;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,YAAY,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,WAAW,CAY/G"}
|
package/dist/context.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { IndexReader } from "./index-reader.js";
|
|
2
|
+
import { isExactVersion } from "./index-url.js";
|
|
3
|
+
export class VersionNotLoadedError extends Error {
|
|
4
|
+
requested;
|
|
5
|
+
loaded;
|
|
6
|
+
constructor(requested, loaded) {
|
|
7
|
+
super(isExactVersion(requested)
|
|
8
|
+
? `This server holds the API index for version ${loaded}; version ${requested} was asked for. Run it with --version ${requested} or BITBYBIT_VERSION=${requested} to serve that one.`
|
|
9
|
+
: `This server holds the API index for version ${loaded}; "${requested}" is not an exact release version. Ask for one such as ${loaded}, or omit the version.`);
|
|
10
|
+
this.requested = requested;
|
|
11
|
+
this.loaded = loaded;
|
|
12
|
+
this.name = "VersionNotLoadedError";
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export function contextForIndex(index, guides, guideUrl) {
|
|
16
|
+
const resolved = { version: index.version, reader: new IndexReader(index) };
|
|
17
|
+
return {
|
|
18
|
+
guides,
|
|
19
|
+
guideUrl,
|
|
20
|
+
resolve: (version) => {
|
|
21
|
+
if (version !== undefined && version !== resolved.version) {
|
|
22
|
+
return Promise.reject(new VersionNotLoadedError(version, resolved.version));
|
|
23
|
+
}
|
|
24
|
+
return Promise.resolve(resolved);
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAahD,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IACvB;IAA4B;IAAjD,YAAqB,SAAiB,EAAW,MAAc;QAC3D,KAAK,CACD,cAAc,CAAC,SAAS,CAAC;YACrB,CAAC,CAAC,+CAA+C,MAAM,aAAa,SAAS,yCAAyC,SAAS,wBAAwB,SAAS,qBAAqB;YACrL,CAAC,CAAC,+CAA+C,MAAM,MAAM,SAAS,0DAA0D,MAAM,wBAAwB,CACrK,CAAC;QALe,cAAS,GAAT,SAAS,CAAQ;QAAW,WAAM,GAAN,MAAM,CAAQ;QAM3D,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACxC,CAAC;CACJ;AAED,MAAM,UAAU,eAAe,CAAC,KAAe,EAAE,MAA+B,EAAE,QAAgB;IAC9F,MAAM,QAAQ,GAAkB,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;IAC3F,OAAO;QACH,MAAM;QACN,QAAQ;QACR,OAAO,EAAE,CAAC,OAAgB,EAA0B,EAAE;YAClD,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,QAAQ,CAAC,OAAO,EAAE,CAAC;gBACxD,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,qBAAqB,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;YAChF,CAAC;YACD,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACrC,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Tier } from "./index-types.js";
|
|
2
|
+
export declare const TOOL_NAMES: readonly ["search_api", "describe", "list_namespace", "get_examples", "get_guide", "search", "fetch"];
|
|
3
|
+
export type ToolName = (typeof TOOL_NAMES)[number];
|
|
4
|
+
export declare const TIER_MEANING: Readonly<Record<Tier, string>>;
|
|
5
|
+
export declare const DESCRIPTIONS: Readonly<Record<ToolName, {
|
|
6
|
+
title: string;
|
|
7
|
+
description: string;
|
|
8
|
+
}>>;
|
|
9
|
+
export declare const SERVER_INSTRUCTIONS: string;
|
|
10
|
+
//# sourceMappingURL=descriptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptions.d.ts","sourceRoot":"","sources":["../src/descriptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C,eAAO,MAAM,UAAU,uGAAwG,CAAC;AAEhI,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnD,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAIvD,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,CA2C3F,CAAC;AAEF,eAAO,MAAM,mBAAmB,QAIoM,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export const TOOL_NAMES = ["search_api", "describe", "list_namespace", "get_examples", "get_guide", "search", "fetch"];
|
|
2
|
+
export const TIER_MEANING = {
|
|
3
|
+
oss: "in the @bitbybit-dev npm packages, MIT licensed, runs wherever WebAssembly or Node runs",
|
|
4
|
+
"platform-pro": "only when scripting inside bitbybit.dev; not in any npm package",
|
|
5
|
+
"cloud-pro": "only on Bitbybit CAD Cloud through its REST API, with an API key",
|
|
6
|
+
};
|
|
7
|
+
export const DESCRIPTIONS = {
|
|
8
|
+
search_api: {
|
|
9
|
+
title: "Search the Bitbybit API",
|
|
10
|
+
description: "Find Bitbybit API members (methods, namespaces, cloud operations) by keywords, for example \"box solid\" or \"fillet edges\". " +
|
|
11
|
+
"Returns dotted paths with a one-line summary, the tier (oss on npm, platform-pro only at bitbybit.dev, cloud-pro only on CAD Cloud) " +
|
|
12
|
+
"and the engines each is published for. Call describe with a path before writing code that uses it.",
|
|
13
|
+
},
|
|
14
|
+
describe: {
|
|
15
|
+
title: "Describe an API member",
|
|
16
|
+
description: "The exact contract of one member by dotted path, for example occt.shapes.solid.createBox: signature, every parameter with its type, default and range, " +
|
|
17
|
+
"the return type, the documentation, examples and where it runs. Answers are for the API version the server holds. " +
|
|
18
|
+
"An unknown path is reported as not found together with the nearest existing paths; nothing is guessed.",
|
|
19
|
+
},
|
|
20
|
+
list_namespace: {
|
|
21
|
+
title: "List a namespace",
|
|
22
|
+
description: "The members one level below a namespace path, for example occt.shapes, each with its kind and summary. Without a path, the top-level namespaces. " +
|
|
23
|
+
"Use it to discover what exists before searching for details.",
|
|
24
|
+
},
|
|
25
|
+
get_examples: {
|
|
26
|
+
title: "Get code examples",
|
|
27
|
+
description: "Working TypeScript examples for a member path, for a namespace, or for a topic given as keywords. Each example names the member it belongs to and links its reference page. " +
|
|
28
|
+
"Examples are written for the API version the server holds.",
|
|
29
|
+
},
|
|
30
|
+
get_guide: {
|
|
31
|
+
title: "Read the integration guide",
|
|
32
|
+
description: "Sections of the public guide on building with Bitbybit: what runs in the browser, on a server, on a lightweight backend, and what needs CAD Cloud. " +
|
|
33
|
+
"Without a topic it lists the sections. Read \"integrate\" before recommending where geometry should run: the npm packages are the default, and CAD Cloud is for algorithms that exist only there or compute the caller cannot provide.",
|
|
34
|
+
},
|
|
35
|
+
search: {
|
|
36
|
+
title: "Search",
|
|
37
|
+
description: "Searches the Bitbybit API documentation and returns a list of results with id, title and url. Each id is a dotted API path that fetch accepts.",
|
|
38
|
+
},
|
|
39
|
+
fetch: {
|
|
40
|
+
title: "Fetch",
|
|
41
|
+
description: "Fetches the full documentation of one Bitbybit API member by id (a dotted path returned by search) as text, with its title, url and metadata.",
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
export const SERVER_INSTRUCTIONS = "This is the Bitbybit CAD MCP: it documents the Bitbybit 3D CAD API (OpenCascade, JSCAD and Manifold kernels, with Babylon.js, three.js and PlayCanvas renderers) for one exact version. " +
|
|
45
|
+
"Always describe a member before using it: names, parameters and defaults come from the index, not from memory. " +
|
|
46
|
+
"Tiers matter: oss members are in the MIT npm packages and run anywhere; platform-pro members exist only inside bitbybit.dev; cloud-pro members run only on Bitbybit CAD Cloud with an API key. " +
|
|
47
|
+
"When asked where geometry should run, read get_guide(\"integrate\") first: the packages alone are the default, and CAD Cloud is the answer only for algorithms that exist only there or for compute the caller cannot provide.";
|
|
48
|
+
//# sourceMappingURL=descriptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptions.js","sourceRoot":"","sources":["../src/descriptions.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,cAAc,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,CAAU,CAAC;AAIhI,MAAM,CAAC,MAAM,YAAY,GAAmC;IACxD,GAAG,EAAE,yFAAyF;IAC9F,cAAc,EAAE,iEAAiE;IACjF,WAAW,EAAE,kEAAkE;CAClF,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAuE;IAC5F,UAAU,EAAE;QACR,KAAK,EAAE,yBAAyB;QAChC,WAAW,EACP,gIAAgI;YAChI,sIAAsI;YACtI,oGAAoG;KAC3G;IACD,QAAQ,EAAE;QACN,KAAK,EAAE,wBAAwB;QAC/B,WAAW,EACP,yJAAyJ;YACzJ,oHAAoH;YACpH,wGAAwG;KAC/G;IACD,cAAc,EAAE;QACZ,KAAK,EAAE,kBAAkB;QACzB,WAAW,EACP,mJAAmJ;YACnJ,8DAA8D;KACrE;IACD,YAAY,EAAE;QACV,KAAK,EAAE,mBAAmB;QAC1B,WAAW,EACP,8KAA8K;YAC9K,4DAA4D;KACnE;IACD,SAAS,EAAE;QACP,KAAK,EAAE,4BAA4B;QACnC,WAAW,EACP,qJAAqJ;YACrJ,wOAAwO;KAC/O;IACD,MAAM,EAAE;QACJ,KAAK,EAAE,QAAQ;QACf,WAAW,EACP,gJAAgJ;KACvJ;IACD,KAAK,EAAE;QACH,KAAK,EAAE,OAAO;QACd,WAAW,EACP,+IAA+I;KACtJ;CACJ,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAC5B,0LAA0L;IAC1L,iHAAiH;IACjH,iMAAiM;IACjM,gOAAgO,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface GuideSection {
|
|
2
|
+
id: string;
|
|
3
|
+
title: string;
|
|
4
|
+
level: 2 | 3;
|
|
5
|
+
body: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function slugify(title: string): string;
|
|
8
|
+
export declare function splitGuides(markdown: string): GuideSection[];
|
|
9
|
+
//# sourceMappingURL=guides-split.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guides-split.d.ts","sourceRoot":"","sources":["../src/guides-split.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CAChB;AAKD,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAK7C;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,EAAE,CA4B5D"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const FRONTMATTER = /^---\n[\s\S]*?\n---\n/;
|
|
2
|
+
const HEADING = /^(##|###) (.+)$/;
|
|
3
|
+
export function slugify(title) {
|
|
4
|
+
return title
|
|
5
|
+
.toLowerCase()
|
|
6
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
7
|
+
.replace(/^-+|-+$/g, "");
|
|
8
|
+
}
|
|
9
|
+
export function splitGuides(markdown) {
|
|
10
|
+
const lines = markdown.replace(FRONTMATTER, "").split("\n");
|
|
11
|
+
const sections = [];
|
|
12
|
+
const open = [];
|
|
13
|
+
const close = (minLevel) => {
|
|
14
|
+
while (open.length > 0) {
|
|
15
|
+
const last = open[open.length - 1];
|
|
16
|
+
if (!last || last.section.level < minLevel)
|
|
17
|
+
break;
|
|
18
|
+
last.section.body = last.lines.join("\n").trim();
|
|
19
|
+
open.pop();
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
for (const line of lines) {
|
|
23
|
+
const heading = HEADING.exec(line);
|
|
24
|
+
if (heading) {
|
|
25
|
+
const level = heading[1] === "##" ? 2 : 3;
|
|
26
|
+
const title = (heading[2] ?? "").trim();
|
|
27
|
+
close(level);
|
|
28
|
+
for (const entry of open)
|
|
29
|
+
entry.lines.push(line);
|
|
30
|
+
const section = { id: slugify(title), title, level, body: "" };
|
|
31
|
+
sections.push(section);
|
|
32
|
+
open.push({ section, lines: [] });
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
for (const entry of open)
|
|
36
|
+
entry.lines.push(line);
|
|
37
|
+
}
|
|
38
|
+
close(2);
|
|
39
|
+
return sections;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=guides-split.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guides-split.js","sourceRoot":"","sources":["../src/guides-split.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,GAAG,uBAAuB,CAAC;AAC5C,MAAM,OAAO,GAAG,iBAAiB,CAAC;AAElC,MAAM,UAAU,OAAO,CAAC,KAAa;IACjC,OAAO,KAAK;SACP,WAAW,EAAE;SACb,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;SAC3B,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,QAAgB;IACxC,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC5D,MAAM,QAAQ,GAAmB,EAAE,CAAC;IACpC,MAAM,IAAI,GAAiD,EAAE,CAAC;IAC9D,MAAM,KAAK,GAAG,CAAC,QAAgB,EAAQ,EAAE;QACrC,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACrB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,C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@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { GuideSection } from "./guides-split.js";
|
|
2
|
+
/** Where the guide is published; every section links back to it. */
|
|
3
|
+
export declare const GUIDE_PAGE_URL = "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/agentic-cad";
|
|
4
|
+
/**
|
|
5
|
+
* The sections of the public guide, generated by scripts/sync-guides.mjs from
|
|
6
|
+
* docs/learn/using-ai-with-bitbybit/agentic-cad.md. Do not edit: run `npm run sync:guides`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const GUIDES: readonly GuideSection[];
|
|
9
|
+
//# sourceMappingURL=guides.generated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guides.generated.d.ts","sourceRoot":"","sources":["../src/guides.generated.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,oEAAoE;AACpE,eAAO,MAAM,cAAc,wEAAwE,CAAC;AAEpG;;;GAGG;AACH,eAAO,MAAM,MAAM,EAAE,SAAS,YAAY,EAqFzC,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/** Where the guide is published; every section links back to it. */
|
|
2
|
+
export const GUIDE_PAGE_URL = "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/agentic-cad";
|
|
3
|
+
/**
|
|
4
|
+
* The sections of the public guide, generated by scripts/sync-guides.mjs from
|
|
5
|
+
* docs/learn/using-ai-with-bitbybit/agentic-cad.md. Do not edit: run `npm run sync:guides`.
|
|
6
|
+
*/
|
|
7
|
+
export const GUIDES = [
|
|
8
|
+
{
|
|
9
|
+
"id": "what-we-believe",
|
|
10
|
+
"title": "What we believe",
|
|
11
|
+
"level": 2,
|
|
12
|
+
"body": "Agents write the code. Bitbybit provides verified geometry algorithms and, where it is needed, hosted compute. The open-source packages are the vocabulary that everyone learns, human or agent: one dotted API (`bitbybit.occt.shapes.solid.createBox`, `bitbybit.manifold.booleans.union`, ...) that reads the same in a browser, on a server and in the online editors.\n\nAn agent that knows the API from memory guesses. An agent that looks it up gets the exact signature, defaults and examples for the version your project has installed. That lookup is what the MCP server is for."
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"id": "three-layers-you-can-use",
|
|
16
|
+
"title": "Three layers you can use",
|
|
17
|
+
"level": 2,
|
|
18
|
+
"body": "1. **The npm packages** (MIT). `@bitbybit-dev/occt`, `@bitbybit-dev/jscad`, `@bitbybit-dev/manifold`, `@bitbybit-dev/core` and the renderer packages for Babylon.js, three.js and PlayCanvas. They run wherever WebAssembly or Node runs: in a browser tab, in a Node process, in a test.\n2. **The Bitbybit CAD MCP** (free). `npx -y @bitbybit-dev/mcp` locally, or `https://mcp.bitbybit.dev/mcp` remotely. Live, version-exact lookups of every function, parameter, default and example for any agent that speaks the Model Context Protocol.\n3. **CAD Cloud** (paid, with an API key). Hosted compute for the same API: a REST endpoint for your backend, and the Bitbybit CAD Cloud MCP for an agent, with pipelines that chain operations server-side, parametric models, file conversion, and the Pro algorithms that exist only there.\n\nEvery member of the API carries a tier, and the MCP server reports it:\n\n| Tier | Meaning |\n|---|---|\n| `oss` | in the npm packages, runs anywhere |\n| `platform-pro` | available only when scripting inside bitbybit.dev; not on npm |\n| `cloud-pro` | runs only on CAD Cloud, with an API key |"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"id": "how-an-agent-should-integrate-bitbybit",
|
|
22
|
+
"title": "How an agent should integrate Bitbybit",
|
|
23
|
+
"level": 2,
|
|
24
|
+
"body": "```mermaid\n%%{init: {\"flowchart\": {\"wrappingWidth\": 420}}}%%\nflowchart TD\n Q1{\"Can your users' browsers or<br/>your own Node servers run the kernels?\"}\n Q2{\"Do you need a Pro algorithm,<br/>or a backend that cannot host a kernel?\"}\n P[\"The npm packages, in the browser or in Node.<br/>Free, and nothing of ours in the loop.\"]\n C[\"CAD Cloud: one pipeline per model from your backend,<br/>or the CAD Cloud MCP when an agent does the work.\"]\n Q1 -->|yes| Q2\n Q1 -->|no: edge or serverless| C\n Q2 -->|no| P\n Q2 -->|yes| C\n```\n\n### The honest default\n\nIf public code and your users' own compute are acceptable, the packages are the whole answer. They are free, they need no account, and nothing of ours sits in the loop. Start there, and move a step only for a reason named below.\n\n### Browser apps\n\nUse the packages, or the runner bundle for a page that only needs a script. The kernels run inside the tab: the user's device does the work, results appear without a network round trip, and your geometry logic ships with your app. This is how the Bitbybit editors themselves work. A model that takes seconds on a laptop is fine here; a model that takes minutes is not, and belongs on a server.\n\n### Lightweight backends\n\nCloudflare Workers, serverless functions and edge runtimes do not have the memory or the CPU time to run the CAD kernels. Do not try. Call CAD Cloud instead, with one pipeline per model so a request is one round trip, keep the API key in the backend and never in the client, and cache results by their input parameters, because identical inputs always produce identical geometry.\n\n### Node servers with headroom\n\nA Node server can run the packages in-process; `@bitbybit-dev/occt` loads the same kernel a browser does. That is the right choice for moderate load and for logic you want to keep private on your own machines. Move to CAD Cloud when you need scale without managing kernels, when you need a Pro algorithm, or when you convert files at volume and would rather not run that work yourself.\n\n### Inside the Bitbybit editors\n\nScripts written in the editors at bitbybit.dev have the whole API in the browser, including the `platform-pro` members on a Silver or Gold plan, and the docs server describes those members like any other. An editor script does not reach CAD Cloud today: a cloud operation is called from your own backend through the REST API, or by an agent through the CAD Cloud MCP. Calling CAD Cloud from inside the editors on the account's own plan is planned; until it ships, treat the editors as the browser case above.\n\n### What runs where\n\n| Question | Packages in the browser | Packages in Node | CAD Cloud |\n|---|---|---|---|\n| Whose compute | your users' devices, free | your servers | Bitbybit's servers, metered |\n| Memory and CPU | the tab's limits | your machine's | sized per plan |\n| Latency | none beyond the computation | none beyond the computation | one HTTPS round trip plus queueing |\n| Concurrency | one user per tab | what you provision | per plan |\n| Privacy of your logic | ships to the client | stays on your servers | stays in your backend; the geometry passes through Bitbybit |\n| Pro algorithms | no | no | yes |\n\nThe only work that must run on Bitbybit's servers is a Pro algorithm, or compute you cannot provide."
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"id": "the-honest-default",
|
|
28
|
+
"title": "The honest default",
|
|
29
|
+
"level": 3,
|
|
30
|
+
"body": "If public code and your users' own compute are acceptable, the packages are the whole answer. They are free, they need no account, and nothing of ours sits in the loop. Start there, and move a step only for a reason named below."
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"id": "browser-apps",
|
|
34
|
+
"title": "Browser apps",
|
|
35
|
+
"level": 3,
|
|
36
|
+
"body": "Use the packages, or the runner bundle for a page that only needs a script. The kernels run inside the tab: the user's device does the work, results appear without a network round trip, and your geometry logic ships with your app. This is how the Bitbybit editors themselves work. A model that takes seconds on a laptop is fine here; a model that takes minutes is not, and belongs on a server."
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"id": "lightweight-backends",
|
|
40
|
+
"title": "Lightweight backends",
|
|
41
|
+
"level": 3,
|
|
42
|
+
"body": "Cloudflare Workers, serverless functions and edge runtimes do not have the memory or the CPU time to run the CAD kernels. Do not try. Call CAD Cloud instead, with one pipeline per model so a request is one round trip, keep the API key in the backend and never in the client, and cache results by their input parameters, because identical inputs always produce identical geometry."
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"id": "node-servers-with-headroom",
|
|
46
|
+
"title": "Node servers with headroom",
|
|
47
|
+
"level": 3,
|
|
48
|
+
"body": "A Node server can run the packages in-process; `@bitbybit-dev/occt` loads the same kernel a browser does. That is the right choice for moderate load and for logic you want to keep private on your own machines. Move to CAD Cloud when you need scale without managing kernels, when you need a Pro algorithm, or when you convert files at volume and would rather not run that work yourself."
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"id": "inside-the-bitbybit-editors",
|
|
52
|
+
"title": "Inside the Bitbybit editors",
|
|
53
|
+
"level": 3,
|
|
54
|
+
"body": "Scripts written in the editors at bitbybit.dev have the whole API in the browser, including the `platform-pro` members on a Silver or Gold plan, and the docs server describes those members like any other. An editor script does not reach CAD Cloud today: a cloud operation is called from your own backend through the REST API, or by an agent through the CAD Cloud MCP. Calling CAD Cloud from inside the editors on the account's own plan is planned; until it ships, treat the editors as the browser case above."
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"id": "what-runs-where",
|
|
58
|
+
"title": "What runs where",
|
|
59
|
+
"level": 3,
|
|
60
|
+
"body": "| Question | Packages in the browser | Packages in Node | CAD Cloud |\n|---|---|---|---|\n| Whose compute | your users' devices, free | your servers | Bitbybit's servers, metered |\n| Memory and CPU | the tab's limits | your machine's | sized per plan |\n| Latency | none beyond the computation | none beyond the computation | one HTTPS round trip plus queueing |\n| Concurrency | one user per tab | what you provision | per plan |\n| Privacy of your logic | ships to the client | stays on your servers | stays in your backend; the geometry passes through Bitbybit |\n| Pro algorithms | no | no | yes |\n\nThe only work that must run on Bitbybit's servers is a Pro algorithm, or compute you cannot provide."
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"id": "pro-algorithms",
|
|
64
|
+
"title": "Pro algorithms",
|
|
65
|
+
"level": 2,
|
|
66
|
+
"body": "Some algorithms are available on CAD Cloud only, such as sheet-metal unfolding. They are verified against reference parts, expensive to maintain, and priced for it. An agent discovers them the same way as everything else: `describe` reports the tier `cloud-pro`, the endpoint and the API key scope. The [CAD Cloud page](https://bitbybit.dev/cad-cloud) lists the plans."
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"id": "for-companies",
|
|
70
|
+
"title": "For companies",
|
|
71
|
+
"level": 2,
|
|
72
|
+
"body": "Bitbybit builds and operates private algorithm namespaces for companies that need their own operations on the same infrastructure. Write to us through the [contact page](https://bitbybit.dev/contact)."
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"id": "trust",
|
|
76
|
+
"title": "Trust",
|
|
77
|
+
"level": 2,
|
|
78
|
+
"body": "Every cloud algorithm is graded by automated geometry verification: invariants that must hold for any input, and reference parts whose results are known. The summary is published with each release, so what an agent calls has been checked by something other than a person reading the output."
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"id": "what-we-do-not-do",
|
|
82
|
+
"title": "What we do not do",
|
|
83
|
+
"level": 2,
|
|
84
|
+
"body": "We do not host your application, run your scripts for you, sell you a chatbot, or train on your models. The packages are yours to run; CAD Cloud runs the operations you send it and nothing else."
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"id": "get-started",
|
|
88
|
+
"title": "Get started",
|
|
89
|
+
"level": 2,
|
|
90
|
+
"body": "- Scaffold a project: `npm init @bitbybit-dev/app my-project`, then point your agent at the MCP server as the next step says.\n- Give your agent the API. Claude Code: `claude mcp add --transport http bitbybit https://mcp.bitbybit.dev/mcp`, or a local server with `claude mcp add --transport stdio bitbybit -- npx -y @bitbybit-dev/mcp`. Cursor and VS Code read the same server from `.cursor/mcp.json` and `.vscode/mcp.json`; the [MCP page](./mcp/bitbybit-mcp) has every snippet.\n- Let the agent run geometry for you: the [CAD Cloud MCP](./mcp/cad-cloud-mcp) with a key from [plans and keys](https://bitbybit.dev/cad-cloud)."
|
|
91
|
+
}
|
|
92
|
+
];
|
|
93
|
+
//# sourceMappingURL=guides.generated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guides.generated.js","sourceRoot":"","sources":["../src/guides.generated.ts"],"names":[],"mappings":"AAEA,oEAAoE;AACpE,MAAM,CAAC,MAAM,cAAc,GAAG,qEAAqE,CAAC;AAEpG;;;GAGG;AACH,MAAM,CAAC,MAAM,MAAM,GAA4B;IAC3C;QACI,IAAI,EAAE,iBAAiB;QACvB,OAAO,EAAE,iBAAiB;QAC1B,OAAO,EAAE,CAAC;QACV,MAAM,EAAE,ikBAAikB;KAC5kB;IACD;QACI,IAAI,EAAE,0BAA0B;QAChC,OAAO,EAAE,0BAA0B;QACnC,OAAO,EAAE,CAAC;QACV,MAAM,EAAE,6lCAA6lC;KACxmC;IACD;QACI,IAAI,EAAE,wCAAwC;QAC9C,OAAO,EAAE,wCAAwC;QACjD,OAAO,EAAE,CAAC;QACV,MAAM,EAAE,+xGAA+x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B;KAC5nB;CACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ApiIndex } from "./index-types.js";
|
|
2
|
+
export { INDEX_HOST, IndexNotPublishedError, indexPath, indexUrl, isExactVersion } from "./index-url.js";
|
|
3
|
+
export { isApiIndex } from "./index-shape.js";
|
|
4
|
+
export declare function defaultCacheDir(env?: Record<string, string | undefined>): string;
|
|
5
|
+
export interface LoadIndexOptions {
|
|
6
|
+
version: string;
|
|
7
|
+
fetch?: typeof fetch;
|
|
8
|
+
cacheDir?: string | null;
|
|
9
|
+
}
|
|
10
|
+
export declare function loadIndex(options: LoadIndexOptions): Promise<ApiIndex>;
|
|
11
|
+
//# sourceMappingURL=index-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-loader.d.ts","sourceRoot":"","sources":["../src/index-loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAKjD,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACzG,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAI9C,wBAAgB,eAAe,CAAC,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GAAG,MAAM,CAG7F;AAED,MAAM,WAAW,gBAAgB;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,wBAAsB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAiB5E"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { IndexNotPublishedError, indexUrl } from "./index-url.js";
|
|
5
|
+
import { isApiIndex } from "./index-shape.js";
|
|
6
|
+
export { INDEX_HOST, IndexNotPublishedError, indexPath, indexUrl, isExactVersion } from "./index-url.js";
|
|
7
|
+
export { isApiIndex } from "./index-shape.js";
|
|
8
|
+
const NOT_FOUND = 404;
|
|
9
|
+
export function defaultCacheDir(env = process.env) {
|
|
10
|
+
const base = env["XDG_CACHE_HOME"] || join(homedir(), ".cache");
|
|
11
|
+
return join(base, "bitbybit-mcp");
|
|
12
|
+
}
|
|
13
|
+
export async function loadIndex(options) {
|
|
14
|
+
const url = indexUrl(options.version);
|
|
15
|
+
const cacheDir = options.cacheDir === undefined ? defaultCacheDir() : options.cacheDir;
|
|
16
|
+
const cacheFile = cacheDir === null ? null : join(cacheDir, `index-v${options.version}.json`);
|
|
17
|
+
if (cacheFile !== null) {
|
|
18
|
+
const cached = await readCached(cacheFile, options.version);
|
|
19
|
+
if (cached)
|
|
20
|
+
return cached;
|
|
21
|
+
}
|
|
22
|
+
const doFetch = options.fetch ?? fetch;
|
|
23
|
+
const response = await doFetch(url);
|
|
24
|
+
if (response.status === NOT_FOUND)
|
|
25
|
+
throw new IndexNotPublishedError(options.version, url);
|
|
26
|
+
if (!response.ok)
|
|
27
|
+
throw new Error(`Fetching ${url} failed with HTTP ${response.status}`);
|
|
28
|
+
const text = await response.text();
|
|
29
|
+
const parsed = JSON.parse(text);
|
|
30
|
+
if (!isApiIndex(parsed, options.version))
|
|
31
|
+
throw new Error(`${url} is not an API index for version ${options.version}`);
|
|
32
|
+
if (cacheFile !== null && cacheDir !== null)
|
|
33
|
+
await writeCached(cacheDir, cacheFile, text);
|
|
34
|
+
return parsed;
|
|
35
|
+
}
|
|
36
|
+
async function readCached(file, version) {
|
|
37
|
+
try {
|
|
38
|
+
const parsed = JSON.parse(await readFile(file, "utf8"));
|
|
39
|
+
return isApiIndex(parsed, version) ? parsed : undefined;
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const ignoreCacheWriteFailure = () => undefined;
|
|
46
|
+
async function writeCached(dir, file, text) {
|
|
47
|
+
const partial = `${file}.${process.pid}.partial`;
|
|
48
|
+
await mkdir(dir, { recursive: true })
|
|
49
|
+
.then(() => writeFile(partial, text, "utf8"))
|
|
50
|
+
.then(() => rename(partial, file))
|
|
51
|
+
.catch(ignoreCacheWriteFailure);
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=index-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-loader.js","sourceRoot":"","sources":["../src/index-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,sBAAsB,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACzG,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,SAAS,GAAG,GAAG,CAAC;AAEtB,MAAM,UAAU,eAAe,CAAC,MAA0C,OAAO,CAAC,GAAG;IACjF,MAAM,IAAI,GAAG,GAAG,CAAC,gBAAgB,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC;IAChE,OAAO,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;AACtC,CAAC;AAQD,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC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AAK,IAAI;QAAE,MAAM,WAAW,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IAC1F,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,KAAK,UAAU,UAAU,CAAC,IAAY,EAAE,OAAe;IACnD,IAAI,CAAC;QACD,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;QACjE,OAAO,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5D,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,SAAS,CAAC;IACrB,CAAC;AACL,CAAC;AAED,MAAM,uBAAuB,GAAG,GAAc,EAAE,CAAC,SAAS,CAAC;AAE3D,KAAK,UAAU,WAAW,CAAC,GAAW,EAAE,IAAY,EAAE,IAAY;IAC9D,MAAM,OAAO,GAAG,GAAG,IAAI,IAAI,OAAO,CAAC,GAAG,UAAU,CAAC;IACjD,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;SAChC,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;SAC5C,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;SACjC,KAAK,CAAC,uBAAuB,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ApiIndex, Engine, IndexExample, IndexMember } from "./index-types.js";
|
|
2
|
+
export interface SearchHit {
|
|
3
|
+
member: IndexMember;
|
|
4
|
+
score: number;
|
|
5
|
+
}
|
|
6
|
+
export interface SearchOptions {
|
|
7
|
+
engine?: Engine | undefined;
|
|
8
|
+
limit?: number | undefined;
|
|
9
|
+
}
|
|
10
|
+
export declare function tokenize(text: string): string[];
|
|
11
|
+
export declare class IndexReader {
|
|
12
|
+
readonly index: ApiIndex;
|
|
13
|
+
readonly version: string;
|
|
14
|
+
private readonly byPath;
|
|
15
|
+
private readonly tokens;
|
|
16
|
+
constructor(index: ApiIndex);
|
|
17
|
+
get(path: string): IndexMember | undefined;
|
|
18
|
+
all(): IndexMember[];
|
|
19
|
+
children(path?: string): IndexMember[];
|
|
20
|
+
search(query: string, options?: SearchOptions): SearchHit[];
|
|
21
|
+
nearest(path: string, limit?: number): IndexMember[];
|
|
22
|
+
examplesOf(path: string): IndexExample[];
|
|
23
|
+
examplesUnder(path: string, limit: number): IndexExample[];
|
|
24
|
+
private score;
|
|
25
|
+
}
|
|
26
|
+
export declare function editDistance(a: string, b: string, cap: number): number;
|
|
27
|
+
//# sourceMappingURL=index-reader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-reader.d.ts","sourceRoot":"","sources":["../src/index-reader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpF,MAAM,WAAW,SAAS;IACtB,MAAM,EAAE,WAAW,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC1B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B;AAiBD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAM/C;AAWD,qBAAa,WAAW;IAKR,QAAQ,CAAC,KAAK,EAAE,QAAQ;IAJpC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkC;IACzD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmC;gBAErC,KAAK,EAAE,QAAQ;IAYpC,GAAG,CAAC,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