@stellar_ai/mcp_fossil_scm 0.1.0 → 0.1.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.
Files changed (45) hide show
  1. package/LICENSE +28 -0
  2. package/README.md +55 -38
  3. package/dist/capabilities.js +17 -19
  4. package/dist/cli.js +41 -34
  5. package/dist/config.js +1 -9
  6. package/dist/core/fossil.js +9 -9
  7. package/dist/core/sql.js +0 -1
  8. package/dist/index.js +5 -7
  9. package/dist/server.js +1 -2
  10. package/dist/tools/admin.js +9 -10
  11. package/dist/tools/chat.js +8 -12
  12. package/dist/tools/common.js +10 -2
  13. package/dist/tools/forum.js +16 -11
  14. package/dist/tools/tickets.js +0 -1
  15. package/dist/tools/version-control.js +32 -38
  16. package/dist/tools/wiki.js +0 -1
  17. package/package.json +6 -4
  18. package/dist/capabilities.d.ts +0 -33
  19. package/dist/capabilities.js.map +0 -1
  20. package/dist/cli.d.ts +0 -27
  21. package/dist/cli.js.map +0 -1
  22. package/dist/config.d.ts +0 -27
  23. package/dist/config.js.map +0 -1
  24. package/dist/core/fossil.d.ts +0 -104
  25. package/dist/core/fossil.js.map +0 -1
  26. package/dist/core/sql.d.ts +0 -29
  27. package/dist/core/sql.js.map +0 -1
  28. package/dist/index.d.ts +0 -2
  29. package/dist/index.js.map +0 -1
  30. package/dist/server.d.ts +0 -13
  31. package/dist/server.js.map +0 -1
  32. package/dist/tools/admin.d.ts +0 -3
  33. package/dist/tools/admin.js.map +0 -1
  34. package/dist/tools/chat.d.ts +0 -10
  35. package/dist/tools/chat.js.map +0 -1
  36. package/dist/tools/common.d.ts +0 -9
  37. package/dist/tools/common.js.map +0 -1
  38. package/dist/tools/forum.d.ts +0 -3
  39. package/dist/tools/forum.js.map +0 -1
  40. package/dist/tools/tickets.d.ts +0 -8
  41. package/dist/tools/tickets.js.map +0 -1
  42. package/dist/tools/version-control.d.ts +0 -3
  43. package/dist/tools/version-control.js.map +0 -1
  44. package/dist/tools/wiki.d.ts +0 -3
  45. package/dist/tools/wiki.js.map +0 -1
package/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026 ri-fumo
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md CHANGED
@@ -2,24 +2,26 @@
2
2
 
