Contextforge

MCP文档知识

提供方 alfredoizdev

文档知识 未标注 API Key 社区 / 第三方 Claude DesktopClaudeCursorVS Code

Persistent memory MCP server for Claude. Store decisions, code snippets, and knowledge that

一句话选型结论

按资料字段整理

Contextforge 属于文档知识类 MCP 服务器,传输方式未标注,API Key,可直接接入 Claude Desktop、Claude、Cursor 等,没有现成安装命令,需按官方文档接入。接入前先确认权限范围;涉及写入、删除或付款的操作,建议先在测试环境验证。

分类文档知识 传输方式未标注 鉴权API Key 部署方式未标注
GitHub 星标 未标注 仓库热度,无公开仓库时显示未标注
工具数 未标注 暴露给模型的工具数量
资源 / 提示词 0 / 0 资源与提示词模板数量
维护方 社区 / 第三方 核验等级 仅资料核对

工具与能力

文档知识
数量来自来源目录的标注,具体工具清单以官方文档为准
工具数量未标注暴露给模型可调用的工具个数
资源数量0可读取的资源条目
提示词数量0内置提示词模板数量

能力标签

memory claude context developer tools git collaboration knowledge management

支持客户端

适用场景

memoryclaudecontext

安装与配置

未标注 API Key
上游未给出传输方式
  1. 1
    准备运行环境

    按官方文档确认运行环境(常见为 Node.js 或 Python),装好后再执行安装命令。

  2. 2
    安装服务

    复制上面的安装命令执行;命令里带占位符的位置,换成自己的密钥或路径。

  3. 3
    写入客户端配置

    在客户端的 MCP 配置里填好启动命令和参数,保存后完全退出客户端再打开,让新配置生效。

  4. 4
    验证是否可用

    连接成功后随便调一个只读工具,确认能返回结果,再接入正式流程。

典型使用场景

3 类
按分类与标签整理的常见用法,具体以官方文档为准
文档检索问答

在你的文档库里按问题找答案。

知识库读写

把新资料写进知识库,随用随取。

内容整理

把零散资料归纳成结构化笔记。

选择建议

选之前先看这几条
按条目字段给出的判断,不替你决定用不用

值得选的地方

  • 已适配 Claude Desktop、Claude、Cursor,换客户端不用重新研究配置。

先想清楚的地方

  • 没有现成安装命令,需要按官方文档自己填启动命令和参数。
  • 使用前要准备好API Key对应的凭据,并按最小权限配置。
  • 资料没标注工具数量,实际能力要装好后确认。
  • 版本更新与行为细节以官方仓库为准。

更适合

  • 需要在文档知识场景里让模型直接调用外部能力的人。
  • 已经在用 Claude Desktop、Claude 的用户,接入路径最短。
  • 想先快速试一下、能接受在本地或自有环境跑服务的人。

不太适合

  • 不方便管理密钥或第三方授权的人。
  • 需要厂商级 SLA 和技术支持的生产环境。

同类对比

6 个同类
同分类里挑最接近的几条,字段以各自详情页为准
MCP 服务器工具数传输方式部署方式安装命令最后核验
Contextforge当前 未标注 未标注 未标注 无 未标注
dify 未标注 stdio · 本地进程 本地部署 有 2026-04-11
open-webui 未标注 stdio · 本地进程 本地部署 有 2026-04-11
JeecgBoot 未标注 stdio · 本地进程 本地部署 有 2026-04-11
Cherry Studio 未标注 未标注 未标注 无 2026-05-17
mempalace 未标注 stdio · 本地进程 本地部署 有 2026-04-11

服务器档案

文档知识
字段来自项目仓库与公开索引,中文说明由本站标注
提供方alfredoizdev上游标注的维护方 alfredoizdev
分类文档知识本站按上游分类展示
连接方式未标注上游未给出传输方式
鉴权方式API Key远程服务建议用最小权限凭据
维护方社区 / 第三方核验等级 仅资料核对
包名 / 运行时未标注 · Cross-platform本地安装时用到的包标识与运行时
部署类型未标注上游给出的部署形态
最近核验未标注上游最后核验时间

