Connapse
你的 AI 智能体在每次会话之间都会遗忘一切。Connapse 解决了这个问题。
每当你开始一段新的对话,你的 AI 智能体都是从零开始的——没有过去研究的记忆,无法访问你的文档,也没有积累的知识。Connapse 是一个开源的知识后端,为智能体提供持久、可搜索的记忆。上传文档,或将其指向你现有的 Amazon S3 存储桶、Azure Blob 存储容器或本地文件系统。智能体可以通过 11 个 MCP 工具、REST API 或 CLI 查询并构建自己的研究语料库。容器隔离、混合搜索(向量+关键词)、自托管且私密。使用 Docker 60 秒即可部署。基于 .NET 10 构建。
AI 智能体通过 MCP 服务器查询你的知识库,并接收带有文档来源引用的结构化答案。
切换嵌入提供程序、调整分块参数并配置搜索——所有操作均在运行时完成,无需重启。
📦 快速开始
git clone https://github.com/Destrayon/Connapse.git && cd Connapse && docker-compose up -d
# Open http://localhost:5001先决条件
.NET 10 SDK (用于开发)
(可选) Ollama 用于本地嵌入
使用 Docker Compose 运行
# Clone the repository
git clone https://github.com/Destrayon/Connapse.git
cd Connapse
# Set required auth environment variables (or use a .env file)
export CONNAPSE_ADMIN_EMAIL=admin@example.com
export CONNAPSE_ADMIN_PASSWORD=YourSecurePassword123!
export Identity__Jwt__Secret=$(openssl rand -base64 64)
# Start all services (PostgreSQL, MinIO, Web App)
docker-compose up -d
# Open http://localhost:5001 — log in with the admin credentials above首次运行将:
拉取 Docker 镜像(约 2-5 分钟)
初始化带有 pgvector 扩展的 PostgreSQL 并运行 EF Core 迁移
创建 MinIO 存储桶
播种管理员账户(来自环境变量)并启动 Web 应用程序
开发设置
# Start infrastructure only (database + object storage)
docker-compose up -d postgres minio
# Run the web app locally
dotnet run --project src/Connapse.Web
# Run all tests
dotnet test
# Run just unit tests
dotnet test --filter "Category=Unit"使用 CLI
安装 CLI(选择一种方式):
# Option A: .NET Global Tool (requires .NET 10)
dotnet tool install -g Connapse.CLI
# Option B: Download native binary from GitHub Releases (no .NET required)
# https://github.com/Destrayon/Connapse/releases基本用法:
# Authenticate first
connapse auth login --url https://localhost:5001
# Create a container (project)
connapse container create my-project --description "My knowledge base"
# Upload files
connapse upload ./documents --container my-project
# Search
connapse search "your query" --container my-project
# Update to latest release (--pre to include alpha/pre-release builds)
connapse update
connapse update --pre与 Claude (MCP) 一起使用
Connapse 包含一个模型上下文协议 (MCP) 服务器,用于与 Claude 和任何 MCP 客户端集成。
设置:通过 Web UI(设置 → 智能体 API 密钥)或 CLI (connapse auth agent-key create) 创建智能体 API 密钥,然后为你的客户端添加配置片段:
claude mcp add connapse --transport streamable-http http://localhost:5001/mcp --header "X-Agent-Api-Key: YOUR_API_KEY"添加到你的 claude_desktop_config.json:
{
"mcpServers": {
"connapse": {
"transport": "streamable-http",
"url": "http://localhost:5001/mcp",
"headers": {
"X-Agent-Api-Key": "YOUR_API_KEY"
}
}
}
}添加到你的 .vscode/settings.json (VS Code) 或 Cursor MCP 配置中:
{
"mcp": {
"servers": {
"connapse": {
"transport": "streamable-http",
"url": "http://localhost:5001/mcp",
"headers": {
"X-Agent-Api-Key": "${input:connapseApiKey}"
}
}
}
}
}VS Code 将在首次使用时提示输入 API 密钥。
MCP 服务器公开了 11 个工具:
工具 | 描述 |
| 创建一个用于组织文件的新容器 |
| 列出所有带有文档计数的容器 |
| 删除一个容器 |
| 获取容器统计信息(文档、分块、存储、嵌入) |
| 将单个文件上传到容器 |
| 在一次操作中上传最多 100 个文件 |
| 列出路径下的文件和文件夹 |
| 检索文档的完整解析文本内容 |
| 从容器中删除单个文件 |
| 在一次操作中删除最多 100 个文件 |
| 在容器内进行语义、关键词或混合搜索 |
完整参考:请参阅 docs/mcp-tools.md 获取参数表、返回格式、错误案例和使用示例。
写入保护:Amazon S3 和 Azure Blob 存储容器是只读的(从源同步)。文件系统容器遵循每个容器的权限标志。如果容器阻止写入,上传和删除工具将返回错误。
“创建一个名为 'project-research' 的容器,用于存放我的架构笔记”
“将我下载文件夹中的所有 PDF 上传到 project-research 容器”
“在我的 project-research 容器中搜索关于限流策略的信息”
“列出我 project-research 容器中 /notes/ 文件夹下的所有文件”
“获取 project-research 中 distributed-systems-notes.md 的全文”
“从 project-research 中删除 meeting-2026-03-14.md 并上传此更新版本”
“删除 project-research 中 /drafts/ 文件夹下的所有文件”
“我的 project-research 容器中有多少文档和分块?”
Connection refused on localhost:5001 — Docker 未运行或端口冲突。检查 docker compose ps 和 docker compose logs web。
401 Unauthorized / API 密钥无效 — 在“设置 > 智能体 API 密钥”中验证密钥。密钥仅在创建时显示一次。
工具未在 Claude 中显示 — 配置更改后重启你的 MCP 客户端。使用 curl http://localhost:5001/mcp 验证端点。
上传失败或超时 — 检查文件类型是否在允许列表中。最大文件大小取决于服务器配置。
搜索无结果 — 文档上传后需要时间进行嵌入。检查容器统计信息以查看嵌入进度。
Related MCP server: mnemostack
🚀 功能
🗂️ 容器隔离知识 — 每个项目都有自己的向量索引、存储连接器和搜索配置。项目、团队或客户之间不会交叉污染。
🔍 混合搜索 — 向量相似度 + 关键词全文搜索,支持可配置的融合(凸组合、DBSF、AutoCut)。获取纯向量搜索无法找到的结果。
🧠 多提供程序 AI — 在运行时,按容器切换 Ollama、OpenAI、Azure OpenAI 和 Anthropic,用于嵌入和 LLM,无需重启。
🔌 索引现有存储 — 连接 MinIO、本地文件系统(实时文件监控)、Amazon S3 (IAM 认证) 或 Azure Blob 存储(托管身份)。你的文件保持原位。
🤖 4 种访问界面 — Web UI、REST API、CLI(原生二进制文件)和 MCP 服务器(为 Claude 提供 11 个工具)。专为人类、脚本和 AI 智能体打造。
🔐 企业级认证 — 多层 RBAC(Cookie + OAuth 2.1 + PAT + JWT),支持 AWS IAM Identity Center 和 Azure AD 身份链接。云权限是事实来源。
🐳 一键部署 — Docker Compose 包含 PostgreSQL + pgvector、MinIO 和可选的 Ollama。内置结构化审计日志和限流功能。
📄 多格式摄入:PDF、Office 文档、Markdown、纯文本 — 自动解析、分块和嵌入
⚡ 实时处理:通过 SignalR 进行后台摄入并实时更新进度
🎛️ 运行时配置:无需重启即可更改每个容器的分块策略、嵌入模型和搜索设置
☁️ 云身份链接:AWS IAM Identity Center (设备认证流程) + Azure AD (OAuth2+PKCE),并强制执行 IAM 派生范围
👥 仅限邀请访问:管理员控制的用户注册,具有四种角色(管理员/编辑者/查看者/智能体)
🤖 智能体管理:专用的智能体实体,具有 API 密钥生命周期、范围权限和审计追踪
📋 审计日志:针对上传、删除、容器操作和认证事件的结构化审计追踪
📦 CLI 分发:原生自包含二进制文件(Windows/Linux/macOS)以及通过 NuGet 提供的 .NET 全局工具
🔄 跨模型搜索:项目进行中切换嵌入模型 — 自动为旧向量提供语义→混合回退
🎯 Connapse 适合谁?
AI 智能体开发者:需要一个智能体既能查询又能构建的知识后端 — 上传研究资料、策划语料库,并通过 MCP 或 REST API 进行搜索
.NET / Azure 团队:需要一个符合现有技术栈和云身份的 RAG 平台
企业团队:需要具有适当 RBAC 和审计追踪的项目隔离知识库
厌倦了重复上传文件的人 — 将 Connapse 指向你现有的 Amazon S3/Azure Blob 存储/文件系统存储
本项目处于积极开发阶段 (v0.3.2),即将达到生产就绪状态。
v0.3.x 增加了基于 IAM 访问控制的云连接器架构、多提供程序嵌入和 LLM 支持、云身份链接 (AWS SSO + Azure AD) 以及限流功能。
✅ 认证和授权 (v0.2.0)
✅ 基于角色的访问控制 (管理员/编辑者/查看者/智能体)
✅ 审计日志
✅ 云身份链接 — AWS IAM Identity Center + Azure AD OAuth2+PKCE (v0.3.0)
✅ IAM 派生范围强制执行 — 云权限是事实来源 (v0.3.0)
✅ 限流 — 内置 ASP.NET Core 中间件,具有针对用户和 IP 的策略 (v0.3.2)
⚠️ 在生产环境中设置强
Identity__Jwt__Secret— 请参阅 部署指南
请参阅 SECURITY.md 获取完整的安全策略。
🏗️ 架构
┌──────────────────────────────────────────────────────────────────────┐
│ Access Surfaces │
│ Web UI (Blazor) │ REST API │ CLI │ MCP Server │
└─────────────┬────────────────────────────────────────────────────────┘
│
┌─────────────▼────────────────────────────────────────────────────────┐
│ Core Services Layer │
│ Document Store │ Vector Store │ Search │ Ingestion │
└─────────────┬────────────────────────────────────────────────────────┘
│
┌─────────────▼────────────────────────────────────────────────────────┐
│ Connectors Layer │
│ MinIO │ Filesystem │ Amazon S3 │ Azure Blob Storage │
└─────────────┬────────────────────────────────────────────────────────┘
│
┌─────────────▼────────────────────────────────────────────────────────┐
│ Infrastructure │
│ PostgreSQL+pgvector │ MinIO (S3) │ Ollama (optional) │
└──────────────────────────────────────────────────────────────────────┘数据流:上传 → 搜索
[Upload] → [Parse] → [Chunk] → [Embed] → [Store] → [Searchable]
↓
[Metadata]
↓
[Document Store]目标:从上传到可搜索 < 30 秒。
关键技术:
数据库:PostgreSQL 17 + pgvector 用于向量嵌入
对象存储:托管存储抽象 — 默认为 MinIO (S3 兼容),可按部署覆盖
后端:ASP.NET Core 10 最小 API
前端:Blazor Server (交互模式)
嵌入:Ollama (默认)、OpenAI、Azure OpenAI (可配置)
LLM:Ollama、OpenAI、Azure OpenAI、Anthropic (可配置)
搜索:混合向量 + 关键词,带有凸组合融合
连接器:托管存储 (默认 MinIO)、文件系统、Amazon S3、Azure Blob 存储
📚 文档
架构指南 - 系统设计和组件概述
API 参考 - REST API 端点和示例
连接器指南 - 连接器类型、配置和后台同步
AWS SSO 设置 - AWS IAM Identity Center 集成
Azure 身份设置 - Azure AD OAuth2+PKCE 集成
部署指南 - Docker 和生产环境设置
安全策略 - 安全限制和路线图
贡献指南 - 如何贡献
🗺️ 路线图
Connapse 处于 1.0 版本之前。主要设计工作在 Discussions 中跟踪。
v0.1.0 — 基础 (已完成)
✅ 文档摄入管道 (PDF, Office, Markdown, 文本)
✅ 混合搜索 (向量 + 关键词,带有凸组合融合)
✅ 带有文件夹的基于容器的文件浏览器
✅ Web UI, REST API, CLI, MCP 服务器
v0.2.0 — 安全与认证 (已完成)
✅ 三层认证:Cookie + 个人访问
Available Tools
24 toolsappend_to_fileA
Add text to the end of an existing text file (.md, .txt, .log, ...) and reindex it. The text goes on exactly as given, so start it with a newline to put it on a new line. The file keeps its ID, path and added date; appends to one file through this server at once all land.
Inputs: file (required), text (required), containerId (required).
code_find_symbolARead-onlyIdempotent
Find where a function, method, class or other symbol is defined in indexed code (C#, Python, TypeScript). match="exact" (default) takes a name as far as you know it: "Post", "Ledger.Post" or "Acme.Billing.Ledger.Post". match="words" takes words that all appear in the qualified name ("ledger post"). match="meaning" takes a description ("where invoices are written to the ledger"). With follow=true, also returns what the first definition calls, constructs or inherits and the files defining those: the files to read to see how it works. Returns definitions with path, start and end line and signature, and ranked files.
Inputs: query (required), containerId (required), limit, match, +1 more.
code_impactARead-onlyIdempotent
What a change to a symbol could affect: the functions and types that call or inherit it, directly or through others, up to depth hops, with the files that hold them and which of those are tests. For a type, what uses its members counts too. Only links the code index resolved are followed; a call it could not resolve is missed, so check code_references for the full list of mentions.
Inputs: symbol (required), containerId (required), depth, limit.
code_referencesARead-onlyIdempotent
Find the files that use a symbol, best evidence first: files the code index links to it (a call, a base type, an import) with the lines, then files whose text names it. kind="calls" for callers only, "inherits" for subtypes only, "all" (default) for every use and mention. Name the symbol as for code_find_symbol ("Ledger.Post"); qualify it further when the name is common.
Inputs: symbol (required), containerId (required), kind, limit.
code_repo_mapARead-onlyIdempotent
A map of indexed code: the files the rest of the code refers to most, each with its main definitions and how many other files use each. Start here in an unfamiliar repository, or pass path to map one folder.
Inputs: containerId (required), path, maxFiles.
container_createA
Create a new container for documents. Use when setting up a new knowledge domain or project. To make a place for memory facts, use memory_space_create instead.
Inputs: name (required), kind, description.
container_deleteADestructive
Delete a container. It must be emptied first, because deleting one deletes its stored files. External sources are not containers and cannot be deleted here. If your token asks before deleting, nothing is deleted yet: the call returns a deletion batch that Connapse carries out itself once your owner approves it. Read the outcome with deletion_status; don't repeat the call.
Inputs: containerId (required).
container_describeARead-onlyIdempotent
Returns an agent-optimized description of a knowledge scope — container or source: its description and document statistics. Use this to understand what a scope covers before querying via search_knowledge, or when container_list output is insufficient to choose between them. The response also echoes the server's tool-routing instructions for clients that don't surface them on connect.
Inputs: containerId (required).
container_listARead-onlyIdempotent
Lists every searchable knowledge scope with its description and document count. Each entry is kind=managed (storage Connapse owns, browsable with list_files) or kind=source (an external system Connapse mirrors read-only — searchable, but it has no file listing). Memory spaces are not listed here: memory_spaces lists them. Use to discover what exists when the target is unknown; if the user already named one, call search_knowledge on it directly instead.
Inputs: no named parameters.
container_statsARead-onlyIdempotent
Get container statistics: document counts, chunk count, storage size, and embedding model info.
Inputs: containerId (required).
delete_fileADestructive
Delete one file, or up to 100 with 'fileIds', and all their chunks and vectors. To update a file, delete it first then re-upload with upload_file. With 'fileIds' it returns per-file success/failure results. If your token asks before deleting, nothing is deleted yet: the call returns a deletion batch that Connapse carries out itself once your owner approves it. Read the outcome with deletion_status; don't repeat the call. A held batch holds at most 50 files.
Inputs: containerId (required), fileId, fileIds.
deletion_statusARead-onlyIdempotent
Check a batch of deletions, by its id: one you asked for with request_deletions, or one a held delete call returned. Pass waitSeconds (up to 50) to wait while it is pending or running. state is pending, expired, denied, running or done; each item's state is deleted, skipped (gone or changed since you asked), failed, not_approved or denied, and its outcome says why. message says what to do next.
Inputs: batchId (required), waitSeconds.
get_documentARead-onlyIdempotent
Retrieve a document's full text by ID or path, or up to 50 documents' with 'files'. Returns extracted text for binary formats (PDF, DOCX, PPTX). Intended for use after search_knowledge returns a DocumentId worth reading in entirety, or when the user has named an exact file. With 'files' each document comes under its own header in the order asked; a file that can't be read gets an error line and doesn't stop the others, and past 2,000,000 characters in all, the rest get one too. Pair 'files' with list_files sort "newest" and limit to read the newest entries of a folder in two calls.
Inputs: containerId (required), files, fileId.
list_filesARead-onlyIdempotent
Lists folder entries and document IDs at a path within a container (does NOT return file contents — for content questions, use search_knowledge). Intended for inventory requests such as 'what files exist in X' or when the user named a specific filename. Large listings return a soft error directing you to search_knowledge; override with confirmLarge: true or paginate with limit. Each file shows when it was added and, if since changed, when it was updated. For the newest N entries of a folder, pass sort: "newest" and limit: N, then read them all with get_documents.
Inputs: containerId (required), path, sort, limit, +1 more.
memory_correctA
Replace a fact and keep the old one in history. kind="changed": the world changed, so the old fact ends on validFrom and the new value starts there (validFrom required). kind="wrong": the old fact was never right, so it is marked superseded and the new value takes its dates; a date you pass replaces the old one, except one where another version of the fact starts or ends. Subject and attribute default to the old fact's. A fact with versions you cannot see (another user's private ones) cannot be corrected; remember a new fact instead.
Inputs: value (required), factId (required), kind, reason, +6 more.
memory_forgetADestructive
Delete a fact for good, with every earlier and later version of it from corrections. Nothing of it is kept. To record that a value changed, use memory_correct instead. If your token asks before deleting, nothing is deleted yet: the call returns a deletion batch that Connapse carries out itself once your owner approves it. Read the outcome with deletion_status; don't repeat the call.
Inputs: factId (required), containerId.
memory_recallARead-onlyIdempotent
Read facts from memory: what is true now, or on a past date with asOf. Name a space to read one space, or leave it out to read every space you can see. Filter by subject or attribute, or pass a question as query. Each fact comes with its space, whether it is personal (only you see it) or team, its dates, author and sources. Use includeHistory to also get ended and corrected facts (for "which ticket changed X" or "when did X change"). Reading one named space without asOf or attribute returns nextCursor when there are more facts: pass it back as cursor for the next page.
Inputs: asOf, limit, query, space, +5 more.
memory_rememberA
Store one fact in a memory space: a subject ("Halcyon"), an attribute ("database") and a value ("PostgreSQL 15"), with the date it became true and the documents you learned it from. Name a space that exists: memory_spaces lists yours, and memory_space_create makes one if none fits. No space is made for you. Save to a personal space if it is about the user, their preferences or their own work; to a team space if it would be true and useful for others. If unsure, ask. Cite the document IDs that search_knowledge or get_document gave you: a fact citing sources is shown only to people who can read all of them. The answer says who can see what you saved. When a value you stored before has changed, call memory_correct instead. If the answer lists facts already current with the same subject and attribute, and you meant to replace one, correct it instead of leaving both.
Inputs: value (required), subject (required), attribute (required), space, +5 more.
memory_space_createA
Make a memory space to save facts in. Kind "personal" is yours alone: only you see its facts. Kind "team" is seen by everyone in this Connapse. Save to a personal space if it is about the user, their preferences or their own work; to a team space if it would be true and useful for others. If unsure, ask. Check memory_spaces first: no space is made for you, so make one only when none fits. Names are lowercase letters, numbers and hyphens.
Inputs: kind (required), name (required), description.
memory_spacesARead-onlyIdempotent
List the memory spaces you can use: your personal spaces (only you see them) and team spaces (everyone in this Connapse sees them). Each comes with its id, name, kind, description, whether you can add to it, and who sees it. Call this before saving to pick a space for memory_remember; if none fits, make one with memory_space_create. At most 100 are returned; pass name to find others.
Inputs: kind, name.
memory_timelineARead-onlyIdempotent
A subject's facts in date order, ended and corrected ones included: how its values changed over time. Name a space to read one space, or leave it out to read every space you can see; each fact says which space it is in. With from/to, only the facts that started or ended in that window ("what changed between A and B"). Reading one named space without from, to or attribute returns the newest facts first a page at a time, each page in date order, with nextCursor when older facts remain: pass it back as cursor.
Inputs: to, from, limit, query, +5 more.
request_deletionsA
Ask your owner to approve several deletions at once: up to 50 items, each a file (kind "file", container, target = file id or path), a folder (kind "folder", container, target = folder path), an empty container (kind "container", container = its id or name), a memory space (kind "memory_space", container = the space's id or name) or a memory fact (kind "fact", target = the fact id), with a short reason the owner reads. Every item is checked now; if any can't be deleted nothing is asked, and the error names each bad item. Nothing is deleted yet: the owner approves all, some or none on the Approvals page, and Connapse then deletes the approved items itself, skipping any that are gone or changed since you asked. Call deletion_status with the returned id (and waitSeconds) to read each item's outcome; don't delete the items yourself.
Inputs: items (required).
search_knowledgeARead-onlyIdempotent
Search a container using semantic, keyword, or hybrid mode (Hybrid is the default and works well without tuning). Returns ranked passages with citations, scores, and document IDs. If the first query returns thin results, refine the query and call again.
Inputs: query (required), containerId (required), mode, path, +2 more.
upload_fileA
Upload one file, or up to 100 with 'files', to be parsed, chunked, embedded, and made searchable. For one file give 'fileName' and either 'content' (base64) or 'textContent' (raw text), not both.
Inputs: containerId (required), path, files, content, +3 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 24 tools
Most tools are cleanly separated by resource+action (container_list vs memory_spaces vs list_files, code_find_symbol vs code_references vs code_impact), and descriptions explicitly cross-reference siblings to steer selection. Two soft overlaps remain: container_stats vs container_describe both return description/document statistics, and delete_file (which accepts up to 100 fileIds) vs request_deletions both delete in batch, forcing the agent to reason about which path applies.
A clear domain-prefix scheme is used for three of the five sub-areas (container_*, memory_*, code_*) with verb_noun forms inside each group. The document/deletion tools drop the prefix (upload_file, get_document, list_files, delete_file, search_knowledge) and deletion_status breaks into noun_noun, so it is readable and mostly predictable rather than uniform.
24 tools is at the heavy end, but the server spans four real sub-domains (containers, documents, memory facts, code index) plus an approvals flow, averaging roughly five tools each. Almost every tool earns its place, with the only redundancy being the container_stats/container_describe pair.
Lifecycle coverage is strong across every domain: containers (list/stats/describe/create/delete), documents (upload/get/list/append/delete), memory (spaces, create, remember, recall, correct, forget, timeline), code (map, find, references, impact), and async deletion with status polling. Remaining gaps are minor conveniences (container rename/update, file move/copy, direct memory_space_delete outside the approvals flow) that agents can work around.
Maintenance
Related MCP Connectors
Cloud or self-hosted knowledge for AI agents: hybrid search, reranking, GraphRAG, scoped MCP tools.
Self-hosted AI workspace: semantic RAG document search, long-term memory, and AI chat via MCP.
Your personal library, readable by AI agents: durable snapshots, hybrid search, 46 MCP tools.
Private, multimodal knowledge store for agents: hybrid search with cited, provenance-backed results.
Related MCP Servers
- AlicenseAqualityBmaintenanceSelf-hosted memory and governance layer for AI coding agents. 28 MCP tools with hybrid search, structured knowledge capture, behavioral nudges, and git-native storage. Zero cloud dependencies.306Business Source 1.1
- AlicenseAqualityAmaintenanceDurable hybrid memory for AI agents. Combines vector search, BM25, temporal retrieval, and optional Memgraph knowledge graph via reciprocal rank fusion. 6 MCP tools: health, search, answer, feedback, graph_query, graph_add_triple. Self-hosted with Qdrant backend.763 PyPI10Apache 2.0
- FlicenseNot gradedqualityDmaintenanceSelf-hosted RAG-powered knowledge base that surfaces context from structured notes and transcripts, exposing each project as an MCP tool.-
- AlicenseNot gradedqualityDmaintenanceSelf-hosted knowledge manager and MCP server that lets you organize snippets, questions, and documents via a web UI and exposes them to AI assistants for reading and writing.MIT