Skip to content

Commit b574273

Browse files
committed
feat(mcp): Update version to 1.4.0 and enhance CLI options for docs source
1 parent 48dd3df commit b574273

File tree

3 files changed

+66
-20
lines changed

3 files changed

+66
-20
lines changed

README.md

Lines changed: 54 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,35 +26,32 @@ By default, the server uses your locally installed Zig compiler to serve documen
2626
The CLI provides flexible options for version control and update management:
2727

2828
```bash
29-
# Start MCP server with defaults (master branch, manual updates)
30-
zig-mcp
29+
# Start MCP server
30+
zig-mcp --doc-source local
3131

32-
# Use specific Zig version
33-
zig-mcp --version 0.14.1
32+
# Use specific Zig version from ziglang.org instead of local Zig
33+
zig-mcp --doc-source remote --version 0.14.1
3434

3535
# Enable automatic daily updates
36-
zig-mcp --update-policy daily
37-
38-
# Use remote documentation from ziglang.org instead of local Zig
39-
zig-mcp --doc-source remote --version 0.14.1
36+
zig-mcp --doc-source remote --update-policy daily
4037

41-
# Update documentation without starting server
38+
# Update documentation without starting MCP server (only for remote)
4239
zig-mcp update --version 0.15.1
4340

4441
# Start local web server to view documentation
4542
zig-mcp view --version 0.15.1
4643
```
4744

48-
**Version options**:
45+
**Version options `--version`**:
4946
- `master` (default) - Latest development version from Zig's master branch
5047
- `0.14.1`, `0.14.0`, etc. - Specific Zig release versions
5148

52-
**Update policies**:
49+
**Update policies `--update-policy`**:
5350
- `manual` (default) - No automatic updates, manual control only
5451
- `daily` - Check for documentation updates once per day
5552
- `startup` - Update documentation every time the server starts
5653

57-
**Documentation sources**:
54+
**Documentation sources `--doc-source`**:
5855
- `local` (default) - Use your locally installed Zig compiler's documentation server (`zig std`)
5956
- `remote` - Download documentation from ziglang.org
6057

@@ -76,15 +73,17 @@ When using `--doc-source remote`, documentation is fetched from ziglang.org and
7673

7774
## Installation
7875

76+
The installation examples below use the local documentation source by default. In local mode, docs are served by your installed Zig via `zig std`, requiring no network and matching your actual Zig version. This is the recommended setup for most users. For downloading docs from ziglang.org instead, see Remote Documentation (Optional) below.
77+
7978
### Claude Code
8079
Using npx (Node.js)
8180
```bash
82-
claude mcp add zig-docs -- npx -y zig-mcp@latest --version master --update-policy manual
81+
claude mcp add zig-docs -- npx -y zig-mcp@latest
8382
```
8483

8584
Using bunx (Bun)
8685
```bash
87-
claude mcp add zig-docs -- bunx zig-mcp@latest --version master --update-policy manual
86+
claude mcp add zig-docs -- bunx zig-mcp@latest
8887
```
8988

9089
### Roo Code
@@ -109,7 +108,7 @@ Add the JSON configuration below to your MCP settings file.
109108
"mcpServers": {
110109
"zig-docs": {
111110
"command": "npx",
112-
"args": ["-y", "zig-mcp@latest", "--version", "master", "--update-policy", "manual"]
111+
"args": ["-y", "zig-mcp@latest"]
113112
}
114113
}
115114
}
@@ -121,7 +120,46 @@ Add the JSON configuration below to your MCP settings file.
121120
"mcpServers": {
122121
"zig-docs": {
123122
"command": "bunx",
124-
"args": ["zig-mcp@latest", "--version", "master", "--update-policy", "manual"]
123+
"args": ["zig-mcp@latest"]
125124
}
126125
}
127126
}
127+
```
128+
129+
### Remote Documentation (Optional)
130+
131+
If you prefer downloading documentation from ziglang.org instead of using your local Zig, enable remote mode explicitly and choose a version:
132+
133+
Using npx (Node.js)
134+
```bash
135+
claude mcp add zig-docs -- npx -y zig-mcp@latest --doc-source remote --version master
136+
```
137+
138+
Using bunx (Bun)
139+
```bash
140+
claude mcp add zig-docs -- bunx zig-mcp@latest --doc-source remote --version 0.14.1
141+
```
142+
143+
**Node.js (remote):**
144+
```json
145+
{
146+
"mcpServers": {
147+
"zig-docs": {
148+
"command": "npx",
149+
"args": ["-y", "zig-mcp@latest", "--doc-source", "remote", "--version", "master"]
150+
}
151+
}
152+
}
153+
```
154+
155+
**Bun (remote):**
156+
```json
157+
{
158+
"mcpServers": {
159+
"zig-docs": {
160+
"command": "bunx",
161+
"args": ["zig-mcp@latest", "--doc-source", "remote", "--version", "0.14.1"]
162+
}
163+
}
164+
}
165+
```

mcp/mcp.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ function parseArgs(args: string[]): CLIOptions {
2323
updatePolicy: "manual",
2424
docSource: "local",
2525
};
26+
let versionExplicit = false;
27+
let docSourceExplicit = false;
2628

2729
for (let i = 0; i < args.length; i++) {
2830
const arg = args[i];
@@ -33,6 +35,7 @@ function parseArgs(args: string[]): CLIOptions {
3335
options.command = "view";
3436
} else if (arg === "--version" && i + 1 < args.length) {
3537
options.version = args[++i];
38+
versionExplicit = true;
3639
} else if (arg === "--update-policy" && i + 1 < args.length) {
3740
const policy = args[++i];
3841
if (policy === "manual" || policy === "daily" || policy === "startup") {
@@ -47,6 +50,7 @@ function parseArgs(args: string[]): CLIOptions {
4750
const source = args[++i];
4851
if (source === "local" || source === "remote") {
4952
options.docSource = source;
53+
docSourceExplicit = true;
5054
} else {
5155
console.error(`Invalid doc source: ${source}. Must be one of: local, remote`);
5256
process.exit(1);
@@ -56,7 +60,11 @@ function parseArgs(args: string[]): CLIOptions {
5660
process.exit(0);
5761
}
5862
}
59-
63+
// If user explicitly provided --version but not --doc-source,
64+
// prefer remote docs since versioned docs come from ziglang.org
65+
if (versionExplicit && !docSourceExplicit) {
66+
options.docSource = "remote";
67+
}
6068
return options;
6169
}
6270

@@ -77,8 +85,8 @@ Options:
7785
-h, --help Show this help message
7886
7987
Examples:
80-
zig-mcp # Start MCP server with master version
81-
zig-mcp --version 0.14.1 # Start with specific version
88+
zig-mcp # Start MCP server with master version (local)
89+
zig-mcp --version 0.14.1 # Start with specific version (remote)
8290
zig-mcp --update-policy daily # Auto-update daily on startup
8391
zig-mcp update --version 0.14.1 # Update docs to specific version
8492
zig-mcp view --version master # View documentation for specific version`);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zig-mcp",
3-
"version": "1.3.0",
3+
"version": "1.4.0",
44
"type": "module",
55
"bin": {
66
"zig-mcp": "dist/mcp.js"

0 commit comments

Comments
 (0)