Add dynamic MCP tools: list_indexes, index_repo, delete_index#15
Draft
richhankins wants to merge 6 commits intomainfrom
Draft
Add dynamic MCP tools: list_indexes, index_repo, delete_index#15richhankins wants to merge 6 commits intomainfrom
richhankins wants to merge 6 commits intomainfrom
Conversation
- Remove readonly from indexNames and indexes fields - Remove empty-index checks at initialization (allow zero indexes) - Add refreshIndexList() method to reload indexes from store - Add invalidateClient() method to clear cached SearchClient - Update MCPServerConfig.store to accept both IndexStoreReader and IndexStore Agent-Id: agent-49436113-35bf-4532-983a-fb01da818555
- Add list_indexes tool to ListToolsRequestSchema handler - Add handler in CallToolRequestSchema that refreshes index list and returns formatted metadata (name, type, identifier, syncedAt) - Returns helpful message when no indexes exist - Add withListIndexesReference() helper in tool-descriptions.ts - Update MCP server to use withListIndexesReference instead of embedding static index list in tool descriptions - Keep withIndexList() for CLI agent backward compatibility Agent-Id: agent-b187383f-2e44-4592-9ec9-6f0f4e0eafb6
- Add delete_index tool definition (only when store supports delete) - Add handler to delete index from store, refresh runner state, and invalidate cached client - Validates index exists before attempting delete - Returns appropriate error messages for missing index or unsupported store Agent-Id: agent-8cf675a5-fcdf-402a-a3a1-f3fa2a8c3f1b
Agent-Id: agent-8cf675a5-fcdf-402a-a3a1-f3fa2a8c3f1b Linked-Note-Id: 18ee4796-4931-48c2-80e4-e85d51fe2ccd
This tool allows creating/updating indexes dynamically from: - GitHub repositories (requires owner and repo) - GitLab repositories (requires project_id) - BitBucket repositories (requires workspace and repo) - Websites (requires url) Features: - Validates required parameters for each source type - Checks if store supports write operations - Refreshes runner state after indexing - Invalidates cached client for updated indexes - Returns success message with stats (type, filesIndexed, duration) Agent-Id: agent-4dd9b0b4-3ecf-4a2a-850a-49fd55aba0b5
Remove the empty-index check from the CLI so the MCP server can start even when no indexes exist. This enables the dynamic indexing workflow where users can call list_indexes (empty) then index_repo to create indexes on-demand.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds dynamic index management capabilities to the MCP server, allowing agents to create, list, and delete indexes on-demand.
New MCP Tools
list_indexesindex_repodelete_indexKey Changes
1. Dynamic MultiIndexRunner (
src/search/multi-index-runner.ts)readonly)refreshIndexList()to reload indexes after creation/deletioninvalidateClient(indexName)to clear cached SearchClient after updates2. MCP Server (
src/mcp/mcp-server.ts)index_repo/delete_index, automatically refreshes runner state3. Tool Descriptions (
src/mcp/tool-descriptions.ts)withIndexesReference()that appends "Use list_indexes to see available indexes."4. CLI (
src/bin/cmd-mcp.ts)Architecture: Three-Layer Context Model
This feature enables the "exploration layer" in our context hierarchy:
Testing
Configuration Note
For dynamic indexing to work, the MCP server must be started without
-iflags:ctxc mcp stdio # Uses writable FilesystemStoreWith
-iflags, it usesCompositeStoreReader(read-only) andindex_repo/delete_indexwill fail.Commits
4981a79- Support dynamic index list in MultiIndexRunner427a1bc- Add list_indexes tool to MCP server2ea4cdf- Add index_repo tool to MCP server6447099- Add delete_index tool to MCP server35f06b1- Allow MCP server to start with zero indexesPull Request opened by Augment Code with guidance from the PR author