详细介绍

16.9 KB
来自项目仓库与上游目录的原文,未做删改

ContextForge MCP — Persistent Memory for Claude, Cursor & Copilot

> Give Claude Code, Cursor, and GitHub Copilot persistent memory across sessions via the Model Context Protocol (MCP). Stop re-explaining your project every time.

ContextForge MCP is an open-source MCP server that connects your AI coding assistants to long-term, searchable memory. Decisions, architecture notes, debugging context, and project knowledge stay available across every session — across every tool that supports MCP.

  • 🧠 Persistent memory — your AI remembers everything across sessions, days, and weeks
  • 🔍 Semantic search — find knowledge by meaning, not keywords
  • 🔗 One memory, every tool — Claude Code, Cursor, Copilot, Claude Desktop, Windsurf
  • 🐙 Git integration — sync commits and PRs automatically
  • ✅ Task tracking — issues, assignments, and project status
  • 👥 Team collaboration — share projects and memory with your team
  • 🆓 Free tier — get started without a credit card

> [!NOTE]
> Works automatically, no config needed (v0.5.1+). On connect, the server sends startup instructions to your AI client. Clients that honor them (Claude Desktop, Claude Code) load your project memory at the start of every session and save new decisions proactively — without you editing any settings. Running init (Step 4) is now a reinforcement, not a requirement, and still helps on clients that don't yet honor server instructions (e.g. Cursor).


Quick Start

1. Install

No install step needed — the setup below runs the server via npx -y contextforge-mcp, which fetches it on demand and keeps it up to date.

> Prefer a global install for slightly faster cold starts? npm install -g contextforge-mcp is optional; if you do it, you can drop the npx -y prefix from the commands below.

2. Get your API key

  1. Go to contextforge.dev
  2. Sign up (free tier available)
  3. Settings → API Keys → Generate API Key
  4. Copy your key (starts with cf_)

3. Connect to your AI tool

Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json:```json
{
"mcpServers": {
"contextforge": {
"command": "npx",
"args": ["-y", "contextforge-mcp"],
"env": {
"CONTEXTFORGE_API_KEY": "your-api-key-here"
}
}
}
}


Restart Claude Desktop.

#### Claude Code (CLI)```bash
claude mcp add contextforge -s user \
  -e CONTEXTFORGE_API_KEY=your-api-key-here \
  -- npx -y contextforge-mcp

Restart Claude Code and run /mcp to verify it's connected.

Cursor

Add to your Cursor MCP settings:```json
{
"mcpServers": {
"contextforge": {
"command": "npx",
"args": ["-y", "contextforge-mcp"],
"env": {
"CONTEXTFORGE_API_KEY": "your-api-key-here"
}
}
}
}


#### GitHub Copilot (VS Code)

Add to your Copilot MCP config:```json
{
  "servers": {
    "contextforge": {
      "command": "npx",
      "args": ["-y", "contextforge-mcp"],
      "env": {
        "CONTEXTFORGE_API_KEY": "your-api-key-here"
      }
    }
  }
}

4. Initialize your project (recommended)

> With v0.5.1+ the server auto-loads memory on supporting clients (see the note at the top), so this step is optional but recommended: it reinforces the behavior, covers clients that don't honor server instructions, and fully overrides the built-in file-based memory.

