Skip to main content
Glama

知己 (Zhiji) Memory — MCP Server

Chinese-first, brain-inspired long-term memory as an MCP server. Give any MCP client — Claude Desktop / Claude Code / Cursor / Cline / Cherry Studio / Coze — the ability to remember and understand your user across sessions.

中文用户:完整接入手册见 MCP-USAGE.md,或在线版 https://ai-know.me/mcp。

v0.4.0 · 9 tools / 2 resources / 1 prompt · stdio + Streamable HTTP · MCP protocol 2025-11-25

This repo is a thin bridge: it translates MCP tool calls into REST calls to the Zhiji backend (hosted at ai-know.me). The bridge stores nothing; all memory lives in the Zhiji service you connect to.


Why not just another vector-memory MCP?

Mem0 / Zep / LangMem expose add / search / delete over a vector store. 知己 exposes brain-inspired primitives:

  • 11-stage hybrid retrieval — trigram full-text + bge-large-zh semantic + time-decay + access-reinforcement + dedup ranking.

  • 7-layer / 37-dimension evolving user profile — values, decision logic, behavior style, self-cognition, interoceptive & dynamic state.

  • Workspace assembly — one call returns profile + relevant memories + confirmed facts + behavioral inferences, budget-trimmed for the client context window.

  • Prospective reminders, multimodal ingest (audio / OCR / doc), and a self-evolving reward loop driven by user feedback.

All Chinese-optimized (trigram tokenizer + bge-large-zh); English is supported too. Memory is stored in the Zhiji backend you connect to — self-host it, or use the hosted ai-know.me service; either way it's your Zhiji instance, not a generic memory-SaaS middleman.

Related MCP server: memento-mcp-server

Tools, resources & prompts

9 tools, grouped by role. Every user-scoped tool takes userEmail (or falls back to MB_USER_EMAIL); only the notable extra params are listed.

Read — understand the user

Tool

What it does

Notable params

zhiji_workspace_assemble

Flagship. One call returns everything needed to understand this user for a query — relevant memories + profile + confirmed facts + behavioral inferences (plus counterfactual & cross-domain hints). Drop straight into any LLM's context.

query; maxResults ≤20 (def 6). Slow "what-if" queries can take 10–15s.

zhiji_memory_search

Lighter, recall-only: the 11-stage hybrid pipeline (trigram FTS + semantic + time-decay), returns scored snippets with sources.

query; maxResults ≤50 (def 8)

zhiji_profile_get

7-layer / 37-dim user profile as an inject-ready natural-language summary.

—

zhiji_facts_get

Structured atomic facts (subject attribution, confidence, conflict status) — for exact names/dates/counts, not narrative.

—

zhiji_prospective_due

Due/upcoming intentions (todos, promises, plans) within a time window — for proactively nudging the user.

hours ≤720 (def 24)

Write — feed memory

Tool

What it does

Notable params

zhiji_memory_ingest

Write a conversation turn to long-term memory; async embedding + profile/fact extraction + importance scoring follow. Text only.

conversationId; messages[{ author: "user"|"bot", text }]

zhiji_ingest_file

Multimodal ingest — audio / image / PDF / Word / Excel / video → Whisper transcribe / Tesseract OCR / doc parse → memory. Audio & video also get acoustic-emotion analysis.

one of path | url | base64; filename; isUserVoice

Ops — improve & diagnose

Tool

What it does

Notable params

zhiji_feedback

Thumbs up/down on the last recall/answer → feeds the self-evolution reward and reinforces (or penalizes) the Q-value of recently retrieved memories. The "gets better the more you use it" loop.

rating: "up"|"down"; weak? → ±0.5

zhiji_status

Health & memory scale (files / chunks / FTS availability). Call first to verify connectivity.

—

2 resources — zhiji://schema/dimensions (authoritative 7-layer / 37-dim profile schema) · zhiji://server/status (live service status). 1 prompt — personal-context: weaves profile + memories + facts into a ready-to-prepend system prompt for a given query.

Experimental capabilities (sleep consolidation / dream replay / emergence) are not exposed until their groundedness passes ablation.

Typical flow