3
3
  MCP (Model Context Protocol) server for [Fossil SCM](https://fossil-scm.org/).
4
4
 
5
- One binary, one list of capability letters: `--capability` decides which tool groups this process exposes,
6
- so a client loads only what it needs.
5
+ Six capabilities (Admin, VCS, Forum, Tickets, Wiki, Chat), one binary, one list of letters:
6
+ `--capability` decides which tool groups this process exposes, so a client loads only what it needs.
7
+ Each letter is the **initial** of its capability name.
7
8
 
8
9
  | Letter | Capability | Tools | What it exposes |
9
10
  | --- | --- | --- | --- |
10
- | `a` | Admin | 5 | Repository lifecycle: `init`, `open`, `close`, `clone`, `settings` |
11
- | `b` | VCS | 20 | Version control: status, diff, history, add/commit, branch, merge, update, undo, … |
12
- | `c` | Forum | 3 | Forum thread list, thread reading and text search (read-only) |
13
- | `d` | Tickets | 3 | Ticket reports, creation, field updates |
14
- | `e` | Wiki | 3 | List, export and create/replace wiki pages |
15
- | `f` | Chat | 4 | Chatroom URL, send, pull history, read locally stored messages |
11
+ | `a` | **A**dmin | 5 | Repository lifecycle: `init`, `open`, `close`, `clone`, `settings` |
12
+ | `v` | **V**CS | 20 | Version control: status, diff, history, add/commit, branch, merge, update, undo, … |
13
+ | `f` | **F**orum | 3 | Forum thread list, thread reading and text search (read-only) |
14
+ | `t` | **T**ickets | 3 | Ticket reports, creation, field updates |
15
+ | `w` | **W**iki | 3 | List, export and create/replace wiki pages |
16
+ | `c` | **C**hat | 4 | Chatroom URL, send, pull history, read locally stored messages |
16
17
 
17
- The letters are consecutive, so a selection reads as a short string:
18
- `-c b` (20 tools), `-c ab` (25), `-c de` (6), `-c cdf` (10), `-c all` (38, the default).
18
+ The letters are written **together in a single value**: `-c v` (20 tools), `-c avf` (28), `-c aftw` (14),
19
+ and a single capital `-c A` for everything (38, also the default). Commas, spaces, `all`/`All` and repeated
20
+ `-c` flags are rejected.
19
21
 
20
22
  > Naming: the Fossil executable/command is `fossil`; this server is always called `fossil-scm`.
21
23
 
22
- TypeScript rewrite of the original single-file Python server (`./,server.py`), built on the
24
+ TypeScript rewrite of the earlier single-file Python implementation, built on the
23
25
  MCP TypeScript SDK v2 (`@modelcontextprotocol/server`).
24
26
 
25
27
  ## Requirements
@@ -27,22 +29,29 @@ MCP TypeScript SDK v2 (`@modelcontextprotocol/server`).
27
29
  - Node.js >= 20
28
30
  - `fossil` on `PATH` (or set `FOSSIL_BIN`)
29
31
 
30
- ## Build & run
32
+ ## Install
33
+
34
+ ```bash
35
+ pnpm add @stellar_ai/mcp_fossil_scm # or: npm i -g @stellar_ai/mcp_fossil_scm
36
+ npx -y @stellar_ai/mcp_fossil_scm -c avf --repository /path/to/workspace
37
+ ```
38
+
39
+ ## Build from source & run
31
40
 
32
41
  ```bash
33
42
  pnpm install
34
43
  pnpm build
35
44
 
36
- node dist/index.js -c b --repository /path/to/workspace # version control only
37
- node dist/index.js -c ab --repository /path/to/workspace # admin + VCS
38
- node dist/index.js -c de --repository /path/to/workspace # tickets + wiki
39
- node dist/index.js --capability all --repository /path/to/workspace
45
+ node dist/index.js -c v --repository /path/to/workspace # version control only
46
+ node dist/index.js -c avf --repository /path/to/workspace # admin + VCS + forum
47
+ node dist/index.js -c aftw --repository /path/to/workspace # admin + forum + tickets + wiki
48
+ node dist/index.js -c A --repository /path/to/workspace # everything
40
49
  ```
41
50
 
42
51
  After `npm link` / a global install the same binary is on `PATH` as `fossil-scm`:
43
52
 
44
53
  ```bash
45
- fossil-scm -c ab --repository /path/to/workspace
54
+ fossil-scm -c avf --repository /path/to/workspace
46
55
  ```
47
56
 
48
57
  ### Selective enabling from an MCP client
@@ -59,43 +68,43 @@ independent MCP server process with its own tool list:
59
68
  },
60
69
  "fossil-vcs": {
61
70
  "command": "node",
62
- "args": ["/abs/path/fossil-scm/dist/index.js", "-c", "b", "--repository", "/path/to/workspace"]
71
+ "args": ["/abs/path/fossil-scm/dist/index.js", "-c", "v", "--repository", "/path/to/workspace"]
63
72
  },
64
73
  "fossil-forum": {
65
74
  "command": "node",
66
- "args": ["/abs/path/fossil-scm/dist/index.js", "-c", "c", "--repository", "/path/to/workspace"]
75
+ "args": ["/abs/path/fossil-scm/dist/index.js", "-c", "f", "--repository", "/path/to/workspace"]
67
76
  },
68
77
  "fossil-tickets": {
69
78
  "command": "node",
70
- "args": ["/abs/path/fossil-scm/dist/index.js", "-c", "d", "--repository", "/path/to/workspace"]
79
+ "args": ["/abs/path/fossil-scm/dist/index.js", "-c", "t", "--repository", "/path/to/workspace"]
71
80
  },
72
81
  "fossil-wiki": {
73
82
  "command": "node",
74
- "args": ["/abs/path/fossil-scm/dist/index.js", "-c", "e", "--repository", "/path/to/workspace"]
83
+ "args": ["/abs/path/fossil-scm/dist/index.js", "-c", "w", "--repository", "/path/to/workspace"]
75
84
  },
76
85
  "fossil-chat": {
77
86
  "command": "node",
78
- "args": ["/abs/path/fossil-scm/dist/index.js", "-c", "f", "--repository", "/path/to/workspace"]
87
+ "args": ["/abs/path/fossil-scm/dist/index.js", "-c", "c", "--repository", "/path/to/workspace"]
79
88
  }
80
89
  }
81
90
  }
