MCP Server
The Airweave MCP server implements the Model Context Protocol to let AI assistants search your synced data. It supports two deployment modes: local (stdio) for desktop AI clients and hosted (Streamable HTTP) for cloud platforms, with two authentication methods: API key and OAuth 2.0.
Prerequisites
Before you start you’ll need:
- A collection with data: at least one source connection must have completed its initial sync. See the Quickstart if you need to set this up.
- An API key (for API key auth): Create one in the Airweave dashboard under API Keys.
- No setup needed (for OAuth auth): The hosted MCP server handles OAuth 2.0 via Auth0 automatically — users authenticate through a browser redirect.
Local mode (Desktop AI clients)
Local mode runs the MCP server as a local process that communicates over stdio. This is the standard setup for desktop AI assistants.
Cursor
Claude Desktop
VS Code
Requirement: Cursor version 0.45.6 or later
- Open Cursor Settings
- Go to Features > MCP Servers
- Click ”+ Add new global MCP server”
- Add this configuration:
Environment variables (local mode)
Hosted mode (Cloud AI platforms)
Hosted mode runs the MCP server as a stateless HTTP service at https://mcp.airweave.ai/mcp. This is the setup for cloud-based AI platforms that need a remote MCP endpoint. The server uses the Streamable HTTP transport (MCP 2025-03-26).
Each request is fully independent: authentication and collection selection happen per-request via HTTP headers. No sessions or server-side state.
The hosted server supports two authentication methods: API key (simple, direct) and OAuth 2.0 (browser-based login). Both can be used at the same time.
Cursor (OAuth)
Cursor (API key)
OpenAI Agent Builder
Any HTTP MCP Client
Use mcp-remote to handle the OAuth flow automatically. On first connection, a browser window opens for login:
mcp-remote discovers the OAuth metadata at /.well-known/oauth-authorization-server, registers a client, and manages token refresh transparently.
Authentication (hosted mode)
The server supports two authentication methods. When both are present, X-API-Key takes priority.
API key authentication:
OAuth 2.0 authentication:
The hosted server supports OAuth 2.0 with PKCE via Auth0. MCP clients that support RFC 7591 Dynamic Client Registration (like mcp-remote) handle this automatically:
- The client discovers OAuth metadata at
/.well-known/oauth-authorization-server - The client registers itself at
/register(dynamic client registration) - The user is redirected to Auth0 for login via
/authorize - After login, Auth0 redirects back to
/oauth/callback - The client exchanges the authorization code for tokens at
/token - Subsequent requests use
Authorization: Bearer <access-token>
When a Bearer token is present and OAuth is enabled, the server verifies it as a JWT. If verification fails, it falls back to treating the token as an API key.
Collection selection (hosted mode)
Endpoints
Available tools
The MCP server exposes two tools to AI assistants:
search-{collection}
The primary search tool. The tool name includes the collection ID so the AI assistant knows which dataset it’s searching (e.g., search-my-docs).
Parameters:
The MCP server uses the legacy search parameter names for backwards compatibility. These are automatically mapped to the new API parameter names by the SDK. See the Search documentation for the mapping between legacy and new parameter names.
Natural language examples: the AI assistant will map these to the correct parameters automatically:
- “Find the first 5 results” →
limit: 5 - “Show me results 11-20” →
limit: 10, offset: 10 - “Give me a summary” →
response_type: "completion" - “Find the most recent documents” →
recency_bias: 0.8 - “Find high-quality results only” →
score_threshold: 0.8 - “Use keyword search” →
search_method: "keyword" - “Don’t expand my query” →
expansion_strategy: "no_expansion" - “Disable reranking” →
enable_reranking: false
get-config
Returns the current server configuration: collection ID, base URL, API key status, and available tools. No parameters.
Architecture
- Local mode: One MCP server process per user. API key and collection are set via environment variables. Communication over stdio.
- Hosted mode: Stateless HTTP server. A fresh MCP server instance is created for each request. Supports API key auth (via headers) and OAuth 2.0 (via Auth0).
In both modes, the MCP server is a thin wrapper around the Airweave SDK. It validates parameters, calls the search API, and formats results for the AI assistant.
Self-hosting
If you’re running Airweave on your own infrastructure, point the MCP server at your instance:
Local mode:
Hosted mode (Docker):
The hosted mode Docker image exposes port 8080 with a health check at /health. Self-hosted instances use API key authentication. OAuth is only available on the managed Airweave platform (mcp.airweave.ai).