zhiji_status              → verify connectivity
zhiji_memory_ingest       → feed a conversation  (or zhiji_ingest_file for audio/docs)
zhiji_workspace_assemble  → in a *new* session, recall + understand the user
zhiji_feedback            → thumbs up/down, closing the self-evolution loop

Quick start

You need an agent Key (mb- prefix). Get one at https://ai-know.me/memory?tab=api (register + create a Key bound to your account).

Point any Streamable-HTTP MCP client at the hosted endpoint — you don't need this repo at all:

claude mcp add zhiji-memory --transport http \
  --url https://ai-know.me/mcp \
  --header "Authorization: Bearer mb-yourKey"

Or in a URL-style client config (Cursor / Cherry Studio / LobeChat):

{
  "mcpServers": {
    "zhiji-memory": {
      "url": "https://ai-know.me/mcp",
      "headers": { "Authorization": "Bearer mb-yourKey" }
    }
  }
}

Option B — run this bridge locally (stdio)

Use this repo when you want the bridge as a local stdio process (e.g. a desktop client launches it for you), talking to the hosted Zhiji backend:

npm install   # only @modelcontextprotocol/sdk + zod

Then in your client config:

{
  "mcpServers": {
    "zhiji-memory": {
      "command": "node",
      "args": ["/absolute/path/to/zhiji-mcp/zhiji-mcp-server.mjs"],
      "env": {
        "MB_BASE_URL": "https://ai-know.me",
        "MB_API_KEY": "mb-yourKey"
      }
    }
  }
}

Verify

# visual debugger — should list 9 tools / 2 resources / 1 prompt
npx @modelcontextprotocol/inspector node zhiji-mcp-server.mjs

Full client matrix (LangChain, OpenAI Agents SDK, Coze…) is in MCP-USAGE.md.

Architecture — a stateless thin bridge

MCP client  ──stdio / HTTP(JSON-RPC)──►  zhiji-mcp-*.mjs  ──REST──►  Zhiji backend (ai-know.me)

The MCP layer stores nothing; it translates MCP tool calls into REST calls to the Zhiji backend. Shared core zhiji-mcp-core.mjs backs both entry points:

File

Role

zhiji-mcp-core.mjs

Tool/resource/prompt definitions (single source of truth)

zhiji-mcp-server.mjs

stdio entry (npm start)

zhiji-mcp-http.mjs

Streamable HTTP entry (npm run http)

Isolation & auth

  • All data is hard-isolated by userEmail. The bridge treats userEmail as a namespace, not a credential.

  • The hosted public endpoint requires an agent Key — requests without Bearer mb-… get 401; the backend binds each Key to its userEmail and rejects cross-user access.

  • Never hand a key-less, userEmail-swappable bridge to end users — front it with your own backend that injects the correct userEmail. See MCP-USAGE.md §8.

Environment

Var

Default

Notes

MB_BASE_URL

http://localhost:3001

Zhiji backend address; for the hosted service use https://ai-know.me

MB_USER_EMAIL

—

default user namespace (single-user local use)

MB_API_KEY

—

mb- agent Key; forwarded as Bearer

MB_TIMEOUT_MS

60000

slow workspace routes can take ~15s

Status

Version

Highlights

v0.4

zhiji_ingest_file (9 tools) + public-release hardening (TLS, MCP_REQUIRE_KEY, JWT-only key issuance, cross-user isolation hard-test)

v0.5 (planned)

inference-list tool, resource subscriptions, fine-grained key permissions

Docs

License

MIT © 2026 知己 AI (ai-know.me)


知己 AI · MCP integration — Chinese-first brain-inspired memory. The bridge is open; the memory intelligence lives in the Zhiji backend.

Available Tools

9 tools
zhiji_facts_getAInspect

获取从对话中抽取的结构化事实清单(主体归属、置信度、冲突状态)。适合需要精确事实而非叙述性记忆的场景(如核对姓名/日期/数量)。

Inputs: userEmail.

zhiji_feedbackAInspect

对知己最近一次记忆召回/回答的质量提交显式反馈(点赞/点踩)。反馈会进入知己的自演化奖励信号(implicitPositiveRate),并对最近检索到的记忆块做 Q 值强化(赞)或惩罚(踩)——这是让 agent 的使用效果反哺记忆系统、使其越用越懂用户的闭环入口。rating=up 表示记忆/回答有帮助且准确,down 表示记错/答非所问。⚠️ 若希望反馈精确落到具体记忆块(而非仅计入全局奖励),请在同一会话里先调用 zhiji_workspace_assemble 或 zhiji_memory_search,再调用本工具。