82
91
  ```
83
92
 
84
- The name reported during the handshake follows the selection: `fossil-scm-a` … `fossil-scm-f` for a single
85
- group, plain `fossil-scm` when several are combined.
93
+ The name reported during the handshake follows the selection: `fossil-scm-a`, `fossil-scm-v`, `fossil-scm-f`,
94
+ `fossil-scm-t`, `fossil-scm-w`, `fossil-scm-c` for a single group, plain `fossil-scm` when several are combined.
86
95
 
87
96
  ## Configuration
88
97
 
89
98
  | CLI flag | Meaning |
90
99
  | --- | --- |
91
- | `-c, --capability LIST` | Capability letters: `a b c d e f`. Accepts `ab`, `a,b`, `a b`, repeated `-c` flags, or `all`. Default: `FOSSIL_CAPABILITIES`, else all |
100
+ | `-c, --capability LIST` | One value with the capability initials together: `a` `v` `f` `t` `w` `c` → `-c avf`; a single capital `A` for everything. No separators, no repeated flag. Default: `FOSSIL_CAPABILITIES`, else `A` |
92
101
  | `--repository DIR` (also `--workspace`, `--cwd`, `-R`) | Default workspace for tool calls that omit `cwd` |
93
102
  | `--verbose`, `-v` | Diagnostics on stderr (stdout is reserved for the protocol) |
94
103
  | `--help`, `-h` | Usage, capability table and examples |
95
104
 
96
105
  | Environment variable | Default | Meaning |
97
106
  | --- | --- | --- |
98
- | `FOSSIL_CAPABILITIES` | all | Default capability letters (same syntax as `--capability`) |
107
+ | `FOSSIL_CAPABILITIES` | `A` | Default capability letters (same syntax as `--capability`, e.g. `avf` or `A`) |
99
108
  | `FOSSIL_WORKSPACE` / `FOSSIL_CWD` | cwd | Default workspace |
100
109
  | `FOSSIL_BIN` | `fossil` | Fossil executable (full path works too) |
101
110
  | `FOSSIL_TIMEOUT_MS` | `30000` | Timeout for regular commands |
@@ -111,22 +120,22 @@ explicit path is passed to a tool.
111
120
 
112
121
  **`a` Admin (5)** — `fossil_init`, `fossil_open`, `fossil_close`, `fossil_clone`, `fossil_settings`
113
122
 
114
- **`b` VCS (20)** — `fossil_status`, `fossil_diff`, `fossil_cat`, `fossil_finfo`, `fossil_revert`,
123
+ **`v` VCS (20)** — `fossil_status`, `fossil_diff`, `fossil_cat`, `fossil_finfo`, `fossil_revert`,
115
124
  `fossil_stash`, `fossil_tag`, `fossil_addremove`, `fossil_commit`, `fossil_add`, `fossil_rm`, `fossil_mv`,
116
125
  `fossil_extras`, `fossil_clean`, `fossil_timeline`, `fossil_info`, `fossil_branch`, `fossil_merge`,
117
126
  `fossil_update`, `fossil_undo`
118
127
 
119
- **`c` Forum (3)** — `fossil_forum_list`, `fossil_forum_read`, `fossil_forum_search`
128
+ **`f` Forum (3)** — `fossil_forum_list`, `fossil_forum_read`, `fossil_forum_search`
120
129
 
121
- **`d` Tickets (3)** — `fossil_ticket_list`, `fossil_ticket_create`, `fossil_ticket_update`
130
+ **`t` Tickets (3)** — `fossil_ticket_list`, `fossil_ticket_create`, `fossil_ticket_update`
122
131
 
123
- **`e` Wiki (3)** — `fossil_wiki_ls`, `fossil_wiki_read`, `fossil_wiki_write`
132
+ **`w` Wiki (3)** — `fossil_wiki_ls`, `fossil_wiki_read`, `fossil_wiki_write`
124
133
 
125
- **`f` Chat (4)** — `fossil_chat_url`, `fossil_chat_send`, `fossil_chat_pull`, `fossil_chat_read`
134
+ **`c` Chat (4)** — `fossil_chat_url`, `fossil_chat_send`, `fossil_chat_pull`, `fossil_chat_read`
126
135
 
127
136
  `fossil_init` / `fossil_open` (capability `a`) apply the recommended settings automatically
128
137
  (`crlf-glob='*'`, `dotfiles=1`, `ignore-glob`, `binary-glob`) and create + stage `.editorconfig` when it is
129
- missing. VCS and the content capabilities (`c`–`f`) expect an already opened check-out.
138
+ missing. VCS and the content capabilities (`v`, `f`, `t`, `w`, `c`) expect an already opened check-out.
130
139
 
131
140
  ### Capability notes
132
141
 
@@ -141,9 +150,9 @@ missing. VCS and the content capabilities (`c`–`f`) expect an already opened c
141
150
 
142
151
  ## What changed compared with the Python version
143
152
 
144
- - **Selectable capabilities, one binary.** Tools are registered per capability (`src/capabilities.ts`) and
145
- `--capability` takes a short letter list (`ab`, `cdf`, `all`) or `FOSSIL_CAPABILITIES`, so clients can
146
- enable only the groups they want.
153
+ - **Selectable capabilities, one binary.** Tools are registered per capability group (`src/capabilities.ts`:
154
+ Admin, VCS, Forum, Tickets, Wiki, Chat) and `--capability` takes the initials written together in one value
155
+ (`avf`, `aftw`, single capital `A` for all) or `FOSSIL_CAPABILITIES`, so clients enable only what they want.
147
156
  - **No interactive hangs.** `spawn` without a shell, stdin is always closed, `SIGTERM`→`SIGKILL` escalation,
148
157
  and per-command timeouts. The commit flow still answers the "commit anyhow" prompt with `a`.
149
158
  - **Fewer process spawns.** The four auto-config `fossil sql` calls collapse into one multi-statement
@@ -158,14 +167,22 @@ missing. VCS and the content capabilities (`c`–`f`) expect an already opened c
158
167
  - **Bounded output.** Long command output is truncated head + tail, and per-stream capture is capped.
159
168
  - **Structure + tests.** `src/config.ts` (env/flags), `src/core/*` (process runner, SQL, path resolution),
160
169
  `src/tools/*` (tool groups), `src/capabilities.ts`, `src/server.ts`, `src/cli.ts`, `src/index.ts`.
161
- `pnpm smoke` drives the real stdio interface for every capability letter and combination.
170
+ `pnpm smoke` drives the real stdio interface for every capability initial and combination.
162
171
 
163
172
  ## Development
164
173
 
165
174
  ```bash
166
175
  pnpm build # compile src -> dist
167
176
  pnpm typecheck # tsc --noEmit (tsconfig.build.json)
168
- pnpm smoke # end-to-end stdio test (each letter, combinations, env selection, bad input)
177
+ pnpm smoke # end-to-end stdio test (each initial, combinations, env selection, bad input)
169
178
  pnpm test # typecheck + build + smoke
170
- pnpm pack # build the publishable tarball
179
+ pnpm pack # prepack -> clean build, then produce the tarball
171
180
  ```
181
+
182
+ `dist` contains **only `.js` files**: `tsconfig.build.json` disables both `sourceMap` and `declaration`, so
183
+ no `.js.map` or `.d.ts` is produced, and `prebuild` / `prepack` recreate `dist` from scratch. The tarball is
184
+ `dist` plus `README.md` and `LICENSE`. Project-level `.npmrc` (registry token) is gitignored.
185
+
186
+ ## License
187
+
188
+ BSD 3-Clause — see [LICENSE](./LICENSE). Copyright (c) 2026 ri-fumo.
@@ -6,18 +6,17 @@ import { registerVersionControlTools } from './tools/version-control.js';
6
6
  import { registerWikiTools } from './tools/wiki.js';
7
7
  /**
8
8
  * Every capability the package can expose, in display order.
9
- * One consecutive single letter per group.
9
+ * Each id is the initial of its capability: a=Admin, v=VCS, f=Forum,
10
+ * t=Tickets, w=Wiki, c=Chat.
10
11
  */
