Skip to main content
Glama
cr7258

Elasticsearch MCP Server

create_index

Create a new Elasticsearch index with custom mappings and settings to organize and store data for search and analysis.

Instructions

Create a new index. Args: index: Name of the index body: Optional index configuration including mappings and settings

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexYes
bodyNo

Implementation Reference

  • The MCP tool handler for 'create_index', decorated with @mcp.tool(). It creates a new index by calling the search client's create_index method.
    @mcp.tool() def create_index(index: str, body: Optional[Dict] = None) -> Dict: """ Create a new index. Args: index: Name of the index body: Optional index configuration including mappings and settings """ return self.search_client.create_index(index=index, body=body)
  • src/server.py:41-53 (registration)
    Top-level registration where IndexTools (containing create_index) is included in tool_classes and registered via ToolsRegister.
    register = ToolsRegister(self.logger, self.search_client, self.mcp) # Define all tool classes to register tool_classes = [ IndexTools, DocumentTools, ClusterTools, AliasTools, DataStreamTools, GeneralTools, ] # Register all tools register.register_all_tools(tool_classes)
  • Helper method in IndexClient that implements the low-level index creation delegated by the MCP tool handler.
    def create_index(self, index: str, body: Optional[Dict] = None) -> Dict: """Creates an index with optional settings and mappings.""" return self.client.indices.create(index=index, body=body)
  • IndexTools.register_tools method where the @mcp.tool() decorators register the create_index tool (and others) with the MCP instance.
    def register_tools(self, mcp: FastMCP): @mcp.tool()

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cr7258/elasticsearch-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server