ReMe/integrations/claude_code
jinliyl 3d2ecc60d2
feat(service): expose MCP through HTTP backend (#498)
* feat(service): expose MCP through HTTP backend

Serve JSON/SSE job endpoints and streamable HTTP MCP from one FastAPI application, sharing the same jobs and application lifecycle. Preserve the standalone MCP backend, add configurable MCP HTTP settings, update startup metadata and integration docs, and cover routing, lifecycle, configuration, and compatibility behavior with unit tests.

* fix(service): preserve MCP request protections

Route the exact MCP path through the complete FastMCP ASGI application so its middleware and state remain active. Reject non-literal MCP paths and validate reserved Job conflicts before tolerant service registration. Add regression coverage for middleware preservation, route syntax, and startup failure.

* fix(service): reject encoded MCP paths

Reject percent signs in mcp_path so ASGI path decoding cannot turn an accepted configuration into an unreachable route. Cover encoded slash, space, and double-encoded slash inputs.
2026-08-27 17:23:11 +08:00
..
.claude-plugin feat: add DSH memory integration and organize extensions (#461) 2026-08-20 15:31:51 +08:00
reme feat(service): expose MCP through HTTP backend (#498) 2026-08-27 17:23:11 +08:00
README.md feat(service): expose MCP through HTTP backend (#498) 2026-08-27 17:23:11 +08:00

ReMe plugin for Claude Code

Connect Claude Code to ReMe — file-native long-term memory for AI agents. The plugin gives the agent recall (read long-term memory) and records every session automatically via a Stop hook. Consolidation of daily notes into long-term digest/ knowledge runs server-side in ReMe.

What you get

  • MCP tools from the reme server: search, traverse, daily_list, frontmatter_read, read, auto_memory_cc, and more.
  • Stop hook (hooks/auto_memory.py) — when a session ends it calls ReMe's server-side auto_memory_cc tool in a detached background process, passing only the session id. The server resolves that session's transcript on disk and records the durable facts into today's daily note. Recording is fully automatic and asynchronous — the agent never records by hand, and stopping is never delayed. Best-effort: if the server is down it logs and gives up silently.
  • Skill reme-memory — recall long-term memory before answering (semantic search, topological traverse, state daily_list/frontmatter_read, then read with citations), plus a server status check. Recording is handled silently by the Stop hook.

Deployment model

The plugin connects to a shared HTTP MCP server you start once — it does not spawn ReMe. One server means one set of background watchers / dream cron across all your Claude Code windows.

Prerequisites

  1. Install ReMe (Python 3.11+):

    pip install "reme-ai[core]"
    
  2. Configure model credentials in a .env (see example.env):

    EMBEDDING_API_KEY=sk-xxx
    EMBEDDING_BASE_URL=https://dashscope.aliyuncs.com/compatible-mode/v1
    LLM_API_KEY=sk-xxx
    LLM_BASE_URL=https://dashscope.aliyuncs.com/compatible-mode/v1
    
  3. Start the ReMe HTTP server (one time, leave it running):

    reme start service.backend=http
    

    The same process serves the JSON Job API and MCP at http://127.0.0.1:2333/mcp. To use a different port, start with service.port=<port> and update the url in .mcp.json to match.

Install the plugin

/plugin marketplace add ./integrations/claude_code
/plugin install reme@reme-marketplace

(Or point /plugin marketplace add at the GitHub repo + subpath once published.) Restart Claude Code, then run /mcp to confirm the reme server and its tools are connected; the reme-memory skill can then recall memory and report server health.

Notes

  • The plugin's MCP server URL lives in integrations/claude_code/reme/.mcp.json. Keep it in sync with how you start ReMe (host/port). The Stop hook reads this same file to find the server (override with REME_HOST / REME_PORT env vars).
  • The Stop hook needs python3 on PATH and resolves transcripts under ~/.claude/projects (override the base with CLAUDE_CONFIG_DIR). It logs to integrations/claude_code/reme/logs/auto_memory_hook.log.
  • The MCP tool-name prefix (mcp__reme__…) may include the server segment depending on your Claude Code version; the skill uses the mcp__reme__* wildcard so it works either way.