11
- export const CAPABILITY_IDS = ['a', 'b', 'c', 'd', 'e', 'f'];
12
+ export const CAPABILITY_IDS = ['a', 'v', 'f', 't', 'w', 'c'];
12
13
  /**
13
- * The capability groups, one letter each:
14
+ * The capability groups, keyed by the initial of the capability name:
14
15
  *
15
- * a = Admin (repository lifecycle) b = VCS (version control)
16
- * c = Forum d = Tickets
17
- * e = Wiki f = Chat
16
+ * a = Admin v = VCS f = Forum t = Tickets w = Wiki c = Chat
18
17
  *
19
- * `--capability b` exposes only the version-control tools, `--capability adf` is
20
- * a three-group server, and so on.
18
+ * `--capability v` exposes only the version-control tools, `--capability avf`
19
+ * is a three-group server, and so on.
21
20
  */
22
21
  export const CAPABILITIES = {
23
22
  a: {
@@ -27,36 +26,36 @@ export const CAPABILITIES = {
27
26
  toolCount: 5,
28
27
  register: registerAdminTools,
29
28
  },
30
- b: {
31
- id: 'b',
29
+ v: {
30
+ id: 'v',
32
31
  title: 'VCS',
33
32
  description: 'All version-control commands',
34
33
  toolCount: 20,
35
34
  register: registerVersionControlTools,
36
35
  },
37
- c: {
38
- id: 'c',
36
+ f: {
37
+ id: 'f',
39
38
  title: 'Forum',
40
39
  description: 'Read-only forum threads, posts and full-text search',
41
40
  toolCount: 3,
42
41
  register: registerForumTools,
43
42
  },
44
- d: {
45
- id: 'd',
43
+ t: {
44
+ id: 't',
46
45
  title: 'Tickets',
47
46
  description: 'Ticket reports, creation and field updates',
48
47
  toolCount: 3,
49
48
  register: registerTicketTools,
50
49
  },
51
- e: {
52
- id: 'e',
50
+ w: {
51
+ id: 'w',
53
52
  title: 'Wiki',
54
53
  description: 'List, export and create/replace wiki pages',
55
54
  toolCount: 3,
56
55
  register: registerWikiTools,
57
56
  },
58
- f: {
59
- id: 'f',
57
+ c: {
58
+ id: 'c',
60
59
  title: 'Chat',
61
60
  description: 'Chatroom URL, sending messages, pulling and reading chat history',
62
61
  toolCount: 4,
@@ -74,4 +73,3 @@ export function allCapabilities() {
74
73
  export function toolCountOf(ids) {
75
74
  return ids.reduce((total, id) => total + CAPABILITIES[id].toolCount, 0);
76
75
  }
77
- //# sourceMappingURL=capabilities.js.map
package/dist/cli.js CHANGED
@@ -7,37 +7,39 @@ const CWD_FLAGS = new Set(['--repository', '--workspace', '--cwd', '-R']);
7
7
  /** Thrown for invalid command lines; callers print the message plus the help. */
8
8
  export class UsageError extends Error {
9
9
  }
10
+ /**
11
+ * Adds one `--capability` value.
12
+ *
13
+ * `A` (capital) selects every capability. Otherwise the value is a run of
14
+ * lowercase initials written together (`avf`, `twc`); separators are rejected.
15
+ */
10
16
  function addCapabilities(spec, selected) {
11
- for (const token of spec.split(/[,\s]+/).map((part) => part.trim().toLowerCase())) {
12
- if (!token)
13
- continue;
14
- if (token === 'all' || token === '*') {
15
- for (const id of allCapabilities())
16
- selected.add(id);
17
- continue;
18
- }
19
- if (!isCapabilityId(token)) {
20
- // Accept concatenated letters ('abf') as well as comma/space separated lists.
21
- const letters = [...token];
22
- const unknown = letters.filter((letter) => !isCapabilityId(letter));
23
- if (unknown.length > 0) {
24
- throw new UsageError(`unknown capability '${unknown[0]}'${token.length > 1 ? ` in '${token}'` : ''}. ` +
25
- `Valid letters: ${CAPABILITY_IDS.map((id) => `${id}=${CAPABILITIES[id].title}`).join(', ')} (or 'all').`);
26
- }
27
- for (const letter of letters) {
28
- if (isCapabilityId(letter))
29
- selected.add(letter);
30
- }
31
- continue;
32
- }
33
- selected.add(token);
17
+ const value = spec.trim();
18
+ if (!value)
19
+ return;
20
+ if (value === 'A') {
21
+ for (const id of allCapabilities())
22
+ selected.add(id);
23
+ return;
24
+ }
25
+ const unknown = [...value].filter((letter) => !isCapabilityId(letter));
26
+ if (unknown.length > 0) {
27
+ const hint = value.toLowerCase() === 'all'
28
+ ? "Use capital 'A' for every capability."
29
+ : "Use the letters together, e.g. 'avf'.";
30
+ throw new UsageError(`unknown capability '${unknown[0]}'${value.length > 1 ? ` in '${value}'` : ''}. ${hint} ` +
31
+ `Valid letters: ${CAPABILITY_IDS.map((id) => `${id}=${CAPABILITIES[id].title}`).join(', ')}, or A for all.`);
32
+ }
33
+ for (const letter of value) {
34
+ if (isCapabilityId(letter))
35
+ selected.add(letter);
34
36
  }
35
37
  }
36
38
  /**
37
39
  * Parses the command line.
38
40
  *
39
- * `--capability` takes capability letters (one per group) and accepts `abf`,
40
- * `a,b`, `a b`, repeated flags or `all`; when it is absent the list comes from
41
+ * `--capability` takes capability initials written together (`avf`, `twc`) or a
42
+ * single capital `A` for everything; when it is absent the list comes from
41
43
  * `FOSSIL_CAPABILITIES` (or every capability).
42
44
  * `--repository DIR` is consumed here so it can never reach the MCP transport.
43
45
  */
@@ -74,16 +76,20 @@ export function parseArgs(argv, env = process.env) {
74
76
  cwd = value;
75
77
  }
76
78
  else {
79
+ // Exactly one value: all letters belong together, e.g. -c avf.
80
+ if (explicitCapabilities) {
81
+ throw new UsageError('give all capability letters in a single value, e.g. -c avf.');
82
+ }
77
83
  explicitCapabilities = true;
78
84
  addCapabilities(value, selected);
79
85
  }
80
86
  }
81
87
  if (!explicitCapabilities) {
82
- addCapabilities(env.FOSSIL_CAPABILITIES?.trim() || 'all', selected);
88
+ addCapabilities(env.FOSSIL_CAPABILITIES?.trim() || 'A', selected);
83
89
  }
84
90
  const capabilities = [...selected];
85
91
  if (capabilities.length === 0) {
86
- throw new UsageError("no capability selected; use --capability (e.g. 'ab') or FOSSIL_CAPABILITIES, or 'all'.");
92
+ throw new UsageError("no capability selected; use --capability (e.g. 'avf') or FOSSIL_CAPABILITIES, or 'A'.");
87
93
  }
88
94
  return { cwd, capabilities, verbose, help };
89
95
  }
@@ -98,9 +104,10 @@ export function helpText() {
98
104
  `Usage: ${SERVER_NAME} [--capability LETTERS] [--repository DIR] [--verbose]`,
99
105
  '',
100
106
  'Options:',
101
- ' -c, --capability LIST Capability letters to enable: a b c d e f (one per group).',
102
- " Accepts 'ab', 'a,b', 'a b', repeated -c flags, or 'all'.",
103
- ' Default: FOSSIL_CAPABILITIES, or all capabilities when unset.',
107
+ ' -c, --capability LIST Capability initials written together in one value:',
108
+ ' a(Admin) v(VCS) f(Forum) t(Tickets) w(Wiki) c(Chat),',
109
+ ' e.g. "-c avf". A capital A selects everything.',
110
+ ' Default: FOSSIL_CAPABILITIES, else every capability.',
104
111
  ' Each selected group is served as its own MCP server instance.',
105
112
  ' --repository DIR Default workspace for every tool call',
106
113
  ' (aliases: --workspace, --cwd, -R)',
@@ -111,9 +118,10 @@ export function helpText() {
111
118
  ...rows,
112
119
  '',
113
120
  'Examples:',
114
- ` ${SERVER_NAME} -c b # version control only (20 tools)`,
115
- ` ${SERVER_NAME} -c ab # admin + VCS (25 tools)`,
116
- ` ${SERVER_NAME} -c cdf # forum + tickets + chat (10 tools)`,
121
+ ` ${SERVER_NAME} -c v # version control only (20 tools)`,
122
+ ` ${SERVER_NAME} -c avf # admin + VCS + forum (28 tools)`,
123
+ ` ${SERVER_NAME} -c aftw # admin + forum + tickets + wiki (14 tools)`,
124
+ ` ${SERVER_NAME} -c A # everything (38 tools)`,
117
125
  '',
118
126
  'Environment: FOSSIL_CAPABILITIES, FOSSIL_WORKSPACE, FOSSIL_CWD, FOSSIL_BIN,',
119
127
  ' FOSSIL_TIMEOUT_MS, FOSSIL_NETWORK_TIMEOUT_MS, FOSSIL_MAX_OUTPUT_CHARS,',
@@ -157,4 +165,3 @@ export function run(options = {}) {
157
165
  process.once('SIGINT', () => shutdown('SIGINT'));
158
166
  process.once('SIGTERM', () => shutdown('SIGTERM'));
159
167
  }
160
- //# sourceMappingURL=cli.js.map
package/dist/config.js CHANGED
@@ -9,14 +9,7 @@ function readPositiveInt(name, fallback) {
9
9
  }
10
10
  /** Server/product name. The fossil *binary* stays `fossil` (see FOSSIL_BIN). */
11
11
  export const SERVER_NAME = 'fossil-scm';
12
- export const SERVER_VERSION = '0.1.0';
13
- export const SERVER_INSTRUCTIONS = [
14
- 'MCP server exposing 31 tools for complete Fossil SCM automation and integration',
15
- '(repositories, check-outs, version control, tickets and wiki).',
16
- 'Every tool accepts an optional `cwd` pointing at the check-out or workspace directory;',
17
- 'when omitted the server default is used (set with --repository, FOSSIL_WORKSPACE or FOSSIL_CWD).',
18
- 'Repository database files are auto-resolved to the sibling ".<repos dir>" folder when no explicit db_name is given.',
19
- ].join(' ');
12
+ export const SERVER_VERSION = '0.1.2';
20
13
  /**
21
14
  * The Fossil executable. The command is named `fossil`; only the server/product
22
15
  * name is written `fossil-scm`. Override with FOSSIL_BIN (e.g. a full path on Windows).
@@ -58,4 +51,3 @@ export function setDefaultCwd(dir) {
58
51
  export function getDefaultCwd() {
59
52
  return defaultCwd;
60
53
  }
61
- //# sourceMappingURL=config.js.map
@@ -8,7 +8,7 @@ const PARTIAL_OUTPUT_CHARS = 4_000;
8
8
  * Quotes a string so it survives copy/paste into a POSIX or Windows shell.
9
9
  * Only used for error messages, never for building the argument vector.
10
10
  */
11
- export function quoteArg(arg) {
11
+ function quoteArg(arg) {
12
12
  if (arg === '' || /[\s"'`$\\<>|&;()*?[\]{}#!]/.test(arg)) {
13
13
  return `"${arg.replace(/(["\\$`])/g, '\\$1')}"`;
14
14
  }
@@ -177,7 +177,7 @@ export function formatFailure(outcome) {
177
177
  return { content: [{ type: 'text', text: truncateOutput(text) }], isError: true };
178
178
  }
179
179
  /** Renders a successful outcome as a text result. */
180
- export function formatSuccess(outcome, options = {}) {
180
+ function formatSuccess(outcome, options = {}) {
181
181
  const body = outcome.stdout.trim() || options.emptyText || '(no output)';
182
182
  const text = options.note ? `${body}\n\n${options.note}` : body;
183
183
  return { content: [{ type: 'text', text: truncateOutput(text) }] };
@@ -230,7 +230,7 @@ export async function resolveRepoPaths(dbName, cwd) {
230
230
  return { workspaceDir, repoDbPath: path.join(reposDir, fileName), projectName };
231
231
  }
232
232
  /** Builds the SQL that applies every {@link AUTO_SETTINGS} entry in one statement batch. */
233
- export function buildAutoSettingsSql() {
233
+ function buildAutoSettingsSql() {
234
234
  return AUTO_SETTINGS.map(([name, value]) => `REPLACE INTO config(name,value) VALUES('${escapeSqlLiteral(name)}','${escapeSqlLiteral(value)}');`).join(' ');
235
235
  }
236
236
  /**
@@ -239,16 +239,16 @@ export function buildAutoSettingsSql() {
239
239
  * A single fossil invocation replaces the four sequential ones used before,
240
240
  * which removes three process spawns from every init/open.
241
241
  *
242
- * @param dbName repository database; omitted when running inside a check-out.
242
+ * @param options.dbPath repository database; omitted when running inside a check-out.
243
+ * @param options.cwd directory the command runs in.
243
244
  */
244
- export async function applyAutoSettings(dbName, cwd) {
245
+ export async function applyAutoSettings(options = {}) {
245
246
  const args = ['sql'];
246
- if (dbName)
247
- args.push('-R', dbName);
247
+ if (options.dbPath)
248
+ args.push('-R', options.dbPath);
248
249
  args.push(buildAutoSettingsSql());
249
- const outcome = await runFossil(args, { cwd });
250
+ const outcome = await runFossil(args, { cwd: options.cwd });
250
251
  if (outcome.ok)
251
252
  return [];
252
253
  return [`Failed to apply automatic settings: ${formatFailure(outcome).content[0].text}`];
253
254
  }
254
- //# sourceMappingURL=fossil.js.map
package/dist/core/sql.js CHANGED
@@ -55,4 +55,3 @@ export function asString(value, fallback = '') {
55
55
  return String(value);
56
56
  return fallback;
57
57
  }
58
- //# sourceMappingURL=sql.js.map
package/dist/index.js CHANGED
@@ -1,13 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Single entry point. `--capability` is the list of capabilities to expose:
3
+ * Single entry point. `-c` takes the capability initials written together:
4
4
  *
5
- * fossil-scm --capability code # only the VCS/repo tools (25)
6
- * fossil-scm -c tickets,wiki # two groups in one server (6)
7
- * fossil-scm -c forum -c chat # repeat the flag as needed (7)
8
- * fossil-scm --capability all # everything (38)
9
- * fossil-scm # defaults to FOSSIL_CAPABILITIES, else all
5
+ * fossil-scm -c a # admin only (5) fossil-scm -c v # VCS only (20)
6
+ * fossil-scm -c avf # admin + VCS + forum (28) fossil-scm -c w # wiki only (3)
7
+ * fossil-scm -c A # everything (38)
8
+ * fossil-scm # FOSSIL_CAPABILITIES, else everything
10
9
  */
11
10
  import { run } from './cli.js';
12
11
  run();
13
- //# sourceMappingURL=index.js.map
package/dist/server.js CHANGED
@@ -10,7 +10,7 @@ function serverIdentity(ids) {
10
10
  }
11
11
  function buildInstructions(ids) {
12
12
  const lines = [
13
- `MCP server exposing ${toolCountOf(ids)} Fossil SCM tools${ids.length === 1 ? '' : ' across five capability groups'}.`,
13
+ `MCP server exposing ${toolCountOf(ids)} Fossil SCM tools from ${ids.length} enabled capability ${ids.length === 1 ? 'group' : 'groups'}.`,
14
14
  'Enabled capabilities:',
15
15
  ...ids.map((id) => `- ${CAPABILITIES[id].title}: ${CAPABILITIES[id].description}`),
16
16
  'Every tool accepts an optional `cwd` pointing at the check-out or workspace directory;',
@@ -38,4 +38,3 @@ export function createServer(options = {}) {
38
38
  CAPABILITIES[id].register(server);
39
39
  return server;
40
40
  }
41
- //# sourceMappingURL=server.js.map
@@ -2,8 +2,8 @@ import { mkdir, writeFile } from 'node:fs/promises';
2
2
  import path from 'node:path';
3
3
  import { z } from 'zod';
4
4
  import { EDITORCONFIG_CONTENT, NETWORK_TIMEOUT_MS } from '../config.js';
5
- import { applyAutoSettings, combineText, formatFailure, renderOutcome, resolveRepoPaths, runFossil, } from '../core/fossil.js';
6
- import { clean, cwdParam, flag } from './common.js';
5
+ import { applyAutoSettings, combineText, formatFailure, renderOutcome, resolveRepoPaths, resolveWorkspace, runFossil, } from '../core/fossil.js';
6
+ import { clean, cwdParam, flag, pushOption } from './common.js';
7
7
  const dbNameParam = z
8
8
  .string()
9
9
  .min(1)
@@ -53,7 +53,7 @@ export function registerAdminTools(server) {
53
53
  const init = await runFossil(['init', repoDbPath, '--project-name', finalProjectName], { cwd: workspaceDir });
54
54
  if (!init.ok)
55
55
  return formatFailure(init);
56
- const warnings = await applyAutoSettings(repoDbPath, workspaceDir);
56
+ const warnings = await applyAutoSettings({ dbPath: repoDbPath, cwd: workspaceDir });
57
57
  return withWarnings(renderOutcome(init, {
58
58
  note: `Repository created at '${repoDbPath}' (project '${finalProjectName}') and auto-configured with ` +
59
59
  "standard settings (crlf-glob='*', dotfiles=1, ignore-glob, binary-glob).",
@@ -88,7 +88,7 @@ export function registerAdminTools(server) {
88
88
  const opened = await runFossil(args, { cwd: workspaceDir });
89
89
  if (!opened.ok)
90
90
  return formatFailure(opened);
91
- const warnings = await applyAutoSettings(undefined, checkoutDir);
91
+ const warnings = await applyAutoSettings({ cwd: checkoutDir });
92
92
  const editorconfig = await ensureEditorConfig(checkoutDir);
93
93
  return withWarnings(renderOutcome(opened, {
94
94
  note: combineText([
@@ -128,12 +128,11 @@ export function registerAdminTools(server) {
128
128
  cwd: cwdParam,
129
129
  }),
130
130
  }, async ({ repository_uri, target_file, http_proxy, cwd }) => {
131
- const { workspaceDir } = await resolveRepoPaths(undefined, cwd);
131
+ const workspaceDir = resolveWorkspace(cwd);
132
132
  const targetFile = path.resolve(workspaceDir, target_file);
133
133
  await mkdir(path.dirname(targetFile), { recursive: true });
134
134
  const args = ['clone', repository_uri, targetFile];
135
- if (clean(http_proxy))
136
- args.push('--proxy', http_proxy.trim());
135
+ pushOption(args, '--proxy', http_proxy);
137
136
  const outcome = await runFossil(args, { cwd: workspaceDir, timeoutMs: NETWORK_TIMEOUT_MS });
138
137
  return renderOutcome(outcome, { note: `Repository cloned to '${targetFile}'.` });
139
138
  });
@@ -149,12 +148,12 @@ export function registerAdminTools(server) {
149
148
  annotations: { idempotentHint: true },
150
149
  }, async ({ name, value, cwd }) => {
151
150
  const args = ['settings'];
152
- if (clean(name)) {
153
- args.push(name.trim());
151
+ const settingName = clean(name);
152
+ if (settingName) {
153
+ args.push(settingName);
154
154
  if (value !== undefined)
155
155
  args.push(value);
156
156
  }
157
157
  return renderOutcome(await runFossil(args, { cwd }));
158
158
  });
159
159
  }
160
- //# sourceMappingURL=admin.js.map