Skip to content

Commit 46670d8

Browse files
authored
Merge pull request #6 from augmentcode/minor-fix
Improve error message when MCP server has no indexes
2 parents e9907d8 + 2b5728a commit 46670d8

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/bin/cmd-mcp.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ const stdioCommand = new Command("stdio")
3333
store = new FilesystemStore();
3434
indexNames = await store.list();
3535
if (indexNames.length === 0) {
36-
console.error("No indexes found. Create an index first with 'context-connectors index'");
36+
console.error("Error: No indexes found.");
37+
console.error("The MCP server requires at least one index to operate.");
38+
console.error("Run 'ctxc index --help' to see how to create an index.");
3739
process.exit(1);
3840
}
3941
}
@@ -82,6 +84,13 @@ const httpCommand = new Command("http")
8284
} else {
8385
// No --index: use default store, serve all
8486
store = new FilesystemStore();
87+
const availableIndexes = await store.list();
88+
if (availableIndexes.length === 0) {
89+
console.error("Error: No indexes found.");
90+
console.error("The MCP server requires at least one index to operate.");
91+
console.error("Run 'ctxc index --help' to see how to create an index.");
92+
process.exit(1);
93+
}
8594
indexNames = undefined;
8695
}
8796

0 commit comments

Comments
 (0)