Inputs: rating (required), note, weak, query, +1 more.

zhiji_ingest_fileAInspect

把一个文件(音频/录音/图片/PDF/Word/Excel/视频等)经知己既有抽取管线(Whisper 语音转写 / Tesseract OCR / 文档解析)转成文本后写入长期记忆——这是让音视频与文档'进记忆'的入口(zhiji_memory_ingest 只收文本)。来源三选一:path=MCP 服务器本机可读的文件路径(适合 stdio 本地客户端);url=http(s) 链接(桥接可下载);base64=内联字节(适合远程 HTTP 客户端的小文件)。⚠️ 音视频转写在 CPU 上可能耗时数分钟,请把客户端超时调大并耐心等待。★音视频还会做声学情绪分析(音量/语速/声纹情绪)存入情绪库;isUserVoice=true(确认是用户本人的录音/视频)时,声学情绪进一步汇入用户画像「声学情绪基调」——非用户本人的音频(播客/他人声音)务必留默认 false,否则会污染画像。

Inputs: url, path, base64, filename, +3 more.

zhiji_memory_ingestAInspect

把一轮对话写入用户的长期记忆。写入后系统异步完成:向量嵌入、画像提取、事实抽取、重要度评分等。messages 必须成对提供 user 与 assistant 发言(至少一条 user)。⚠️ 本工具只收文本;音频/录音/图片/PDF/Word/Excel/视频等文件请改用 zhiji_ingest_file(经既有抽取管线转写/OCR/解析后进记忆)。

Inputs: messages (required), conversationId (required), botId, userEmail.

zhiji_profile_getAInspect

获取用户画像的文本摘要(7 层 36 维:基础身份/自传体记忆/思维准则/行为方式/内感知状态/动态状态/涌现洞察)。返回适合直接注入系统提示词的自然语言摘要。

Inputs: userEmail.

zhiji_prospective_dueAInspect

查询用户当前窗口内到期/临期的前瞻性意图(待办、承诺、计划)。返回描述、触发条件、到期时间。适合 agent 在对话开始时主动提醒用户'该做某事了'。数据来自知己前瞻监控(prospective-monitor)。

Inputs: hours, userEmail.

zhiji_statusAInspect

查询 memory-bridge 服务健康状态与规模(文件数/记忆块数/FTS 可用性)。用于连通性诊断。

Inputs: no named parameters.

zhiji_workspace_assembleAInspect

组装知己的统一记忆上下文(工作空间):对一个查询返回相关记忆片段(memoryContext)、用户画像摘要(profile)、事实(factContext)、推论提示(inferenceHints)、反事实推演(counterfactualHint)、跨域联想(emergenceHint)等。这是把'懂用户'注入任何 LLM 对话的一站式入口。注意:慢思考查询(假设/对比类)因触发 LLM 推演,延迟可达 10-15 秒。

Inputs: query (required), userEmail, maxResults.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 9 tools

    Disambiguation5/5

    Each tool targets a distinct operation: memory assembly, search, ingestion, profile/facts retrieval, status, proactive reminders, and feedback. Even the similar workspace_assemble and memory_search are clearly differentiated by depth (inference vs recall-only). No overlapping purposes.

    Naming Consistency4/5

    All tools use snake_case with 'zhiji_' prefix, but verb placement varies: some are verb_noun (workspace_assemble, memory_search), others noun_verb (profile_get, facts_get), and 'status' is just a noun. Minor inconsistency but still predictable and readable.

    Tool Count5/5

    9 tools is well-scoped for a memory server. Each tool serves a clear need: ingest (text and file), search (light and heavy), retrieve profile/facts, status check, proactive reminders, and feedback. Nothing feels extraneous or missing.

    Completeness3/5

    Covers creation (ingest) and retrieval (search, profile, facts) well, but lacks update/delete tools for memories. Feedback allows quality adjustments but not content modifications. Prospective and status are nice additions, but lack of full CRUD is a notable gap.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers