---
title: "Work with knowledge bases"
url: "https://docs.mekodata.ai/guides/working-with-knowledge-bases/"
---

# Work with knowledge bases

Build, query, and manage knowledge bases in Meko

Knowledge bases let you load documents into your datapack and query them using semantic search (RAG). Meko handles chunking, embedding, and indexing automatically.

Use a knowledge-base file when agents should search inside a document.

How should I store it?

A datapack keeps memories, knowledge-base files, and artifacts. To learn which one to use, see [Where to store it](/guides/where-to-store/).

## Supported sources

Upload files from the Meko portal, from your agent, or with the [Datapack API](/reference/datapack-api/#upload-a-file). An owner or a maintainer can upload. A contributor or a viewer cannot.

From the portal:

1. Navigate to **Datapacks** and select your datapack.
2. Click **Upload Knowledge Files** (or **Add to Knowledge Base**).

Meko accepts PDF, TXT, TEXT, MD, CSV, JSON, XML, HTML, and HTM files, up to 10 per batch in the portal. The per-file size cap depends on your plan: 5 MB on Free, 50 MB on Standard, and 60 MB on Pro.

### Upload from your agent

An agent connected to the [Meko MCP server](/reference/mcp-server/) can upload a file it has on disk or has just generated:

```text
Add docs/runbook.md to the knowledge base of my datapack
```

The agent calls [`knowledgebase_upload_document`](/reference/mcp-server/#knowledgebase-tools) for an upload URL, sends the file to it, and polls `knowledgebase_document_status` until indexing finishes. The agent sends the file itself, so it needs the file and a way to send it over the internet, such as a terminal on your machine. A chat client that can't do that, such as Claude Desktop, or a code sandbox without internet access, can't upload this way; use the portal instead.

The agent sends the file's first 3,072 bytes. Meko checks that sample against the extension before it issues the URL. After the file arrives, Meko checks the stored bytes. If they are not the type the name claims, or the size does not match, `knowledgebase_document_status` returns `abandoned` and a `message` with the reason. Read that message before you request another URL. The agent does not have to send a second confirmation after the file arrives. The Meko skills still ask you to confirm the file and the datapack before they request the upload URL, because the file goes into the shared knowledge base.

Text files must be UTF-8. Uploading a file whose content is already in the datapack doesn't create a copy.

Upload to the knowledge base when you want to search the file's content later. To keep a file exactly as it is and get it back whole, use an [artifact](/guides/working-with-artifacts/) instead.

Free tier

Free accounts are limited to **100 MB** of total storage across all datapacks for knowledge-base files and [artifacts](/guides/working-with-artifacts/) combined, with individual files capped at **5 MB**. Standard accounts get **5 GB** of total storage and **50 MB** per file.

When Free storage is full, the banner shows `100 MB / 100 MB knowledge storage used`. On Free, choose **Upgrade to Standard**. On Standard, choose **Talk to our team**. See [Reach a tier limit](/architecture/core-concepts/datapacks/#reach-a-tier-limit).

## Query knowledge

Once your documents are indexed, query them through the MCP server from your coding agent:

```text
Search the knowledge base for information about deployment procedures
```

The MCP server embeds your query, performs similarity search against the indexed chunks, and returns the most relevant results.

## Remove a file

Files can be removed by the datapack owner, a maintainer, or the person who uploaded the file. To remove a file from the datapack:

1. In your datapack, under **Knowledge**, click **View all**.
2. On the **Files** tab under **Knowledge Base**, select the file and click **Remove from KB**.
3. Click **Remove** to confirm.

You can't undo a removal. **Remove from KB** is not available until the file finishes indexing.

To have an agent remove the file, use [`knowledgebase_delete_document`](/reference/mcp-server/#knowledgebase-tools).

## Next Steps

- [Learn about knowledge bases](/architecture/core-concepts/knowledgebase/)
- [Access your database](/guides/database-access/)