Set up your project so your AI editor always prefers ContextForge memory:```bash
npx contextforge-mcp init


By default, `init` auto-detects which editor your project uses and writes three rule sections and two hooks:

- **Memory rules** — route memory questions to ContextForge instead of the built-in file memory
- **Session Presence rules** — make parallel sessions check for each other at conversation start and before big changes
- **Startup Context rules** — load a short project summary (overview, open tasks, live sessions) from ContextForge at the start of every conversation
- **Post-compaction recall hook** (Claude Code only) — a `SessionStart` hook with matcher `compact` in `.claude/settings.json`. When Claude Code compacts a long conversation, the hook runs `npx -y contextforge-mcp recall` and re-injects the session objective, memories relevant to what you are working on, your project's 10 most recent memories and pending tasks, so decisions saved in ContextForge survive the summary.
- **Session objective hook** (Claude Code only, 0.13.0) — a `UserPromptSubmit` hook that runs the generated script `.claude/hooks/contextforge-objective.cjs` with plain `node` (~50 ms). It records your prompts to `~/.contextforge-mcp/sessions/.jsonl` on your machine, so `recall` can put the session's objective back after a compaction. The log is pruned after 14 days and never uploaded; see the privacy note below for what `recall` sends.

Files written:

- `CLAUDE.md` for Claude Code (signals: existing `CLAUDE.md` or `.claude/` directory)
- `.cursorrules` for Cursor (signals: existing `.cursorrules` or `.cursor/` directory)
- `.claude/settings.json` for Claude Code — merged, never overwritten; only the two ContextForge hook groups are added
- `.claude/hooks/contextforge-objective.cjs` for Claude Code — the generated objective hook script (safe to commit; refreshed by `init` when a new version ships; Claude Code's own system turns — prompts that start with an XML-like tag and contain a closing tag — are not logged)

If no editor is detected, both files are generated.

On clients that honor server instructions (Claude Desktop, Claude Code), ContextForge is used automatically even without this step. On other clients — or to guarantee the built-in file-based auto-memory never wins — run `init`: it writes explicit rules that always route memory to ContextForge.

#### Override with `--editor`

| Flag | Behavior |
|---|---|
| `--editor=claude` | Generate only `CLAUDE.md` |
| `--editor=cursor` | Generate only `.cursorrules` |
| `--editor=all` | Generate both, skip detection |

Re-running `init` is idempotent **per section** — sections you already have are left untouched; missing ones are appended. Upgrading from an older version? Just re-run `npx contextforge-mcp init`: it adds the new Startup Context section without touching the rest of your file.

#### Check your version```bash
npx contextforge-mcp --version   # also: -v, version

Prints the installed version (e.g. contextforge-mcp 0.5.2).

Surviving compaction (Claude Code)

Long sessions get compacted: Claude Code summarizes the conversation to free space, and the summary keeps the gist but drops details — usually the decisions, and often the task itself. init installs two hooks that fix both:

  1. Objective hook (UserPromptSubmit) — records each prompt locally so the session's first real request is never lost to the summary.
  2. Recall hook (SessionStart, matcher compact) — fires right after every compaction and prints back, in this order: the session objective and the latest request before the cut; up to 5 memories relevant to the current work (semantic search over the objective, git branch, recent commit subjects and changed files, whatever their age); the project's 10 most recent memories; up to 5 pending tasks; and a reminder to call memory_query for anything older. The whole block stays around 4 KB and is injected once, never pinned, so it does not move the compaction trigger.

The relevance search is one metered query per compaction. It only runs when there is a session objective or you are on a non-default branch (git-only context on main is noise), it runs in parallel with the other fetches under the same 6-second stage deadline, so a slow search can never drop the rest of the block, and CONTEXTFORGE_RECALL_RELEVANCE=0 in the environment turns it off entirely.

The hooks run as plain shell commands, so recall reads your API key from CONTEXTFORGE_API_KEY if set, otherwise from the contextforge server entry in ~/.claude.json (where claude mcp add stores it), otherwise from a project .mcp.json. It needs a linked project (.contextforge in the repo root). If anything is missing it prints nothing and never blocks the session. Note that a CONTEXTFORGE_API_KEY exported in your shell profile wins over ~/.claude.json: if it holds an old key, recall silently prints nothing.

Try it by hand from your project directory:```bash
npx contextforge-mcp recall # prints the block for the newest session in this directory
npx contextforge-mcp recall --stats # local numbers: recalls, objective coverage, follow-up queries


Privacy: the prompt log and the recall stats live under `~/.contextforge-mcp/` on your machine and are never uploaded. What leaves the machine: after a compaction, `recall` sends the session objective (at most 600 characters, together with the git branch, recent commit subjects and changed file names) to ContextForge as the search query, the same way `memory_query` sends a query; it is not stored. Note that `.claude/settings.json` is usually committed, so teammates who pull the repo get the prompt hook too; they can remove the `UserPromptSubmit` group to opt out.

#### Already using ContextForge? (existing users)

Nothing to reconfigure. Update to the latest and restart your AI client:```bash
npm update -g contextforge-mcp   # only if you installed globally; npx users get it on next launch

