oG-Memory RAG MCP

oG-Memory RAG MCP

A thin MCP client that provides a search_kb tool for querying a remote oG-Memory knowledge base, enabling any agent to retrieve relevant information without local setup.

Category
访问服务器

README

oG-Memory RAG MCP

PyPI CI License: MIT

An MCP server that gives any agent a search_kb tool over a remote oG-Memory knowledge base.

Install this MCP, set two environment variables — OGMEM_API_URL and OGMEM_API_TOKEN — and your agent can query the shared knowledge base directly. No local oG-Memory install, no vector DB, nothing else. The knowledge base runs on a server; this is just the thin client that connects your agent to it.

agent (Claude Code / Cursor / VS Code / …)
  └─ ogmem-rag-mcp  ──HTTP──►  oG-Memory server  (search_kb, token-gated)
        tool: search_kb            └─ vector + BM25 retrieval over the KB

Requirements

  • uv on PATH (provides uvx). Nothing else — uvx fetches and runs the server on demand.
  • An oG-Memory KB server URL and its team token (ask your admin).

Configuration (the only two you must set)

Variable Required Meaning
OGMEM_API_URL ✅ The KB server, e.g. http://110.40.165.184:19532
OGMEM_API_TOKEN ✅ for shared servers Team token, sent as the X-KB-Token header
OGMEM_ACCOUNT_ID optional KB account (default compatibility-sdk-5.1.1)
OGMEM_USER_ID optional Caller id recorded in retrieval signals
OGMEM_TIMEOUT optional Per-request seconds (default 60)

Install

Every host uses the same command — uvx ogmem-rag-mcp — with the two env vars. Pick your host below.

Cursor

Add to Cursor

Click the button (then replace <team-token> in the installed entry), or add to ~/.cursor/mcp.json manually:

{
  "mcpServers": {
    "ogmem-rag": {
      "command": "uvx",
      "args": ["ogmem-rag-mcp"],
      "env": {
        "OGMEM_API_URL": "http://110.40.165.184:19532",
        "OGMEM_API_TOKEN": "<team-token>"
      }
    }
  }
}

Claude Code

One line:

claude mcp add ogmem-rag \
  --env OGMEM_API_URL=http://110.40.165.184:19532 \
  --env OGMEM_API_TOKEN=<team-token> \
  -- uvx ogmem-rag-mcp

VS Code

Install in VS Code

Or add to .vscode/mcp.json:

{
  "servers": {
    "ogmem-rag": {
      "command": "uvx",
      "args": ["ogmem-rag-mcp"],
      "env": {
        "OGMEM_API_URL": "http://110.40.165.184:19532",
        "OGMEM_API_TOKEN": "<team-token>"
      }
    }
  }
}

Claude Desktop / Windsurf / Cline / Zed / any other MCP host

Same server entry in the host's MCP config file:

{
  "mcpServers": {
    "ogmem-rag": {
      "command": "uvx",
      "args": ["ogmem-rag-mcp"],
      "env": {
        "OGMEM_API_URL": "http://110.40.165.184:19532",
        "OGMEM_API_TOKEN": "<team-token>"
      }
    }
  }
}

Before it's on PyPI, replace "args": ["ogmem-rag-mcp"] with "args": ["--from", "git+https://github.com/PoivronMax/oG-Memory-RAG", "ogmem-rag-mcp"] to run straight from GitHub.


Usage — how you actually query the KB

You don't run any command. Once the MCP is installed in your host, just talk to your agent normally. The agent sees a search_kb tool and calls it on its own whenever your question looks like something the knowledge base can answer — then answers you using what it found. The "query" is phrased by the agent, not typed by you.

You:   "In Cangjie, how do I measure text width before drawing on a Canvas?"
Agent: (decides the KB can help) → calls search_kb("Canvas measureText text width")
       → gets the measureText signature back → writes the code for you.

Nothing to memorize, no special syntax — your normal chat is the interface.

Want to force it (when the agent didn't search but you think it should)? Just say so in plain language:

"Search the KB for how to set a TextInput placeholder."
"Check the knowledge base for Cangjie's match expression syntax first, then write it."
"Use search_kb to look up AbilityStage lifecycle callbacks."

Any phrasing that mentions the KB / knowledge base / search_kb nudges the agent to call the tool. It's still natural language — you're just pointing at it.

This is an MCP tool for the agent, not a search box for you. There is no UI; the chat window is the interface, and the agent decides when and what to search. It won't query the KB for unrelated questions.

Verify the connection (one-time, optional)

This is a health probe you run once to confirm the URL + token work — it is not how you query day-to-day (that's the Usage section above). You never need to type OGMEM_... on the command line again after this.

OGMEM_API_URL=http://110.40.165.184:19532 OGMEM_API_TOKEN=<team-token> \
  uvx ogmem-rag-mcp --check
# -> {"base_url": "...", "account_id": "compatibility-sdk-5.1.1", "health": {"status": "ok", ...}}

status: ok → ready, go chat with your agent. 403 → missing/wrong token. Connection error → OGMEM_API_URL unreachable (check the address / your network).

The tool the agent gets

search_kb(query, top_k=8, snippet_chars=1500, min_score=None, categories=None) — searches the KB and returns ranked hits. Each hit carries uri (source/provenance), score, category, abstract, and a query-centered snippet (with a truncated flag). Results are precise excerpts, not whole-document dumps. When a hit looks right but its snippet is truncated, search again with that document's distinctive terms and a larger snippet_chars (up to 20000) to read deeper.

How it talks to the server

  • Calls only POST /api/v1/call/search_kb (retrieval) and GET /api/v1/health (probe) — both read-only and whitelisted on the server's reverse proxy. No write path is exposed.
  • Sends the token as X-KB-Token; ignores system proxy env vars so a corporate/local proxy won't hijack the direct call.
  • Stateless: every call is independent; nothing is created on the server.

Develop

uv venv && uv pip install -e ".[dev]"
pytest            # unit tests use httpx MockTransport, no live server needed

Publishing (maintainers)

Releases go to PyPI via Trusted Publishing (OIDC — no stored token). One-time:

  1. On PyPI, add a pending trusted publisher: project ogmem-rag-mcp, owner PoivronMax, repo oG-Memory-RAG, workflow publish.yml, environment pypi.
  2. In the GitHub repo settings, create an environment named pypi.

Then each release is just:

# bump version in pyproject.toml + src/ogmem_rag_mcp/__init__.py, commit, then:
git tag v0.1.0 && git push origin v0.1.0

The publish.yml workflow builds and uploads automatically.

Relationship to oG-Memory

The server side (ingestion, chunking, embedding, the search_kb endpoint) lives in oG-Memory. This repo is only the MCP client surface, kept standalone so it installs anywhere without pulling in the full engine.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选