@bitbybit-dev/mcp 1.3.2-rc.0 → 1.3.2
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/README.md +15 -1
- package/dist/identity.d.ts +13 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +6 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +3 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +11 -2
- package/dist/server.js.map +1 -1
- package/dist/stdio.js +2 -1
- package/dist/stdio.js.map +1 -1
- package/package.json +2 -2
- package/server.json +8 -4
- package/src/dependencies.test.ts +13 -1
- package/src/identity.ts +18 -0
- package/src/index-loader.test.ts +15 -0
- package/src/index.ts +2 -0
- package/src/installed-version.test.ts +24 -1
- package/src/render.test.ts +81 -0
- package/src/server.test.ts +4 -3
- package/src/server.ts +15 -10
- package/src/stdio.ts +2 -1
package/README.md
CHANGED
|
@@ -12,6 +12,8 @@ The diagram shows what an agent is writing code *for*. The MIT-licensed [npm pac
|
|
|
12
12
|
|
|
13
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
14
|
|
|
15
|
+
[](https://cursor.com/link/mcp/install?name=bitbybit&config=eyJ1cmwiOiJodHRwczovL21jcC5iaXRieWJpdC5kZXYvbWNwIn0=) [](https://insiders.vscode.dev/redirect/mcp/install?name=bitbybit&config=%7B%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fmcp.bitbybit.dev%2Fmcp%22%7D) [](https://insiders.vscode.dev/redirect/mcp/install?name=bitbybit&config=%7B%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fmcp.bitbybit.dev%2Fmcp%22%7D&quality=insiders)
|
|
16
|
+
|
|
15
17
|
**Claude Code**
|
|
16
18
|
|
|
17
19
|
```bash
|
|
@@ -42,7 +44,17 @@ For a project, commit a `.mcp.json` at its root so every collaborator's Claude C
|
|
|
42
44
|
{ "servers": { "bitbybit": { "type": "http", "url": "https://mcp.bitbybit.dev/mcp" } } }
|
|
43
45
|
```
|
|
44
46
|
|
|
45
|
-
Either form takes the local server instead: `{ "command": "npx", "args": ["-y", "@bitbybit-dev/mcp"] }`, with `"type": "stdio"` in VS Code.
|
|
47
|
+
Either form takes the local server instead: `{ "command": "npx", "args": ["-y", "@bitbybit-dev/mcp"] }`, with `"type": "stdio"` in VS Code.
|
|
48
|
+
|
|
49
|
+
**Codex**
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
codex mcp add bitbybit --url https://mcp.bitbybit.dev/mcp
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
or `codex mcp add bitbybit -- npx -y @bitbybit-dev/mcp` for the local server. In `~/.codex/config.toml` that is `[mcp_servers.bitbybit]` with `url = "https://mcp.bitbybit.dev/mcp"`.
|
|
56
|
+
|
|
57
|
+
Gemini CLI (`gemini mcp add -t http bitbybit https://mcp.bitbybit.dev/mcp`), Windsurf (`serverUrl` in `~/.codeium/windsurf/mcp_config.json`), Zed (`context_servers` in its settings) and the JetBrains IDEs (AI Assistant, MCP, a JSON entry with `url`) take the same address. 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
58
|
|
|
47
59
|
## Which version it serves
|
|
48
60
|
|
|
@@ -76,6 +88,8 @@ This server answers questions; it never runs geometry. When you want the agent t
|
|
|
76
88
|
claude mcp add --transport http bitbybit-cloud https://api.bitbybit.dev/mcp --header "X-API-Key: <your key>"
|
|
77
89
|
```
|
|
78
90
|
|
|
91
|
+
In Codex the same is `[mcp_servers.bitbybit-cloud]` with `url = "https://api.bitbybit.dev/mcp"` and `env_http_headers = { "X-API-Key" = "BITBYBIT_API_KEY" }`, the key read from the environment.
|
|
92
|
+
|
|
79
93
|
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
94
|
|
|
81
95
|
## As a library
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface ServerIcon {
|
|
2
|
+
src: string;
|
|
3
|
+
mimeType?: "image/png" | "image/jpeg" | "image/svg+xml" | "image/webp";
|
|
4
|
+
sizes?: string[];
|
|
5
|
+
theme?: "light" | "dark";
|
|
6
|
+
}
|
|
7
|
+
export interface ServerBranding {
|
|
8
|
+
title?: string;
|
|
9
|
+
websiteUrl?: string;
|
|
10
|
+
icons?: ServerIcon[];
|
|
11
|
+
}
|
|
12
|
+
export declare const SERVER_IDENTITY: Required<ServerBranding>;
|
|
13
|
+
//# sourceMappingURL=identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,WAAW,GAAG,YAAY,GAAG,eAAe,GAAG,YAAY,CAAC;IACvE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,cAAc;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;CACxB;AAED,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,cAAc,CAIpD,CAAC"}
|
package/dist/identity.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const SERVER_IDENTITY = {
|
|
2
|
+
title: "Bitbybit CAD MCP",
|
|
3
|
+
websiteUrl: "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/mcp/bitbybit-mcp",
|
|
4
|
+
icons: [{ src: "https://learn.bitbybit.dev/img/favicon-192x192.png", mimeType: "image/png", sizes: ["192x192"] }],
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.js","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAaA,MAAM,CAAC,MAAM,eAAe,GAA6B;IACrD,KAAK,EAAE,kBAAkB;IACzB,UAAU,EAAE,0EAA0E;IACtF,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,oDAAoD,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC;CACpH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -18,4 +18,6 @@ export { splitGuides, slugify } from "./guides-split.js";
|
|
|
18
18
|
export type { GuideSection } from "./guides-split.js";
|
|
19
19
|
export { GUIDES, GUIDE_PAGE_URL } from "./guides.generated.js";
|
|
20
20
|
export { INDEX_HOST, IndexNotPublishedError, indexPath, indexUrl, isExactVersion } from "./index-url.js";
|
|
21
|
+
export { SERVER_IDENTITY } from "./identity.js";
|
|
22
|
+
export type { ServerBranding, ServerIcon } from "./identity.js";
|
|
21
23
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACzI,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,eAAe,C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,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACzD,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACzG,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -11,4 +11,5 @@ export { renderLine, renderMember } from "./render.js";
|
|
|
11
11
|
export { splitGuides, slugify } from "./guides-split.js";
|
|
12
12
|
export { GUIDES, GUIDE_PAGE_URL } from "./guides.generated.js";
|
|
13
13
|
export { INDEX_HOST, IndexNotPublishedError, indexPath, indexUrl, isExactVersion } from "./index-url.js";
|
|
14
|
+
export { SERVER_IDENTITY } from "./identity.js";
|
|
14
15
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEnI,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAE9D,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,mBAA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UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEhG,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACzG,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/server.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { McpServer } from "@modelcontextprotocol/server";
|
|
2
2
|
import type { AnyToolDefinition, Registry } from "./registry.js";
|
|
3
|
-
|
|
3
|
+
import type { ServerBranding } from "./identity.js";
|
|
4
|
+
export interface McpServerOptions<TContext> extends ServerBranding {
|
|
4
5
|
name: string;
|
|
5
6
|
version: string;
|
|
6
7
|
instructions?: string;
|
|
7
8
|
filter?: (definition: AnyToolDefinition<TContext>) => boolean;
|
|
8
9
|
}
|
|
9
|
-
export interface RequestHandlerOptions<TContext> {
|
|
10
|
+
export interface RequestHandlerOptions<TContext> extends ServerBranding {
|
|
10
11
|
name: string;
|
|
11
12
|
version: string;
|
|
12
13
|
instructions?: string;
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAoB,MAAM,8BAA8B,CAAC;AAI3E,OAAO,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAyB,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAoB,MAAM,8BAA8B,CAAC;AAI3E,OAAO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CAAC,GAAG,SAAS,CAIzI;AAYD,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,qBAAqB,CAAC,QAAQ,CAAC,GAAG,cAAc,CAAC,QAAQ,CAAC,CAW/I"}
|
package/dist/server.js
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { McpServer, createMcpHandler } from "@modelcontextprotocol/server";
|
|
2
2
|
import { inputJsonSchema } from "./registry.js";
|
|
3
3
|
const REQUEST_CONTEXT = "dev.bitbybit/request-context";
|
|
4
|
+
function implementationOf(options) {
|
|
5
|
+
return {
|
|
6
|
+
name: options.name,
|
|
7
|
+
version: options.version,
|
|
8
|
+
...(options.title === undefined ? {} : { title: options.title }),
|
|
9
|
+
...(options.websiteUrl === undefined ? {} : { websiteUrl: options.websiteUrl }),
|
|
10
|
+
...(options.icons === undefined ? {} : { icons: options.icons }),
|
|
11
|
+
};
|
|
12
|
+
}
|
|
4
13
|
function toCallToolResult(result) {
|
|
5
14
|
const links = (result.links ?? []).map((link) => ({
|
|
6
15
|
type: "resource_link",
|
|
@@ -44,7 +53,7 @@ export function bindRegistry(server, registry, context, filter) {
|
|
|
44
53
|
return bound;
|
|
45
54
|
}
|
|
46
55
|
export function createMcpServer(registry, context, options) {
|
|
47
|
-
const server = new McpServer(
|
|
56
|
+
const server = new McpServer(implementationOf(options), options.instructions === undefined ? {} : { instructions: options.instructions });
|
|
48
57
|
bindRegistry(server, registry, context, options.filter);
|
|
49
58
|
return server;
|
|
50
59
|
}
|
|
@@ -60,7 +69,7 @@ function carried(authInfo) {
|
|
|
60
69
|
export function createRequestHandler(registry, options) {
|
|
61
70
|
const handler = createMcpHandler(({ authInfo }) => {
|
|
62
71
|
const context = carried(authInfo);
|
|
63
|
-
const server = new McpServer(
|
|
72
|
+
const server = new McpServer(implementationOf(options), options.instructions === undefined ? {} : { instructions: options.instructions });
|
|
64
73
|
bindRegistry(server, registry, context, options.filterFor?.(context));
|
|
65
74
|
return server;
|
|
66
75
|
}, { legacy: "stateless", responseMode: "json", ...(options.onError === undefined ? {} : { onerror: options.onError }) });
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAG3E,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAG3E,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAuBhD,MAAM,eAAe,GAAG,8BAA8B,CAAC;AAEvD,SAAS,gBAAgB,CAAC,OAA2D;IACjF,OAAO;QACH,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,GAAG,CAAC,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC;QAChE,GAAG,CAAC,OAAO,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC;QAC/E,GAAG,CAAC,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC;KACnE,CAAC;AACN,CAAC;AAKD,SAAS,gBAAgB,CAAC,MAAkB;IACxC,MAAM,KAAK,GAAkB,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC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CAAC,EACD,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,EAAE,CACxH,CAAC;IACF,OAAO,EAAE,KAAK,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC;AACpG,CAAC"}
|
package/dist/stdio.js
CHANGED
|
@@ -3,6 +3,7 @@ import { readFileSync } from "node:fs";
|
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/server/stdio";
|
|
4
4
|
import { createDocsRegistry } from "./tools/index.js";
|
|
5
5
|
import { createMcpServer } from "./server.js";
|
|
6
|
+
import { SERVER_IDENTITY } from "./identity.js";
|
|
6
7
|
import { guarded } from "./registry.js";
|
|
7
8
|
import { contextForIndex } from "./context.js";
|
|
8
9
|
import { defaultCacheDir, IndexNotPublishedError, loadIndex } from "./index-loader.js";
|
|
@@ -53,7 +54,7 @@ async function main() {
|
|
|
53
54
|
const { index, served } = await loadServed(detected, own, argv.includes("--no-cache") ? null : defaultCacheDir());
|
|
54
55
|
const context = contextForIndex(index, GUIDES, GUIDE_PAGE_URL);
|
|
55
56
|
const registry = guarded(createDocsRegistry(), (error, tool) => console.error(`bitbybit-mcp: ${tool} failed: ${error instanceof Error ? error.message : String(error)}`));
|
|
56
|
-
const server = createMcpServer(registry, context, { name: "bitbybit", version: own, instructions: SERVER_INSTRUCTIONS });
|
|
57
|
+
const server = createMcpServer(registry, context, { name: "bitbybit", version: own, instructions: SERVER_INSTRUCTIONS, ...SERVER_IDENTITY });
|
|
57
58
|
await server.connect(new StdioServerTransport());
|
|
58
59
|
console.error(`bitbybit-mcp: serving the Bitbybit API index for version ${served.version} (from ${served.source})`);
|
|
59
60
|
}
|
package/dist/stdio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["../src/stdio.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGlE,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,MAAM,IAAI,GAAG;;;;;;;;;wGAS2F,CAAC;AAEzG,SAAS,UAAU;IACf,MAAM,QAAQ,GAAY,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACxG,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI,IAAI,SAAS,IAAI,QAAQ,IAAI,OAAO,QAAQ,CAAC,OAAO,KAAK,QAAQ;QAAE,OAAO,QAAQ,CAAC,OAAO,CAAC;IAChJ,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;AAC/D,CAAC;AAED,KAAK,UAAU,UAAU,CAAC,QAAyB,EAAE,GAAW,EA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AC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitbybit-dev/mcp",
|
|
3
|
-
"version": "1.3.2
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "MCP server for the Bitbybit 3D CAD API: version-exact lookups of every function, its parameters, defaults and examples, for AI coding agents",
|
|
5
5
|
"author": "Bit By Bit Developers",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
8
|
-
"mcpName": "dev.bitbybit/
|
|
8
|
+
"mcpName": "dev.bitbybit/cad",
|
|
9
9
|
"bin": {
|
|
10
10
|
"bitbybit-mcp": "./dist/stdio.js"
|
|
11
11
|
},
|
package/server.json
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
-
"name": "dev.bitbybit/
|
|
3
|
+
"name": "dev.bitbybit/cad",
|
|
4
4
|
"title": "Bitbybit CAD MCP",
|
|
5
|
-
"description": "Bitbybit CAD
|
|
6
|
-
"version": "1.3.2
|
|
5
|
+
"description": "Bitbybit 3D parametric CAD API, version-exact, for coding agents: search, describe, examples, guide",
|
|
6
|
+
"version": "1.3.2",
|
|
7
7
|
"repository": {
|
|
8
8
|
"url": "https://github.com/bitbybit-dev/bitbybit",
|
|
9
9
|
"source": "github",
|
|
10
10
|
"subfolder": "packages/dev/mcp"
|
|
11
11
|
},
|
|
12
12
|
"websiteUrl": "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/mcp/bitbybit-mcp",
|
|
13
|
+
"icons": [
|
|
14
|
+
{ "src": "https://learn.bitbybit.dev/img/favicon-192x192.png", "mimeType": "image/png", "sizes": ["192x192"] }
|
|
15
|
+
],
|
|
13
16
|
"packages": [
|
|
14
17
|
{
|
|
15
18
|
"registryType": "npm",
|
|
16
19
|
"registryBaseUrl": "https://registry.npmjs.org",
|
|
17
20
|
"identifier": "@bitbybit-dev/mcp",
|
|
18
|
-
"
|
|
21
|
+
"runtimeHint": "npx",
|
|
22
|
+
"version": "1.3.2",
|
|
19
23
|
"transport": {
|
|
20
24
|
"type": "stdio"
|
|
21
25
|
}
|
package/src/dependencies.test.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { readdirSync, readFileSync } from "node:fs";
|
|
2
|
+
import { SERVER_IDENTITY } from "./identity.js";
|
|
2
3
|
import { join } from "node:path";
|
|
3
4
|
import { fileURLToPath } from "node:url";
|
|
4
5
|
import { describe, expect, it } from "vitest";
|
|
@@ -48,9 +49,20 @@ describe("the package boundary", () => {
|
|
|
48
49
|
it("names itself the same way for npm and for the MCP registry", () => {
|
|
49
50
|
// Assert
|
|
50
51
|
expect(manifest.name).toBe("@bitbybit-dev/mcp");
|
|
51
|
-
expect(manifest.mcpName).toBe("dev.bitbybit/
|
|
52
|
+
expect(manifest.mcpName).toBe("dev.bitbybit/cad");
|
|
52
53
|
expect((JSON.parse(readFileSync(join(packageDirectory, "server.json"), "utf8")) as { name: string }).name).toBe(manifest.mcpName);
|
|
53
54
|
});
|
|
55
|
+
|
|
56
|
+
it("tells the registry the same title, page and icon it tells a client on initialize", () => {
|
|
57
|
+
// Act
|
|
58
|
+
const registryManifest = JSON.parse(readFileSync(join(packageDirectory, "server.json"), "utf8")) as { title: string; websiteUrl: string; icons: unknown; packages: { runtimeHint?: string }[] };
|
|
59
|
+
|
|
60
|
+
// Assert
|
|
61
|
+
expect(registryManifest.title).toBe(SERVER_IDENTITY.title);
|
|
62
|
+
expect(registryManifest.websiteUrl).toBe(SERVER_IDENTITY.websiteUrl);
|
|
63
|
+
expect(registryManifest.icons).toEqual(SERVER_IDENTITY.icons);
|
|
64
|
+
expect(registryManifest.packages[0]?.runtimeHint).toBe("npx");
|
|
65
|
+
});
|
|
54
66
|
});
|
|
55
67
|
|
|
56
68
|
describe("the public surface a host builds on", () => {
|
package/src/identity.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface ServerIcon {
|
|
2
|
+
src: string;
|
|
3
|
+
mimeType?: "image/png" | "image/jpeg" | "image/svg+xml" | "image/webp";
|
|
4
|
+
sizes?: string[];
|
|
5
|
+
theme?: "light" | "dark";
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface ServerBranding {
|
|
9
|
+
title?: string;
|
|
10
|
+
websiteUrl?: string;
|
|
11
|
+
icons?: ServerIcon[];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const SERVER_IDENTITY: Required<ServerBranding> = {
|
|
15
|
+
title: "Bitbybit CAD MCP",
|
|
16
|
+
websiteUrl: "https://learn.bitbybit.dev/learn/using-ai-with-bitbybit/mcp/bitbybit-mcp",
|
|
17
|
+
icons: [{ src: "https://learn.bitbybit.dev/img/favicon-192x192.png", mimeType: "image/png", sizes: ["192x192"] }],
|
|
18
|
+
};
|
package/src/index-loader.test.ts
CHANGED
|
@@ -99,6 +99,21 @@ describe("loadIndex", () => {
|
|
|
99
99
|
expect(readdirSync(cacheDir).filter((name) => name.endsWith(".partial"))).toEqual([]);
|
|
100
100
|
});
|
|
101
101
|
|
|
102
|
+
it("answers the index when the cache directory cannot be created, and writes nothing", async () => {
|
|
103
|
+
// Arrange
|
|
104
|
+
const blocker = join(temporaryDirectory(), "not-a-directory");
|
|
105
|
+
writeFileSync(blocker, "");
|
|
106
|
+
const cacheDir = join(blocker, "cache");
|
|
107
|
+
const { fetch } = fetchAnswering(200, JSON.stringify(fixtureIndex()));
|
|
108
|
+
|
|
109
|
+
// Act
|
|
110
|
+
const index = await loadIndex({ version: "9.9.9", fetch, cacheDir });
|
|
111
|
+
|
|
112
|
+
// Assert
|
|
113
|
+
expect(index.version).toBe("9.9.9");
|
|
114
|
+
expect(existsSync(cacheDir)).toBe(false);
|
|
115
|
+
});
|
|
116
|
+
|
|
102
117
|
it("reads a cached index without fetching", async () => {
|
|
103
118
|
// Arrange
|
|
104
119
|
const cacheDir = temporaryDirectory();
|
package/src/index.ts
CHANGED
|
@@ -18,3 +18,5 @@ export { splitGuides, slugify } from "./guides-split.js";
|
|
|
18
18
|
export type { GuideSection } from "./guides-split.js";
|
|
19
19
|
export { GUIDES, GUIDE_PAGE_URL } from "./guides.generated.js";
|
|
20
20
|
export { INDEX_HOST, IndexNotPublishedError, indexPath, indexUrl, isExactVersion } from "./index-url.js";
|
|
21
|
+
export { SERVER_IDENTITY } from "./identity.js";
|
|
22
|
+
export type { ServerBranding, ServerIcon } from "./identity.js";
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { tmpdir } from "node:os";
|
|
1
3
|
import { join } from "node:path";
|
|
2
|
-
import { describe, expect, it } from "vitest";
|
|
4
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
3
5
|
import { detectVersion, flagValue, installedVersions } from "./installed-version.js";
|
|
4
6
|
|
|
5
7
|
const manifest = (version: string): string => JSON.stringify({ version });
|
|
@@ -9,6 +11,27 @@ function filesystem(files: Record<string, string>): (path: string) => string | u
|
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
describe("installedVersions", () => {
|
|
14
|
+
const temporaryDirectories: string[] = [];
|
|
15
|
+
|
|
16
|
+
afterEach(() => {
|
|
17
|
+
for (const directory of temporaryDirectories.splice(0)) rmSync(directory, { recursive: true, force: true });
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("reads the manifests from disk when no reader is given, and skips a package that is not installed", () => {
|
|
21
|
+
// Arrange
|
|
22
|
+
const project = mkdtempSync(join(tmpdir(), "bitbybit-mcp-test-"));
|
|
23
|
+
temporaryDirectories.push(project);
|
|
24
|
+
const core = join(project, "node_modules", "@bitbybit-dev", "core");
|
|
25
|
+
mkdirSync(core, { recursive: true });
|
|
26
|
+
writeFileSync(join(core, "package.json"), manifest("1.2.0"));
|
|
27
|
+
|
|
28
|
+
// Act
|
|
29
|
+
const found = installedVersions(project);
|
|
30
|
+
|
|
31
|
+
// Assert
|
|
32
|
+
expect([...found.entries()]).toEqual([["core", "1.2.0"]]);
|
|
33
|
+
});
|
|
34
|
+
|
|
12
35
|
it("walks up from the working directory and reads each package once", () => {
|
|
13
36
|
// Arrange
|
|
14
37
|
const project = join("/", "work", "app", "packages", "web");
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { IndexReader } from "./index-reader.js";
|
|
3
|
+
import { renderMember } from "./render.js";
|
|
4
|
+
import type { IndexMember } from "./index-types.js";
|
|
5
|
+
import { fixtureIndex } from "./__fixtures__/load.js";
|
|
6
|
+
|
|
7
|
+
function member(overrides: Partial<IndexMember>): IndexMember {
|
|
8
|
+
return {
|
|
9
|
+
path: "occt.shapes.solid.createBox",
|
|
10
|
+
kind: "method",
|
|
11
|
+
name: "createBox",
|
|
12
|
+
className: "OCCTSolid",
|
|
13
|
+
signature: "createBox(inputs: BoxDto): Promise<TopoDSShapePointer>",
|
|
14
|
+
async: true,
|
|
15
|
+
params: [],
|
|
16
|
+
returns: "TopoDSShapePointer",
|
|
17
|
+
summary: "Creates a box",
|
|
18
|
+
doc: "",
|
|
19
|
+
docUrl: null,
|
|
20
|
+
engines: ["babylonjs", "threejs", "playcanvas"],
|
|
21
|
+
tier: "oss",
|
|
22
|
+
onApi3d: true,
|
|
23
|
+
weight: 2,
|
|
24
|
+
examples: [],
|
|
25
|
+
...overrides,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
describe("renderMember", () => {
|
|
30
|
+
it("lists the signature of every engine when they differ, naming an engine without one", () => {
|
|
31
|
+
// Arrange
|
|
32
|
+
const differing = member({ engineSignatures: { babylonjs: "drawModel(inputs: BabylonDto): Mesh", threejs: "drawModel(inputs: ThreeDto): Group", playcanvas: null } });
|
|
33
|
+
|
|
34
|
+
// Act
|
|
35
|
+
const text = renderMember(differing, "9.9.9", []);
|
|
36
|
+
|
|
37
|
+
// Assert
|
|
38
|
+
expect(text).toContain("Signature by engine:");
|
|
39
|
+
expect(text).toContain("- babylonjs: `drawModel(inputs: BabylonDto): Mesh`");
|
|
40
|
+
expect(text).toContain("- threejs: `drawModel(inputs: ThreeDto): Group`");
|
|
41
|
+
expect(text).toContain("- playcanvas: `none`");
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it("renders a field's options, range, step and default on its line", () => {
|
|
45
|
+
// Arrange
|
|
46
|
+
const withFields = member({
|
|
47
|
+
params: [{
|
|
48
|
+
name: "inputs",
|
|
49
|
+
type: "BoxDto",
|
|
50
|
+
optional: false,
|
|
51
|
+
fields: [
|
|
52
|
+
{ name: "axis", type: "ordinateAxisEnum", optional: false, doc: "Which axis", default: "x", options: [{ value: "x", label: "x" }, { value: "y", label: "y" }] },
|
|
53
|
+
{ name: "width", type: "number", optional: true, doc: "", default: 1, min: 0, max: 10, step: 0.5 },
|
|
54
|
+
],
|
|
55
|
+
}],
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// Act
|
|
59
|
+
const text = renderMember(withFields, "9.9.9", []);
|
|
60
|
+
|
|
61
|
+
// Assert
|
|
62
|
+
expect(text).toContain("- axis: ordinateAxisEnum; default \"x\"; one of x, y - Which axis");
|
|
63
|
+
expect(text).toContain("- width?: number; default 1; range 0 to 10; step 0.5");
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
describe("IndexReader", () => {
|
|
68
|
+
it("lists every member of the index and finds one by its path", () => {
|
|
69
|
+
// Arrange
|
|
70
|
+
const index = fixtureIndex();
|
|
71
|
+
const reader = new IndexReader(index);
|
|
72
|
+
|
|
73
|
+
// Act
|
|
74
|
+
const all = reader.all();
|
|
75
|
+
|
|
76
|
+
// Assert
|
|
77
|
+
expect(all).toHaveLength(index.members.length);
|
|
78
|
+
expect(all.map((entry) => entry.path)).toEqual(index.members.map((entry) => entry.path));
|
|
79
|
+
expect(reader.get(index.members[0]?.path ?? "")).toBe(index.members[0]);
|
|
80
|
+
});
|
|
81
|
+
});
|
package/src/server.test.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { z } from "zod";
|
|
|
6
6
|
import { Registry, toHttp } from "./registry.js";
|
|
7
7
|
import { ok } from "./results.js";
|
|
8
8
|
import { DESCRIPTIONS, SERVER_INSTRUCTIONS, TOOL_NAMES } from "./descriptions.js";
|
|
9
|
+
import { SERVER_IDENTITY } from "./identity.js";
|
|
9
10
|
import { FIXTURE_VERSION, fixtureContext } from "./__fixtures__/load.js";
|
|
10
11
|
|
|
11
12
|
async function connectedClient(): Promise<Client> {
|
|
@@ -219,15 +220,15 @@ describe("the request handler", () => {
|
|
|
219
220
|
expect(reported.map((error) => error.message)).toEqual(["the filter broke"]);
|
|
220
221
|
});
|
|
221
222
|
|
|
222
|
-
it("carries the server name, version and
|
|
223
|
+
it("carries the server name, version, instructions and identity", async () => {
|
|
223
224
|
// Arrange
|
|
224
|
-
const handler = createRequestHandler(callerRegistry(), { name: "bitbybit", version: FIXTURE_VERSION, instructions: SERVER_INSTRUCTIONS });
|
|
225
|
+
const handler = createRequestHandler(callerRegistry(), { name: "bitbybit", version: FIXTURE_VERSION, instructions: SERVER_INSTRUCTIONS, ...SERVER_IDENTITY });
|
|
225
226
|
|
|
226
227
|
// Act
|
|
227
228
|
const initialized = await reply(await handler.fetch(rpc("initialize", { protocolVersion: "2025-06-18", capabilities: {}, clientInfo: { name: "test-client", version: "0.0.0" } }), { who: "member" }));
|
|
228
229
|
|
|
229
230
|
// Assert
|
|
230
|
-
expect(initialized.result?.["serverInfo"]).
|
|
231
|
+
expect(initialized.result?.["serverInfo"]).toEqual({ name: "bitbybit", version: FIXTURE_VERSION, ...SERVER_IDENTITY });
|
|
231
232
|
expect(initialized.result?.["instructions"]).toBe(SERVER_INSTRUCTIONS);
|
|
232
233
|
});
|
|
233
234
|
});
|
package/src/server.ts
CHANGED
|
@@ -3,15 +3,16 @@ import type { AuthInfo, StandardSchemaWithJSON } from "@modelcontextprotocol/ser
|
|
|
3
3
|
import type { z } from "zod";
|
|
4
4
|
import { inputJsonSchema } from "./registry.js";
|
|
5
5
|
import type { AnyToolDefinition, Registry, ToolInput, ToolResult } from "./registry.js";
|
|
6
|
+
import type { ServerBranding } from "./identity.js";
|
|
6
7
|
|
|
7
|
-
export interface McpServerOptions<TContext> {
|
|
8
|
+
export interface McpServerOptions<TContext> extends ServerBranding {
|
|
8
9
|
name: string;
|
|
9
10
|
version: string;
|
|
10
11
|
instructions?: string;
|
|
11
12
|
filter?: (definition: AnyToolDefinition<TContext>) => boolean;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
export interface RequestHandlerOptions<TContext> {
|
|
15
|
+
export interface RequestHandlerOptions<TContext> extends ServerBranding {
|
|
15
16
|
name: string;
|
|
16
17
|
version: string;
|
|
17
18
|
instructions?: string;
|
|
@@ -25,6 +26,16 @@ export interface RequestHandler<TContext> {
|
|
|
25
26
|
|
|
26
27
|
const REQUEST_CONTEXT = "dev.bitbybit/request-context";
|
|
27
28
|
|
|
29
|
+
function implementationOf(options: ServerBranding & { name: string; version: string }): { name: string; version: string; title?: string; websiteUrl?: string; icons?: ServerBranding["icons"] } {
|
|
30
|
+
return {
|
|
31
|
+
name: options.name,
|
|
32
|
+
version: options.version,
|
|
33
|
+
...(options.title === undefined ? {} : { title: options.title }),
|
|
34
|
+
...(options.websiteUrl === undefined ? {} : { websiteUrl: options.websiteUrl }),
|
|
35
|
+
...(options.icons === undefined ? {} : { icons: options.icons }),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
28
39
|
type TextContent = { type: "text"; text: string };
|
|
29
40
|
type LinkContent = { type: "resource_link"; uri: string; name: string; mimeType?: string; description?: string };
|
|
30
41
|
|
|
@@ -82,10 +93,7 @@ export function bindRegistry<TContext>(
|
|
|
82
93
|
}
|
|
83
94
|
|
|
84
95
|
export function createMcpServer<TContext>(registry: Registry<TContext>, context: TContext, options: McpServerOptions<TContext>): McpServer {
|
|
85
|
-
const server = new McpServer(
|
|
86
|
-
{ name: options.name, version: options.version },
|
|
87
|
-
options.instructions === undefined ? {} : { instructions: options.instructions },
|
|
88
|
-
);
|
|
96
|
+
const server = new McpServer(implementationOf(options), options.instructions === undefined ? {} : { instructions: options.instructions });
|
|
89
97
|
bindRegistry(server, registry, context, options.filter);
|
|
90
98
|
return server;
|
|
91
99
|
}
|
|
@@ -104,10 +112,7 @@ export function createRequestHandler<TContext>(registry: Registry<TContext>, opt
|
|
|
104
112
|
const handler = createMcpHandler(
|
|
105
113
|
({ authInfo }) => {
|
|
106
114
|
const context = carried<TContext>(authInfo);
|
|
107
|
-
const server = new McpServer(
|
|
108
|
-
{ name: options.name, version: options.version },
|
|
109
|
-
options.instructions === undefined ? {} : { instructions: options.instructions },
|
|
110
|
-
);
|
|
115
|
+
const server = new McpServer(implementationOf(options), options.instructions === undefined ? {} : { instructions: options.instructions });
|
|
111
116
|
bindRegistry(server, registry, context, options.filterFor?.(context));
|
|
112
117
|
return server;
|
|
113
118
|
},
|
package/src/stdio.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { readFileSync } from "node:fs";
|
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/server/stdio";
|
|
4
4
|
import { createDocsRegistry } from "./tools/index.js";
|
|
5
5
|
import { createMcpServer } from "./server.js";
|
|
6
|
+
import { SERVER_IDENTITY } from "./identity.js";
|
|
6
7
|
import { guarded } from "./registry.js";
|
|
7
8
|
import { contextForIndex } from "./context.js";
|
|
8
9
|
import { defaultCacheDir, IndexNotPublishedError, loadIndex } from "./index-loader.js";
|
|
@@ -56,7 +57,7 @@ async function main(): Promise<void> {
|
|
|
56
57
|
const { index, served } = await loadServed(detected, own, argv.includes("--no-cache") ? null : defaultCacheDir());
|
|
57
58
|
const context = contextForIndex(index, GUIDES, GUIDE_PAGE_URL);
|
|
58
59
|
const registry = guarded(createDocsRegistry(), (error, tool) => console.error(`bitbybit-mcp: ${tool} failed: ${error instanceof Error ? error.message : String(error)}`));
|
|
59
|
-
const server = createMcpServer(registry, context, { name: "bitbybit", version: own, instructions: SERVER_INSTRUCTIONS });
|
|
60
|
+
const server = createMcpServer(registry, context, { name: "bitbybit", version: own, instructions: SERVER_INSTRUCTIONS, ...SERVER_IDENTITY });
|
|
60
61
|
await server.connect(new StdioServerTransport());
|
|
61
62
|
console.error(`bitbybit-mcp: serving the Bitbybit API index for version ${served.version} (from ${served.source})`);
|
|
62
63
|
}
|