You do not need to re-run init for the auto-load behavior. To get the post-compaction recall hook and the session objective hook, run npx contextforge-mcp init once in each project; it only adds what is missing. Since 0.13.2 the server reminds you once per project when the recall hook is installed but the objective hook is missing or outdated.


Available Tools

ContextForge defines 69 tools across Knowledge Management, GitHub Integration, Issue Tracking, and Collaboration. No capability was ever removed — every tool below is fully callable — but as of v0.11.0, your AI client sees only 11 of them by default (CONTEXTFORGE_TOOLS=lean, the default):

  • 10 core tools — the ones used on the agent's own initiative every session: memory_query, memory_ingest, memory_check_freshness, memory_confirm, memory_correct, memory_forget, tasks_list, tasks_what_next, session_list, memory_help.
  • cf_tools — one gateway tool that discovers and runs the other 59. Ask your AI naturally ("sync my git commits", "restore from a snapshot", "olvida ese recuerdo viejo") and it searches (English or Spanish) and calls the right tool for you — no need to know an exact name.

Set CONTEXTFORGE_TOOLS=full to expose all 69 tools directly to your client instead, matching the behavior of versions before 0.11.0. See Environment Variables.

Why lean by default: 69 tool schemas cost ~15,000 tokens of context on every session, push past Cursor's 40-tool cap, and contribute to the accuracy degradation several clients show past ~50 tools. The lean set cuts that to ~3,500 tokens (~77% less) while keeping every tool one call away via cf_tools.

Knowledge Management

Tool Description
memory_ingest Save knowledge to memory
memory_query Search your knowledge semantically
memory_list_items List all stored items
memory_delete Remove specific items
memory_ingest_batch Save multiple items at once
memory_delete_batch Delete items by filter

Spaces & Projects

Tool Description
memory_list_spaces List your spaces
memory_create_space Create a new space
memory_delete_space Delete a space
memory_move_space Move space to project
memory_list_projects List your projects
memory_create_project Create a new project
memory_delete_project Delete a project
memory_link_project Link directory to project
memory_unlink_project Unlink directory
memory_current_project Show linked project

GitHub Integration

Tool Description
memory_git_connect Connect a GitHub repo
memory_git_list List connected repos
memory_git_activate Activate/deactivate webhook
memory_git_sync Import existing history
memory_git_commits List synced commits
memory_git_prs List synced PRs
memory_git_disconnect Disconnect a repo

Issue Tracking

Tool Description
issues_list List your issues
issues_create Create a new issue
issues_start Mark as in progress
issues_resolve Mark as resolved
issues_resolve_by_name Resolve by title
issues_assign Assign to collaborator
issues_what_next Get recommendation

Collaboration

Tool Description
project_share Share project by email
collaborators_list List collaborators

Snapshots & Export

Tool Description
memory_snapshot_create Create a backup
memory_snapshot_list List all snapshots
memory_snapshot_restore Restore from backup
memory_snapshot_delete Delete a snapshot
memory_export Export to JSON/MD/CSV
memory_import Import from file

Utility

Tool Description
memory_stats View usage statistics
memory_relate Link two items
memory_help Show help

Session Presence (multi-session coordination)

Running several Claude Code sessions in parallel (worktrees, agent teams)?
Each MCP process automatically registers itself as a live session and
heartbeats while it runs. On a clean exit the session is removed at once
(a detached helper delivers the goodbye even while the host process is
being killed); if the process dies hard, the session expires ~10 minutes
after its last heartbeat. Three tools let the agent coordinate — session_list
is a core tool and always visible; session_update and session_end are
reached through the cf_tools gateway by default (or set
CONTEXTFORGE_TOOLS=full to see all three directly):

