feat: Add index-level access control with pattern-based filtering #111
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
Implements index-level access control to restrict which OpenSearch indexes can be accessed through the MCP server. This
provides an additional security layer on top of OpenSearch's built-in permissions, allowing administrators to enforce access
policies at the MCP server level.
Motivation
Users need the ability to limit MCP server access to specific OpenSearch indexes without modifying underlying OpenSearch
security settings. This is particularly important for:
Changes
Core Implementation
src/tools/index_filter.py- Pattern-based index filtering with support for:logs-*,test-?-index)regex:^logs-\d{4}-\d{2}$)Integration
stdio_server.pyandstreaming_server.pyvalidate_index_access()calls to all tools with index parameters:list_indices_tool,get_index_mapping_tool,search_index_toolget_shards_tool,get_cluster_state_tool,get_segments_toolget_index_info_tool,get_index_stats_toollist_indiceswithout index parameter now uses allowed patterns to filter results via OpenSearch APIConfiguration
export OPENSEARCH_ALLOWED_INDEX_PATTERNS='["logs-", "metrics-"]'
export OPENSEARCH_DENIED_INDEX_PATTERNS='["sensitive-*"]'