Skip to content

Commit f793a61

Browse files
committed
feat(mcp): Rename project to zig-mcp and update related paths
1 parent 46d8c7e commit f793a61

File tree

6 files changed

+27
-42
lines changed

6 files changed

+27
-42
lines changed

bun.lock

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"lockfileVersion": 1,
33
"workspaces": {
44
"": {
5-
"name": "zig-docs-mcp",
5+
"name": "zig-mcp",
66
"dependencies": {
77
"@modelcontextprotocol/sdk": "^1.15.0",
88
"cheerio": "^1.1.0",
@@ -35,11 +35,11 @@
3535

3636
"@biomejs/cli-win32-x64": ["@biomejs/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-i2PKdn70kY++KEF/zkQFvQfX1e8SkA8hq4BgC+yE9dZqyLzB/XStY2MvwI3qswlRgnGpgncgqe0QYKVS1blksg=="],
3737

38-
"@modelcontextprotocol/sdk": ["@modelcontextprotocol/sdk@1.15.0", "", { "dependencies": { "ajv": "^6.12.6", "content-type": "^1.0.5", "cors": "^2.8.5", "cross-spawn": "^7.0.5", "eventsource": "^3.0.2", "eventsource-parser": "^3.0.0", "express": "^5.0.1", "express-rate-limit": "^7.5.0", "pkce-challenge": "^5.0.0", "raw-body": "^3.0.0", "zod": "^3.23.8", "zod-to-json-schema": "^3.24.1" } }, "sha512-67hnl/ROKdb03Vuu0YOr+baKTvf1/5YBHBm9KnZdjdAh8hjt4FRCPD5ucwxGB237sBpzlqQsLy1PFu7z/ekZ9Q=="],
38+
"@modelcontextprotocol/sdk": ["@modelcontextprotocol/sdk@1.16.0", "", { "dependencies": { "ajv": "^6.12.6", "content-type": "^1.0.5", "cors": "^2.8.5", "cross-spawn": "^7.0.5", "eventsource": "^3.0.2", "eventsource-parser": "^3.0.0", "express": "^5.0.1", "express-rate-limit": "^7.5.0", "pkce-challenge": "^5.0.0", "raw-body": "^3.0.0", "zod": "^3.23.8", "zod-to-json-schema": "^3.24.1" } }, "sha512-8ofX7gkZcLj9H9rSd50mCgm3SSF8C7XoclxJuLoV0Cz3rEQ1tv9MZRYYvJtm9n1BiEQQMzSmE/w2AEkNacLYfg=="],
3939

40-
"@types/bun": ["@types/[email protected].18", "", { "dependencies": { "bun-types": "1.2.18" } }, "sha512-Xf6RaWVheyemaThV0kUfaAUvCNokFr+bH8Jxp+tTZfx7dAPA8z9ePnP9S9+Vspzuxxx9JRAXhnyccRj3GyCMdQ=="],
40+
"@types/bun": ["@types/[email protected].19", "", { "dependencies": { "bun-types": "1.2.19" } }, "sha512-d9ZCmrH3CJ2uYKXQIUuZ/pUnTqIvLDS0SK7pFmbx8ma+ziH/FRMoAq5bYpRG7y+w1gl+HgyNZbtqgMq4W4e2Lg=="],
4141

42-
"@types/node": ["@types/[email protected].10", "", { "dependencies": { "undici-types": "~7.8.0" } }, "sha512-ENHwaH+JIRTDIEEbDK6QSQntAYGtbvdDXnMXnZaZ6k13Du1dPMmprkEHIL7ok2Wl2aZevetwTAb5S+7yIF+enA=="],
42+
"@types/node": ["@types/[email protected].15", "", { "dependencies": { "undici-types": "~7.8.0" } }, "sha512-oaeTSbCef7U/z7rDeJA138xpG3NuKc64/rZ2qmUFkFJmnMsAPaluIifqyWd8hSSMxyP9oie3dLAqYPblag9KgA=="],
4343

4444
"@types/react": ["@types/[email protected]", "", { "dependencies": { "csstype": "^3.0.2" } }, "sha512-AwAfQ2Wa5bCx9WP8nZL2uMZWod7J7/JSplxbTmBQ5ms6QpqNYm672H0Vu9ZVKVngQ+ii4R/byguVEUZQyeg44g=="],
4545

@@ -51,15 +51,15 @@
5151

5252
"boolbase": ["[email protected]", "", {}, "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww=="],
5353

54-
"bun-types": ["[email protected].18", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-04+Eha5NP7Z0A9YgDAzMk5PHR16ZuLVa83b26kH5+cp1qZW4F6FmAURngE7INf4tKOvCE69vYvDEwoNl1tGiWw=="],
54+
"bun-types": ["[email protected].19", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-uAOTaZSPuYsWIXRpj7o56Let0g/wjihKCkeRqUBhlLVM/Bt+Fj9xTo+LhC1OV1XDaGkz4hNC80et5xgy+9KTHQ=="],
5555

5656
"bytes": ["[email protected]", "", {}, "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg=="],
5757

5858
"call-bind-apply-helpers": ["[email protected]", "", { "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2" } }, "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ=="],
5959

6060
"call-bound": ["[email protected]", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.2", "get-intrinsic": "^1.3.0" } }, "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg=="],
6161

62-
"cheerio": ["[email protected].0", "", { "dependencies": { "cheerio-select": "^2.1.0", "dom-serializer": "^2.0.0", "domhandler": "^5.0.3", "domutils": "^3.2.2", "encoding-sniffer": "^0.2.0", "htmlparser2": "^10.0.0", "parse5": "^7.3.0", "parse5-htmlparser2-tree-adapter": "^7.1.0", "parse5-parser-stream": "^7.1.2", "undici": "^7.10.0", "whatwg-mimetype": "^4.0.0" } }, "sha512-+0hMx9eYhJvWbgpKV9hN7jg0JcwydpopZE4hgi+KvQtByZXPp04NiCWU0LzcAbP63abZckIHkTQaXVF52mX3xQ=="],
62+
"cheerio": ["[email protected].1", "", { "dependencies": { "cheerio-select": "^2.1.0", "dom-serializer": "^2.0.0", "domhandler": "^5.0.3", "domutils": "^3.2.2", "encoding-sniffer": "^0.2.1", "htmlparser2": "^10.0.0", "parse5": "^7.3.0", "parse5-htmlparser2-tree-adapter": "^7.1.0", "parse5-parser-stream": "^7.1.2", "undici": "^7.11.0", "whatwg-mimetype": "^4.0.0" } }, "sha512-bTXxVZeOfc3I97S4CSYVjcYvaTp92YOlwEUrVRtYrkuVn7S8/QKnnozVlztPcXlU039S2UxtsjAMyFRbX3V9gQ=="],
6363

6464
"cheerio-select": ["[email protected]", "", { "dependencies": { "boolbase": "^1.0.0", "css-select": "^5.1.0", "css-what": "^6.1.0", "domelementtype": "^2.3.0", "domhandler": "^5.0.3", "domutils": "^3.0.1" } }, "sha512-9v9kG0LvzrlcungtnJtpGNxY+fzECQKhK4EGJX2vByejiMX84MFNQw4UxPJl3bFbTMw+Dfs37XaIkCwTZfLh4g=="],
6565

@@ -241,7 +241,7 @@
241241

242242
"typescript": ["[email protected]", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ=="],
243243

244-
"undici": ["undici@7.11.0", "", {}, "sha512-heTSIac3iLhsmZhUCjyS3JQEkZELateufzZuBaVM5RHXdSBMb1LPMQf5x+FH7qjsZYDP0ttAc3nnVpUB+wYbOg=="],
244+
"undici": ["undici@7.12.0", "", {}, "sha512-GrKEsc3ughskmGA9jevVlIOPMiiAHJ4OFUtaAH+NhfTUSiZ1wMPIQqQvAJUrJspFXJt3EBWgpAeoHEDVT1IBug=="],
245245

246246
"undici-types": ["[email protected]", "", {}, "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw=="],
247247

@@ -259,7 +259,7 @@
259259

260260
"wrappy": ["[email protected]", "", {}, "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="],
261261

262-
"zod": ["[email protected].75", "", {}, "sha512-OhpzAmVzabPOL6C3A3gpAifqr9MqihV/Msx3gor2b2kviCgcb+HM9SEOpMWwwNp9MRunWnhtAKUoo0AHhjyPPg=="],
262+
"zod": ["[email protected].76", "", {}, "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ=="],
263263

264264
"zod-to-json-schema": ["[email protected]", "", { "peerDependencies": { "zod": "^3.24.1" } }, "sha512-h/z3PKvcTcTetyjl1fkj79MHNEjm+HpD6NXheWjzOekY7kV+lwDYnHw+ivHkijnCSMz1yJaWBD9vu/Fcmk+vEg=="],
265265

mcp/docs.ts

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { spawn } from "node:child_process";
21
import * as fs from "node:fs";
32
import * as http from "node:http";
43
import * as path from "node:path";
4+
import { fileURLToPath } from "node:url";
55
import envPaths from "env-paths";
66
import extractBuiltinFunctions, { type BuiltinFunction } from "./extract-builtin-functions.js";
77

@@ -12,7 +12,7 @@ export async function ensureDocs(
1212
updatePolicy: UpdatePolicy = "manual",
1313
isMcpMode = true,
1414
): Promise<BuiltinFunction[]> {
15-
const paths = envPaths("zig-docs-mcp", { suffix: "" });
15+
const paths = envPaths("zig-mcp", { suffix: "" });
1616
const metadataPath = path.join(paths.cache, zigVersion, "metadata.json");
1717

1818
let shouldUpdate = false;
@@ -78,7 +78,7 @@ export async function downloadSourcesTar(
7878
zigVersion: string,
7979
isMcpMode: boolean = false,
8080
): Promise<Uint8Array> {
81-
const paths = envPaths("zig-docs-mcp", { suffix: "" });
81+
const paths = envPaths("zig-mcp", { suffix: "" });
8282
const versionCacheDir = path.join(paths.cache, zigVersion);
8383
const sourcesPath = path.join(versionCacheDir, "sources.tar");
8484

@@ -111,7 +111,7 @@ export async function downloadSourcesTar(
111111
}
112112

113113
async function downloadSourcesTarPath(zigVersion: string): Promise<string> {
114-
const paths = envPaths("zig-docs-mcp", { suffix: "" });
114+
const paths = envPaths("zig-mcp", { suffix: "" });
115115
const versionCacheDir = path.join(paths.cache, zigVersion);
116116
const sourcesPath = path.join(versionCacheDir, "sources.tar");
117117

@@ -124,26 +124,11 @@ async function downloadSourcesTarPath(zigVersion: string): Promise<string> {
124124
return sourcesPath;
125125
}
126126

127-
function openBrowser(url: string): void {
128-
const platform = process.platform;
129-
let command: string;
130-
131-
if (platform === "darwin") {
132-
command = "open";
133-
} else if (platform === "win32") {
134-
command = "start";
135-
} else {
136-
command = "xdg-open";
137-
}
138-
139-
spawn(command, [url], { detached: true, stdio: "ignore" }).unref();
140-
}
141-
142127
export async function startViewServer(zigVersion: string): Promise<void> {
143128
try {
144129
const sourcesPath = await downloadSourcesTarPath(zigVersion);
145130

146-
const currentDir = path.dirname(new URL(import.meta.url).pathname);
131+
const currentDir = path.dirname(fileURLToPath(import.meta.url));
147132
const wasmPath = path.join(currentDir, "main.wasm");
148133
const indexPath = path.join(currentDir, "index.html");
149134
const stdJsPath = path.join(currentDir, "std.js");
@@ -194,8 +179,6 @@ export async function startViewServer(zigVersion: string): Promise<void> {
194179
console.log(`Server started at ${url}`);
195180
console.log(`Serving Zig ${zigVersion} documentation`);
196181
console.log("Press Ctrl+C to stop the server");
197-
198-
openBrowser(url);
199182
});
200183

201184
process.on("SIGINT", () => {

mcp/extract-builtin-functions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ async function extractBuiltinFunctions(
1313
zigVersion: string,
1414
isMcpMode = true,
1515
): Promise<BuiltinFunction[]> {
16-
const paths = envPaths("zig-docs-mcp", { suffix: "" });
16+
const paths = envPaths("zig-mcp", { suffix: "" });
1717
const versionCacheDir = path.join(paths.cache, zigVersion);
1818
const outputPath = path.join(versionCacheDir, "builtin-functions.json");
1919

mcp/mcp.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/usr/bin/env node
12
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
23
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
34
import { downloadSourcesTar, ensureDocs, startViewServer, type UpdatePolicy } from "./docs.js";
@@ -44,7 +45,7 @@ function parseArgs(args: string[]): CLIOptions {
4445
}
4546

4647
function printHelp() {
47-
console.log(`Usage: zig-docs-mcp [options] [command]
48+
console.log(`Usage: zig-mcp [options] [command]
4849
4950
Commands:
5051
update Update documentation without starting MCP server
@@ -58,11 +59,11 @@ Options:
5859
-h, --help Show this help message
5960
6061
Examples:
61-
zig-docs-mcp # Start MCP server with master version
62-
zig-docs-mcp --version 0.14.1 # Start with specific version
63-
zig-docs-mcp --update-policy daily # Auto-update daily on startup
64-
zig-docs-mcp update --version 0.14.1 # Update docs to specific version
65-
zig-docs-mcp view --version master # View documentation for specific version`);
62+
zig-mcp # Start MCP server with master version
63+
zig-mcp --version 0.14.1 # Start with specific version
64+
zig-mcp --update-policy daily # Auto-update daily on startup
65+
zig-mcp update --version 0.14.1 # Update docs to specific version
66+
zig-mcp view --version master # View documentation for specific version`);
6667
}
6768

6869
async function main() {

mcp/tools.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as path from "node:path";
2+
import { fileURLToPath } from "node:url";
23
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
34
import z from "zod";
45
import type { BuiltinFunction } from "./extract-builtin-functions.js";
@@ -208,7 +209,7 @@ export function registerAllTools(
208209
builtinFunctions: BuiltinFunction[],
209210
stdSources: Uint8Array<ArrayBuffer>,
210211
) {
211-
const currentDir = path.dirname(new URL(import.meta.url).pathname);
212+
const currentDir = path.dirname(fileURLToPath(import.meta.url));
212213
const wasmPath = path.join(currentDir, "main.wasm");
213214

214215
const listBuiltinFunctionsTool = createListBuiltinFunctionsTool(builtinFunctions);

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"name": "zig-docs-mcp",
2+
"name": "zig-mcp",
33
"version": "1.0.0",
44
"type": "module",
55
"bin": {
6-
"zig-docs-mcp": "dist/mcp.js"
6+
"zig-mcp": "dist/mcp.js"
77
},
88
"main": "dist/mcp.js",
99
"files": [
@@ -14,7 +14,7 @@
1414
"scripts": {
1515
"dev": "bun run build && bunx @modelcontextprotocol/inspector bun dist/mcp.js",
1616
"build": "zig build --release && tsc && cp zig-out/main.wasm mcp/index.html dist/",
17-
"prepublishOnly": "npm run build",
17+
"prepublishOnly": "bun run build",
1818
"lint": "bunx biome check",
1919
"lint:fix": "bunx biome check --write",
2020
"typecheck": "tsc --noEmit"
@@ -24,7 +24,7 @@
2424
"description": "MCP server that provides up-to-date documentation for the Zig programming language standard library and builtin functions.",
2525
"repository": {
2626
"type": "git",
27-
"url": "https://github.com/zig-wasm/zig-docs-mcp"
27+
"url": "git+https://github.com/zig-wasm/zig-mcp.git"
2828
},
2929
"keywords": [
3030
"mcp",

0 commit comments

Comments
 (0)