Skip to content

Commit 73096b1

Browse files
committed
fix: honor --discovery flag without --index
Add new branch to handle --discovery flag when --index is not provided. Previously, the condition checked for both discoveryFlag AND indexSpecs, causing the flag to be ignored when used alone. Now: - discoveryFlag + indexSpecs: Discovery mode with remote + local indexes - discoveryFlag alone: Discovery mode with local indexes only - indexSpecs alone: Fixed mode with specified indexes - No flags: Original behavior (fail fast if no indexes) Applied fix to both stdioCommand and httpCommand handlers. Agent-Id: agent-3635d277-f9a4-486b-81e0-cabd00c2a4b2
1 parent 9c79c29 commit 73096b1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/bin/cmd-mcp.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ const stdioCommand = new Command("stdio")
3535
store = new ReadOnlyLayeredStore(localStore, remoteStore);
3636
indexNames = undefined; // Discovery mode: no fixed list
3737
discovery = true;
38+
} else if (discoveryFlag) {
39+
// Discovery mode with local indexes only
40+
store = new FilesystemStore();
41+
indexNames = undefined; // Discovery mode: no fixed list
42+
discovery = true;
3843
} else if (indexSpecs && indexSpecs.length > 0) {
3944
// Fixed mode: use read-only CompositeStoreReader
4045
const specs = parseIndexSpecs(indexSpecs);
@@ -103,6 +108,11 @@ const httpCommand = new Command("http")
103108
store = new ReadOnlyLayeredStore(localStore, remoteStore);
104109
indexNames = undefined; // Discovery mode: no fixed list
105110
discovery = true;
111+
} else if (discoveryFlag) {
112+
// Discovery mode with local indexes only
113+
store = new FilesystemStore();
114+
indexNames = undefined; // Discovery mode: no fixed list
115+
discovery = true;
106116
} else if (indexSpecs && indexSpecs.length > 0) {
107117
// Fixed mode: use read-only CompositeStoreReader
108118
const specs = parseIndexSpecs(indexSpecs);

0 commit comments

Comments
 (0)