Skip to content

Commit 9e65cc6

Browse files
committed
Improve error message when MCP server has no indexes
Clarify that the MCP server requires at least one index to operate and provide the command to create an index. Applied to both stdio and http subcommands.
1 parent e9907d8 commit 9e65cc6

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

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("Create an index first: context-connectors index <path>");
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("Create an index first: context-connectors index <path>");
92+
process.exit(1);
93+
}
8594
indexNames = undefined;
8695
}
8796

0 commit comments

Comments
 (0)