---
title: AI Search MCP server
description: Use the AI Search MCP server on Databricks to query AI Search indexes from agents, and configure retrieval behavior with \_meta parameters.
canonical_url: https://docs.databricks.com/aws/en/agents/mcp-tools/ai-search
---

# AI Search MCP server

> [!NOTE]
> **Preview**
>
> This feature is in [Public Preview](https://docs.databricks.com/aws/en/release-notes/release-types.md).

The AI Search MCP server is a Databricks [workspace MCP endpoint](https://docs.databricks.com/aws/en/agents/mcp-tools/built-in-mcp-services.md#legacy-workspace-endpoints) that lets agents run semantic search over your [AI Search indexes](https://docs.databricks.com/aws/en/ai-search/ai-search.md) to find relevant documents, with results governed by Unity Catalog permissions. Querying an index requires Databricks managed embeddings.

> [!TIP]
> **Recommended approach**
>
> For new Python agents, use [AI Bridge retriever tools](https://docs.databricks.com/aws/en/agents/custom-agents/unstructured-retrieval-tools.md#ai-bridge) to query your AI Search indexes directly.

| URL pattern                                                                          | OAuth scope |
| ------------------------------------------------------------------------------------ | ----------- |
| `https://<workspace-hostname>/api/2.0/mcp/ai-search/{catalog}/{schema}/{index_name}` | `ai-search` |

> [!NOTE]
>
> AI Search was formerly Vector Search. The previous `/api/2.0/mcp/vector-search/` URL prefix and `vector-search` scope still work.

## AI Search `_meta` parameters

AI Search supports the following `_meta` parameters:

| Parameter name      | Type    | Description                                                                                                                                                                                                                                                                 |
| ------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `columns`           | `str`   | Comma-separated list of column names to return in the search results.<br />Example: `"id,text,metadata"`<br />If not specified, all columns (except internal columns starting with "\_\_") are returned.                                                                    |
| `columns_to_rerank` | `str`   | Comma-separated list of column names whose content the reranking model uses for re-scoring. The reranker uses this content to re-score all search results to improve relevance.<br />Example: `"text,title,description"`<br />If not specified, reranking is not performed. |
| `filters`           | `str`   | JSON string containing filters to apply to the search. Must be valid JSON.<br />Example: `'{"updated_after": "2024-01-01"}'`<br />If not specified, no filters are applied.                                                                                                 |
| `include_score`     | `bool`  | Whether to include the similarity score in the returned results.<br />Supported values: `"true"` or `"false"`<br />Default: `"false"`                                                                                                                                       |
| `num_results`       | `int`   | Number of results to return.<br />Example: `"5"`                                                                                                                                                                                                                            |
| `query_type`        | `str`   | Search algorithm to use for retrieving results.<br />Supported values: `"ANN"` (approximate nearest neighbor, default) or `"HYBRID"` (combines vector and keyword search)<br />Default: `"ANN"`                                                                             |
| `score_threshold`   | `float` | Minimum similarity score threshold for filtering results. Results with scores below this threshold are excluded.<br />Example: `"0.7"`<br />If not specified, no score filtering is applied.                                                                                |

For detailed information about these parameters, see the [AI Search Python SDK documentation](https://api-docs.databricks.com/python/vector-search/databricks.vector_search.html).

### Example: configure maximum results and filters for AI Search retrieval

This example shows how to use `_meta` parameters to configure AI Search behavior while allowing dynamic queries from your agent using the official [Python MCP SDK](https://modelcontextprotocol.io/specification/2025-11-25/basic#meta).

In this scenario, you want to:

* Always limit search results to exactly 3 items for consistent response times
* Only search recent documentation (updated after 2024-01-01) to verify relevance
* Use hybrid search for better accuracy than pure vector search
* Return only specific columns (id, text, and metadata)
* Include similarity scores in the results
* Exclude results with similarity scores below 0.5
* Use reranking on text and title columns to improve relevance

To run this example, [set up your Python environment for managed MCP development](https://docs.databricks.com/aws/en/agents/custom-agents/use-mcp-tools.md#set-up-your-environment):

```python
# Import required libraries for MCP client and Databricks authentication
import asyncio
from databricks.sdk import WorkspaceClient
from databricks_mcp.oauth_provider import DatabricksOAuthClientProvider
from mcp.client.streamable_http import streamablehttp_client
from mcp.client.session import ClientSession
from mcp.types import CallToolRequest, CallToolResult

async def run_vector_search_tool_call_with_meta():
    # Initialize Databricks workspace client for authentication
    workspace_client = WorkspaceClient()

    # Construct the MCP server URL for your specific catalog and schema
    # Replace <workspace-hostname>, YOUR_CATALOG, and YOUR_SCHEMA with your values
    mcp_server_url = "https://<workspace-hostname>/api/2.0/mcp/ai-search/YOUR_CATALOG/YOUR_SCHEMA"

    # Establish connection to the MCP server with OAuth authentication
    async with streamablehttp_client(
        url=mcp_server_url,
        auth=DatabricksOAuthClientProvider(workspace_client),
    ) as (read_stream, write_stream, _):

        # Create an MCP session for making tool calls
        async with ClientSession(read_stream, write_stream) as session:
            # Initialize the session before making requests
            await session.initialize()

            # Create the tool call request with both dynamic and preset parameters
            request = CallToolRequest(
                method="tools/call",
                params={
                    # Tool name follows the pattern: CATALOG__SCHEMA__INDEX_NAME
                    "name": "YOUR_CATALOG__YOUR_SCHEMA__YOUR_INDEX_NAME",

                    # Dynamic arguments - typically provided by your AI agent or user input
                    "arguments": {
                        "query": "How do I reset my password?"  # This comes from your agent
                    },

                    # Meta parameters - preset configuration to control search behavior
                    "_meta": {
                        "num_results": "3",  # Limit to 3 results for consistent performance
                        "filters": '{"updated_after": "2024-01-01"}',  # JSON string for date filtering
                        "query_type": "HYBRID",  # Use hybrid search for better relevance
                        "columns": "id,text,metadata",  # Return only specific columns
                        "score_threshold": "0.5",  # Filter out results with similarity score < 0.5
                        "include_score": "true",  # Include similarity scores in results
                        "columns_to_rerank": "text,title"  # Use reranker on these columns for better quality
                    }
                }
            )

            # Send the request and get the response
            response = await session.send_request(request, CallToolResult)
            return response

# Execute the async function and get results
response = asyncio.run(run_vector_search_tool_call_with_meta())
```
