Skip to content

Commit 37cc371

Browse files
authored
Merge pull request #6 from asklar/user/asklar/user_config
Add the ability to pass user_config to discovery
2 parents a1049f8 + ae84963 commit 37cc371

9 files changed

Lines changed: 2392 additions & 877 deletions

File tree

CLI.md

Lines changed: 2 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Options:
1919
2020
Commands:
2121
init [directory] Create a new MCPB extension manifest
22-
validate [manifest] Validate a MCPB manifest file
22+
validate <manifest> Validate a MCPB manifest file
2323
pack <directory> [output] Pack a directory into a MCPB extension
2424
sign [options] <mcpb-file> Sign a MCPB extension file
2525
verify <mcpb-file> Verify the signature of a MCPB extension file
@@ -58,7 +58,7 @@ The command will prompt you for:
5858

5959
After creating the manifest, it provides helpful next steps based on your server type.
6060

61-
### `mcpb validate [path]`
61+
### `mcpb validate <path>`
6262

6363
Validates a MCPB manifest file against the schema. You can provide either a direct path to a manifest.json file or a directory containing one.
6464

@@ -69,28 +69,8 @@ mcpb validate manifest.json
6969
# Validate manifest in directory
7070
mcpb validate ./my-extension
7171
mcpb validate .
72-
73-
# Validate using --dirname without specifying manifest.json explicitly
74-
mcpb validate --dirname ./my-extension
7572
```
7673

77-
#### Additional validation with `--dirname`
78-
79-
Passing `--dirname <directory>` performs deeper checks that require access to the extension's source files:
80-
81-
- Verifies referenced assets exist relative to the directory (`icon`, each `screenshots` entry, `server.entry_point`, and path-like `server.mcp_config.command`).
82-
- Launches the server (honoring `${__dirname}` tokens) and discovers tools & prompts using the same logic as `mcpb pack`.
83-
- Compares discovered capability names against the manifest and fails if they differ.
84-
85-
When `--dirname` is supplied without an explicit manifest argument, the CLI automatically resolves `<directory>/manifest.json`. Use `--update` alongside `--dirname` to rewrite the manifest in-place with the discovered tool/prompt lists (including `tools_generated` / `prompts_generated` flags). When rewriting, the CLI also copies over tool descriptions and prompt metadata (descriptions, declared arguments, and prompt text) returned by the server. Without `--update`, any mismatch causes the command to fail.
86-
87-
The discovery step respects the same environment overrides as `mcpb pack`:
88-
89-
- `MCPB_TOOL_DISCOVERY_JSON`
90-
- `MCPB_PROMPT_DISCOVERY_JSON`
91-
92-
These allow deterministic testing without launching the server.
93-
9474
### `mcpb pack <directory> [output]`
9575

9676
Packs a directory into a MCPB extension file.
@@ -109,52 +89,6 @@ The command automatically:
10989
- Excludes common development files (.git, node_modules/.cache, .DS_Store, etc.)
11090
- Creates a compressed .mcpb file (ZIP with maximum compression)
11191

112-
#### Capability Discovery (Tools & Prompts)
113-
114-
During packing, the CLI launches your server (based on `server.mcp_config.command` + `args`) and uses the official C# MCP client to request both tool and prompt listings. It compares the discovered tool names (`tools` array) and prompt names (`prompts` array) with those declared in `manifest.json`.
115-
116-
If they differ:
117-
118-
- Default: packing fails with an error explaining the mismatch.
119-
- `--force`: continue packing despite any mismatch (does not modify the manifest).
120-
- `--update`: overwrite the `tools` and/or `prompts` list in `manifest.json` with the discovered sets (also sets `tools_generated: true` and/or `prompts_generated: true`) and persists the discovered descriptions plus prompt arguments/text when available.
121-
- `--no-discover`: skip dynamic discovery entirely (useful offline or when the server cannot be executed locally).
122-
123-
Environment overrides for tests/CI:
124-
125-
- `MCPB_TOOL_DISCOVERY_JSON` JSON array of tool names.
126-
- `MCPB_PROMPT_DISCOVERY_JSON` JSON array of prompt names.
127-
If either is set, the server process is not launched for that capability.
128-
129-
#### Referenced File Validation
130-
131-
Before launching the server or writing the archive, `mcpb pack` now validates that certain files referenced in `manifest.json` actually exist relative to the extension directory:
132-
133-
- `icon` (if specified)
134-
- `server.entry_point`
135-
- Path-like `server.mcp_config.command` values (those containing `/`, `\\`, `${__dirname}`, starting with `./` or `..`, or ending in common script/binary extensions such as `.js`, `.py`, `.exe`)
136-
- Each file in `screenshots` (if specified)
137-
138-
If any of these files are missing, packing fails immediately with an error like `Missing icon file: icon.png`. This happens before dynamic capability discovery so you get fast feedback on manifest inaccuracies.
139-
140-
Commands (e.g. `node`, `python`) that are not path-like are not validated—they are treated as executables resolved by the environment.
141-
142-
Examples:
143-
144-
```bash
145-
## Fail if mismatch
146-
mcpb pack .
147-
148-
# Force success even if mismatch
149-
mcpb pack . --force
150-
151-
## Update manifest.json to discovered tools/prompts
152-
mcpb pack . --update
153-
154-
# Skip discovery (behaves like legacy pack)
155-
mcpb pack . --no-discover
156-
```
157-
15892
### `mcpb sign <mcpb-file>`
15993

16094
Signs a MCPB extension file with a certificate.

0 commit comments

Comments
 (0)