Skip to main content
Glama
meilisearch

Meilisearch MCP Server

Official
by meilisearch

create-key

Generate API keys with specific permissions and expiration for managing Meilisearch indexes, ensuring controlled access and security.

Instructions

Create a new API key

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionsYes
descriptionNo
expiresAtNo
indexesYes

Implementation Reference

  • Executes the 'create-key' tool by calling KeyManager.create_key with parsed arguments and returns the result.
    elif name == "create-key":
        key = self.meili_client.keys.create_key(
            {
                "description": arguments.get("description"),
                "actions": arguments["actions"],
                "indexes": arguments["indexes"],
                "expiresAt": arguments.get("expiresAt"),
            }
        )
        return [
            types.TextContent(type="text", text=f"Created API key: {key}")
        ]
  • Registers the 'create-key' tool in the MCP server's list_tools handler, defining its name, description, and input schema.
    types.Tool(
        name="create-key",
        description="Create a new API key",
        inputSchema={
            "type": "object",
            "properties": {
                "description": {"type": "string"},
                "actions": {"type": "array", "items": {"type": "string"}},
                "indexes": {"type": "array", "items": {"type": "string"}},
                "expiresAt": {"type": "string"},
            },
            "required": ["actions", "indexes"],
            "additionalProperties": False,
        },
    ),
  • KeyManager helper method that wraps the Meilisearch client's create_key method to create a new API key.
    def create_key(self, options: Dict[str, Any]) -> Dict[str, Any]:
        """Create a new API key"""
        try:
            return self.client.create_key(options)
        except Exception as e:
            raise Exception(f"Failed to create key: {str(e)}")

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

Related Tools

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/meilisearch/meilisearch-mcp'

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