ContextVault
AI代理的共享上下文存储。任何兼容MCP的模型(Claude、ChatGPT、Gemini)都可以通过MCP服务器存储、读取和搜索上下文条目。web UI允许您浏览和管理所有内容。
建筑
Claude / ChatGPT / Gemini
│ (MCP stdio)
▼
┌──────────────┐
│ MCP Server │──────┐
└──────────────┘ │
▼
┌──────────────┐ ┌──────────┐
│ Web UI │──▶│ Express │──▶ PostgreSQL
└──────────────┘ └──────────┘- API快车 (
src/index.ts)-REST API+为React UI提供服务 - MCP服务器 (
src/mcp.ts)--用于AI代理的stdio MCP服务器 - PostgreSQL --带有JSONB标签和GIN索引的持久存储
快速入门(Docker)
docker compose up打开http://localhost:3000对于UI。Postgres在端口5432上运行。
本地开发
先决条件:Node.js 20+,PostgreSQL在本地运行。
# Create the database
createdb context_vault
# Install and build
npm install
cd client && npm install && npm run build && cd ..
npm run build:server
# Start the web server
npm start
# Or run the MCP server for AI agents
npm run mcp集 DATABASE_URL env-var如果你的Postgres不是默认值 postgresql://postgres:postgres@localhost:5432/context_vault.
MCP配置
克劳德代码/克劳德桌面
{
"mcpServers": {
"context-vault": {
"command": "node",
"args": ["/absolute/path/to/context-vault/dist/mcp.js"],
"env": {
"DATABASE_URL": "postgresql://postgres:postgres@localhost:5432/context_vault"
}
}
}
}部署到GCP(云运行)
# Build and push
gcloud builds submit --tag gcr.io/PROJECT_ID/context-vault
# Deploy
gcloud run deploy context-vault \
--image gcr.io/PROJECT_ID/context-vault \
--set-env-vars DATABASE_URL=postgresql://... \
--port 8080 \
--allow-unauthenticatedAPI
| 方法 | 路径 | 描述 |
|---|---|---|
| 得到 | /api/stats | 仪表板统计信息 |
| 得到 | /api/namespaces | 列出命名空间 |
| 得到 | /api/entries | 列表条目(查询: namespace, source, tag) |
| 得到 | /api/entries/search?q= | 搜索条目 |
| 得到 | /api/entries/:ns/:key | 获得一个条目 |
| 职位 | /api/entries | 创建/追加销售条目 |
| PUT | /api/entries/:ns/:key | 更新条目 |
| 删除 | /api/entries/:ns/:key | 删除条目 |
MCP工具
| 工具 | 说明 |
|---|---|
store | 存储或追加销售上下文条目 |
get | 检索特定条目 |
update | 部分更新条目 |
delete | 删除条目 |
list | 列出带有过滤器的条目 |
search | 按关键字搜索 |
namespaces | 列出所有命名空间 |
