# MCP server for your workspace

> Connect Claude Desktop, Cursor or ChatGPT to your AskVault agent over MCP, so they can search your knowledge and ask your agent questions as tools.

Every workspace can act as a Model Context Protocol (MCP) server. An AI tool such as Claude Desktop or Cursor connects with one config block and gets two tools: one searches your knowledge, the other asks your agent.

## Before you start

- MCP signs in with one of your workspace API keys, so it needs a plan with API access. See [API keys](/developers/api-keys/).
- The workspace owner switches MCP on. It is off by default.
- Each `ask_agent` call uses message credits like any other answer. `search_knowledge` does not.

## Turn it on

#### New dashboard

1. Open **Channels & Apps**, then the **Developers** tab.
2. Switch on **Let AI assistants use your agent**.
3. Create or copy an API key from **API keys** on the same tab.

#### Previous dashboard

1. Open **Settings** › **Agent Surfaces**.
2. Switch on **MCP server**.
3. Create an API key under **Channels** › **REST API** if you do not have one. See [API keys](/developers/api-keys/).

Your server address is:

```
https://api.askvault.co/api/mcp/{workspace_id}/rpc
```

The dashboard shows it with a copy button once MCP is on.

## Connect a tool

Claude Desktop reads `claude_desktop_config.json`. Cursor reads `~/.cursor/mcp.json`. Both take the same shape:

```json
{
  "mcpServers": {
    "askvault-acme-docs": {
      "url": "https://api.askvault.co/api/mcp/YOUR_WORKSPACE_ID/rpc",
      "headers": {
        "Authorization": "Bearer ak_xxx"
      }
    }
  }
}
```

In Claude Desktop, also add `"transport": "http"` beside `url`. Restart the app and the tools appear.

## The two tools

**`search_knowledge`** searches your indexed website pages, files, saved answers and connected apps.

- `query` (required): a natural-language search.
- `top_k` (optional): how many passages to return, default 5, up to 20.
- It returns text blocks, each prefixed with the source name and a relevance score. Use it when the tool wants raw passages to reason over. It writes no answer, so it uses no message credits, though it still counts against the key's rate limits.

**`ask_agent`** sends a question to your full agent, the one that answers your chat widget, and returns a finished answer with its sources.

- `question` (required).
- `conversation_id` (optional): keeps context across calls.
- Each call uses message credits from your plan, the same as a widget answer.

## For custom clients

The endpoint speaks JSON-RPC 2.0 over HTTP, one request per POST, with the `Authorization: Bearer` header. It supports `initialize`, `tools/list`, `tools/call` and `ping`.

```json
{"jsonrpc": "2.0", "id": 3, "method": "tools/call",
 "params": {"name": "search_knowledge", "arguments": {"query": "WhatsApp setup", "top_k": 5}}}
```

It exposes tools only. It does not stream, and it offers no resources or prompts.

## Access rules

- The key must belong to the workspace in the URL, otherwise the request returns 401. A revoked key returns 401 too.
- If MCP is switched off for the workspace, the endpoint returns 404.
- Any active key for the workspace can call both tools. Keys cannot be limited to one tool.
- The same per-key rate limits apply as for the REST API. See [API errors and rate limits](/developers/errors-and-limits/).

## A public address for AI agents (NLWeb)

Separately, you can let AI agents that speak the NLWeb protocol query your knowledge without an API key. This is public by design, so switch it on only if you want that.

- **New dashboard:** **Channels & Apps** › **Developers** › **Let any AI assistant ask your agent**. Switch MCP on first.
- **Previous dashboard:** **Settings** › **Agent Surfaces** › **NLWeb + A2UI endpoint**.

Agents then send `POST https://api.askvault.co/api/nlweb/{workspace_id}/ask` with a `query` of up to 2,000 characters, and get an answer with source citations. Add `<link rel="nlweb" href="...">` to your site so agents can find the address. Answers count against your plan's message credits.

## Check it worked

In your AI tool, ask it to use the AskVault `search_knowledge` tool for a topic from your site. It should return passages from your pages.

## If it doesn't work

**401.** The key is wrong, revoked or from a different workspace.

**404 saying MCP is not enabled.** Switch it on as shown above.

**The tools do not appear.** Restart the app, and check the JSON is valid and the URL has your real workspace id.

## Related

- [API keys](/developers/api-keys/)
- [AskVault API: get started](/developers/)
- [Test your agent in the dashboard](/agent/test-chat/)

Source: https://docs.askvault.co/developers/mcp-server/
