Mirabase 知识底座
Memory for agents. And more.
同一 API 接入文件库、知识库与长期记忆
写入即留版本、建索引;上下文按 Token 预算组装,附引用
一个 API Key,统一管理上下文
以提示词或代码接入文件库、知识库与长期记忆
获取 API Key
免费开始将提示词交给 Agent
请为你自己接入 Mirabase MCP 服务,并完成一次测试。 1. API Key 保存在环境变量 MIRABASE_API_KEY 中。仅在配置请求头时使用该变量的值,不要打印或回显其值,也不要将其写入回复或日志。 2. 按当前客户端的配置方式,添加名为 mirabase 的 MCP 服务:地址 https://api.mirabase.dev/mcp,传输方式 Streamable HTTP,请求头 Authorization: Bearer <MIRABASE_API_KEY 的值>。说明见 https://mirabase.io/zh/developers/agents 3. 如果新工具需要重启后才能使用,请先提示我重启,等我重启后再从第 4 步继续。 4. 调用 mira.whoami,确认连接成功,并查看这个 Key 的能力。 5. 调用 mira.files.write 写入测试文件 /quickstart/agent-test.md,create_only 设为 true,内容为:The launch moved to March 14. Tina owns the checklist. 6. 调用 mira.answer 提问:When is the launch, and who owns the checklist? 确认回答附有引用。 7. 向我报告:连接是否成功、Key 的能力、测试文件路径、回答原文及其引用。 不要删除或修改任何已有内容。若某一步失败,请立即停止,并告诉我错误码和错误信息。
Base URLhttps://api.mirabase.dev
按路径读写
PUT /v2/spaces/{space_id}/files每次写入留版本,可回滚
POST /v2/spaces/{space_id}/files/revert分支与快照
POST /v2/spaces/{space_id}/branches- API 参考
请求示例
curl -X PUT "https://api.mirabase.dev/v2/spaces/default/files?path=/notes/hello.md" \
-H "Authorization: Bearer $MIRABASE_API_KEY" \
-H "Content-Type: text/markdown" \
--data-binary "Mirabase keeps files, knowledge and memory in one place."
请求示例
import { Mirabase } from "@mirabase/sdk/developer";
const mirabase = new Mirabase(); // MIRABASE_API_KEY
const written = await mirabase.files.write(
"/notes/hello.md",
"Mirabase keeps files, knowledge and memory in one place.",
{ contentType: "text/markdown" },
);
请求示例
from mirabase import Mirabase
mb = Mirabase() # MIRABASE_API_KEY
written = mb.files.write(
"/notes/hello.md",
"Mirabase keeps files, knowledge and memory in one place.",
content_type="text/markdown",
)
响应结构示例
{
"entry": {
"id": "<id>",
"space_id": "<space_id>",
"title": "Launch notes",
"latest_version_id": "<latest_version_id>",
"metadata": {},
"created_at": "2026-11-06T00:00:00Z",
"updated_at": "2026-11-06T00:00:00Z",
"file": {
"path": "/notes/hello.md",
"size": 1,
"media_type": "<media_type>",
"etag": "<etag>"
},
"knowledge": {
"state": "readable"
},
"memory": {
"scope": "project",
"kind": "<kind>",
"pinned": false,
"exclude": false
},
"memory_exclude": false,
"access": {
"role": "owner",
"capabilities": [
"knowledge:read"
]
}
},
"version_id": "<version_id>",
"version_created": false
}
写入即建索引
GET /v2/entries/{entry_id}/processing混合检索,附引用
POST /v2/retrieval/search标记重复、被取代与冲突内容
flags- API 参考
需先写入文件
请求示例
curl -X POST https://api.mirabase.dev/v2/retrieval/search \
-H "Authorization: Bearer $MIRABASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query": "where do files and memory live"}'
需先写入文件
请求示例
import { Mirabase } from "@mirabase/sdk/developer";
const mirabase = new Mirabase(); // MIRABASE_API_KEY
const hits = await mirabase.search("where do files and memory live");
需先写入文件
请求示例
from mirabase import Mirabase
mb = Mirabase() # MIRABASE_API_KEY
hits = mb.search("where do files and memory live")
响应结构示例
{
"data": [
{
"entry_id": "ent_01JD2M8Z4K",
"version_id": "ver_01JD2M8Z4M",
"space_id": "col_01JD2M7QK3",
"title": "plan.md",
"text": "The launch of version 2.4 moved to Friday 21 November.",
"score": 0.82,
"citation_id": "c1",
"source_type": "file",
"path": "/notes/plan.md",
"modified_at": "2026-11-17T08:02:00Z"
}
],
"trace_id": "trc_01JD2M7R",
"partial": false
}
从对话提炼事实
POST /v2/spaces/{space_id}/ingest新值取代旧值,保留历史
replaced_by确认、更正或遗忘
POST /v2/memories/{memory_id}/correct- API 参考
请求示例
curl -X POST "https://api.mirabase.dev/v2/spaces/default/ingest" \
-H "Authorization: Bearer $MIRABASE_API_KEY" \
-H "Idempotency-Key: chat-42-batch-1" \
-H "Content-Type: application/json" \
-d '{"kind": "conversation", "session_id": "chat-42", "messages": [
{"role": "user", "content": "Let us ship on Thursdays from now on.", "timestamp": 1762416000000},
{"role": "assistant", "content": "Noted: releases on Thursdays."}
]}'
请求示例
import { Mirabase } from "@mirabase/sdk/developer";
const mirabase = new Mirabase(); // MIRABASE_API_KEY
const receipt = await mirabase.conversations.add(
[
{ role: "user", content: "Let us ship on Thursdays from now on.", timestamp: 1762416000000 },
{ role: "assistant", content: "Noted: releases on Thursdays." },
],
{ sessionId: "chat-42", idempotencyKey: "chat-42-batch-1" },
);
请求示例
from mirabase import Mirabase
mb = Mirabase() # MIRABASE_API_KEY
receipt = mb.conversations.add(
[
{"role": "user", "content": "Let us ship on Thursdays from now on.", "timestamp": 1762416000000},
{"role": "assistant", "content": "Noted: releases on Thursdays."},
],
session_id="chat-42",
idempotency_key="chat-42-batch-1",
)
响应结构示例
{
"entry_id": "ent_01JD2M9B2D",
"version_id": "ver_01JD2M9B2E",
"job_id": "job_01JD2M9B2F",
"knowledge": {
"state": "readable"
},
"memory_status": "confirmed",
"memory": {
"state": "pending"
},
"secrets_redacted": 0
}
按 Token 预算组装
budget_tokens取自文件库、知识库与长期记忆
weights逐条附引用
citation_id- API 参考
需先写入文件
请求示例
curl -X POST https://api.mirabase.dev/v2/retrieval/context \
-H "Authorization: Bearer $MIRABASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"task": "Fix the failing upload test", "purpose": "coding", "tier": "standard", "budget_tokens": 4000}'
需先写入文件
请求示例
import { Mirabase } from "@mirabase/sdk/developer";
const mirabase = new Mirabase(); // MIRABASE_API_KEY
const pack = await mirabase.context("Fix the failing upload test", {
purpose: "coding",
tier: "standard",
budget_tokens: 4000,
});
需先写入文件
请求示例
from mirabase import Mirabase
mb = Mirabase() # MIRABASE_API_KEY
pack = mb.context(
"Fix the failing upload test",
purpose="coding",
tier="standard",
budget_tokens=4000,
)
响应结构示例
{
"pack_id": "<pack_id>",
"items": [
{
"entry_id": "<entry_id>",
"version_id": "<version_id>",
"title": "Launch notes",
"text": "The launch moved to March 14.",
"citation_id": "<citation_id>",
"source": "memory"
}
],
"route": {
"purpose": "task",
"tier": "fast",
"rules_fired": [
"<rules_fired>"
],
"sources": [
{
"source": "memory",
"budget": 1,
"used": 1,
"picked": 1,
"omitted": 1,
"why": "<why>"
}
],
"unused_tokens": 1
},
"tokens_used": 1,
"budget_tokens": 1,
"tokenizer": "cl100k_base",
"omitted": {
"count": 1,
"max_score": 1
},
"scope_used": {
"space_ids": [
"<space_ids>"
]
},
"partial": false
}
安全、可靠与快速
安全
静态加密,仅限 HTTPS,租户按行隔离
每个 Agent 独立限权 Key;操作全程审计
可靠性
不可变版本、快照、废纸篓可恢复
幂等写入;备份保留 7 天
速度
线上中位耗时:检索约 0.64 秒,组装约 1.2 秒
流式回答;按 Token 预算组装
