<!--
Sitemap:
- [Installation](/installation)
- [Upgrading](/upgrading): Version-specific steps for upgrading an existing Bento install.
- [Concepts](/concepts)
- [Build your first pipeline](/tutorials/pipeline-args)
- [Target a specific issue or PR from a URL](/tutorials/url-targeting)
- [Keep state across runs](/tutorials/pipeline-state)
- [Fire a pipeline on a schedule or on demand](/tutorials/schedule-and-fire)
- [Deploy a box to Railway](/tutorials/deploy-to-railway)
- [Operate a hosted daemon](/tutorials/operate-a-hosted-daemon)
- [Configuration](/configuration)
- [Members](/members)
- [Knowledge base](/knowledge-base/)
- [Method and delivery](/knowledge-base/modes)
- [Config](/knowledge-base/config)
- [MCP](/knowledge-base/mcp)
- [Pipeline configuration reference](/pipelines/config)
- [Filters](/pipelines/filters)
- [Triggers](/triggers/)
- [GitHub trigger](/triggers/github)
- [Linear trigger](/triggers/linear)
- [Webhook trigger](/triggers/webhook)
- [Schedule trigger](/triggers/schedule)
- [Manual trigger](/triggers/manual)
- [Traces](/pipelines/traces)
- [Slack](/integrations/slack)
- [Public access](/public-access)
- [Context engineering](/context-engineering)
- [Best practices](/best-practices)
- [Troubleshooting](/troubleshooting)
- [Architecture](/architecture/vision)
- [Workspaces](/workspaces)
- [Authentication](/authentication)
- [Identity](/identity)
- [Security](/security)
- [References](/references)
- [Changelog](/changelog): Bento release history.
- [CLI reference](/cli/)
- [Setup](/cli/setup)
- [Secrets](/cli/secrets)
- [Lifecycle](/cli/lifecycle)
- [Sandbox image](/cli/image)
- [Sandboxes](/cli/sandbox)
- [Observability](/cli/observability)
- [Diagnostics](/cli/diagnostics)
- [Triggers](/cli/triggers)
- [Workbench](/cli/workbench)
- [Auth](/cli/auth)
- [Knowledge](/cli/knowledge)
- [Evals](/cli/evals)
- [Bento](/index)
- [Runtime wrapper](/architecture/runtime-wrapper)
- [Skill evolve](/architecture/skill-evolve)
-->

# MCP

The daemon exposes the knowledge base over MCP as a search tool (`ask_knowledge`) and as per-file resources.

## Tool: `ask_knowledge`

Agents call `ask_knowledge` mid-task to retrieve context on demand:

```json
{ "tool": "ask_knowledge", "query": "PR review standards" }
```

The tool returns `<context source="...">` sections, ordered by relevance score. The tool only registers when the selected retrieval engine is ready — if it is missing from the tool list, check `bento daemon logs` for `knowledge: index ready`.

| Parameter | Default | Meaning |
|---|---|---|
| `query` | — | What to search for. |
| `limit` | [`knowledge.retrieval.topK`](/knowledge-base/config) | Max results per source, 1 to 20. |
| `rerank` | [`knowledge.retrieval.rerank`](/knowledge-base/config) | Enable the optional reranking stage of the retrieval engine. |
| `method` | [`knowledge.retrieval.method`](/knowledge-base/config), else `hybrid` | Retrieval [method](/knowledge-base/modes): `bm25`, `vector`, or `hybrid`. |

Set `knowledge.retrieval.method` to move agent search off `hybrid` for the whole daemon. A `hybrid` search pays for a lexical pass and for a semantic pass, which is slow on a host with no GPU. A `bm25` search and a `vector` search each run one pass. This key is not `defaults.knowledge.method`, which selects daemon-side retrieval for a run, and which the daemon rejects next to `delivery: search`. A per-pipeline `knowledge:` block does not reach the tool.

## Resources

The daemon registers each markdown file in `wiki/`, `blueprints/`, and `recipes/` as an MCP resource at startup:

```
wiki://git-workflow
blueprint://feature-evaluation-rubric
recipe://add-agent
```

Any MCP client browses and reads these resources directly, without a call to `ask_knowledge`.

## Automatic injection

During the `retrieve` phase of a pipeline run with a retrieving [method](/knowledge-base/modes) (`bm25`/`vector`/`hybrid`), the daemon queries the index and injects matching chunks into the agent prompt.

Tune retrieval depth via [`knowledge.retrieval.topK`](/knowledge-base/config).