Tool What it does
session_update Declare what this session is working on ("working on the auth module")
session_list See other live sessions in the same project and their focus before touching shared areas (pass all_projects: true for the whole org)
session_end Explicitly end this session's presence (also automatic on exit)

By default session_list is scoped to the current project — where work
actually collides. In a multi-project organization, pass all_projects: true
to see every session, or project: "" to scope elsewhere.

Recommended pattern for your CLAUDE.md: call session_list when a
conversation starts; call session_update when starting or switching tasks.


Natural Language Examples

You don't need to memorize commands — just talk naturally to your AI:```

Knowledge

"Save this: we use PostgreSQL for the main database"
"What database do we use?"
"List my spaces"

GitHub

"Connect my repo github.com/myuser/myproject"
"What commits did I make today?"
"Show PRs merged this week"

Issues

"Create an issue: Update the login page design"
"What's pending?"
"What should I work on next?"
"Mark the login issue as done"


---

## Environment Variables

| Variable | Required | Description |
|----------|----------|-------------|
| `CONTEXTFORGE_API_KEY` | Yes | Your API key from the dashboard |
| `CONTEXTFORGE_API_URL` | No | API endpoint (defaults to production) |
| `CONTEXTFORGE_DEFAULT_SPACE` | No | Default space for operations |
| `CONTEXTFORGE_TOOLS` | No | `lean` (default) exposes 11 tools — the 10 most-used plus the `cf_tools` gateway to the other 59. `full` exposes all 69, as versions before 0.11.0 did. Lean keeps ContextForge under Cursor's 40-tool cap and Claude Code's 50-tool degradation threshold. |

---

## How it works

ContextForge MCP is a thin client that translates Model Context Protocol tool calls into authenticated HTTP requests against the ContextForge API. Your knowledge is stored, indexed (semantic embeddings), and retrieved on the server side — the MCP client itself is stateless.

This means:
- **No infra to manage** — no local databases, no embeddings to run, no vector stores to maintain
- **Works everywhere your AI works** — same memory across Claude Code, Cursor, Copilot, etc.
- **Team collaboration** — shared projects sync in real time

---

## Dashboard

Manage your memory visually at **contextforge.dev**:

- View and organize your knowledge
- Search and filter memories
- Manage API keys and billing
- Track issues and collaborate
- Export and backup data

---

## Development```bash
# Clone and install
git clone https://github.com/alfredoizdev/contextforge-mcp.git
cd contextforge-mcp
npm install

# Build
npm run build

# Run tests
npm test

# Watch mode
npm run dev

Contributing

Issues and pull requests are welcome at github.com/alfredoizdev/contextforge-mcp.


Support

  • 📖 Documentation
  • 🐛 Report Issues
  • 💬 Questions: support@contextforge.app

License

MIT © Alfredo Izquierdo

常见问题

7 问
答案由本站依据条目字段整理,不引用上游原文
Contextforge 怎么安装?

资料没有给出安装命令,请到官方仓库或文档按说明接入;这类条目多数是生态应用,或尚未发布可安装包。

Contextforge 怎么在 Claude Desktop、Claude、Cursor 里配置?

它的传输方式未标注,在客户端的 MCP 配置里填好启动命令和参数,保存后完全退出客户端再打开,配置才会生效。

Contextforge 收费吗?

本站不代收费用,也没有标注具体价格。是否收费取决于服务本身和背后的接口额度,正式使用前按官方说明确认。

Contextforge 需要 API Key 吗?

资料标注需要API Key认证,使用前准备好对应凭据,并按最小权限配置。

Contextforge 支持哪些客户端?

资料标注支持 Claude Desktop、Claude、Cursor、VS Code、Windsurf、Codex;其他客户端只要能配置 MCP Server,也能用同样的命令或地址接入。

Contextforge 能提供哪些能力?

资料显示能力标签包括 memory、claude、context、developer tools、git、collaboration。具体工具清单以官方文档为准。

Contextforge 需要什么运行环境?

运行时为 Cross-platform。

热门专题

按标签挑服务器
全部专题 →

服务器信息以作者仓库与官方文档为准;分类、传输方式与鉴权方式的中文说明为中文整理,最近核验 未标注。