Token导航 LogoToken导航TokenDH.com
context42 (Context42 Io) logo
搜索检索stdio官方级别未说明来源级核验

context42 (Context42 Io)

MCP Server

Context42是一个开源的MCP服务器,为AI助手提供对个人文档和编码指南的语义搜索功能,完全离线运行。

工具数

1

提示词数

0

GitHub Stars

2

资源数

0
搜索PythonClaudeClaude DesktopClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

Context42-io

提供方

Context42-io

最后核验

2026/5/17 20:20

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

uvx context42-io

详细介绍

Context42

Your coding standards, always in context.

An open-source MCP server that gives your AI assistant semantic search over your personal documentation and coding guidelines. 100% offline.

Website · Documentation · Issues

______________________________________________________________________

为什么是Context42?

你的AI助手不知道你团队的编码惯例。每个会话都从零开始——你的标准丢失了,文档分散在wiki和README中,将整个文档粘贴到提示中会浪费令牌。

Context42通过在本地为您的文档建立索引,并通过以下方式将最相关的块提供给您的AI助手来解决这个问题 主控程序 --自动、语义和 没有任何数据离开您的机器.

运作原理

  1. 添加 将文档目录作为源
  2. 索引 --Context42将文档分块并创建局部向量嵌入
  3. 商店 --矢量保存在LanceDB中的本地
  4. 服务 --您的AI助手通过MCP查询相关内容,按优先级加权

安装

需要 Python 3.11+

# Using pipx (recommended)
pipx install context42-io

# Using uv
uvx context42-io

# Using pip
pip install context42-io

快速开始

# 1. Add your documentation
c42 add ~/my-coding-standards --name standards --priority 0.9

# 2. Index the content
c42 index

# 3. Start the MCP server
c42 serve

Claude桌面集成

添加到您的Claude Desktop配置文件中:

平台路径
Linux~/.config/claude/claude_desktop_config.json
macOS~/Library/Application Support/Claude/claude_desktop_config.json
窗户%APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "context42": {
      "command": "c42",
      "args": ["serve"]
    }
  }
}

添加配置后重新启动Claude Desktop。

CLI参考

添加和索引源

c42 add 
 --name                  # Add a documentation source
c42 add 
 --name  --priority 0.9  # Add with priority (0.1–1.0)
c42 add 
 --name  --exclude "*.log,tmp/*"  # Exclude file patterns
c42 index                                    # Index all pending sources

管理资源

c42 list                        # List all sources with status
c42 set-priority   # Change source priority
c42 remove                # Remove a source
c42 status                      # Show index statistics

搜索和服务

c42 search "error handling"     # Search from the CLI
c42 serve                       # Start the MCP server
c42 --help                      # Show all available commands

优先级系统

为您的个人指示设置更高的优先级,使其优先于参考文档:

# Your rules — highest weight
c42 add ~/my-standards --name standards --priority 1.0

# Team guidelines — medium weight
c42 add ~/team-docs --name team --priority 0.7

# Reference docs — lower weight
c42 add ~/library-docs --name reference --priority 0.4

搜索结果按优先级加权,因此您的个人偏好始终显示在第一位。

支持格式

格式扩展名注释
Markdown.md完全支持CommonMark
重新结构化文本.rstSphinx兼容

计划更多格式--请参阅 路线图.

MCP工具

Context42公开了一个 search 通过MCP工具:

search(query: string, top_k?: int) → SearchResult[]

每个结果包括:

  • text --匹配的内容块
  • source --来源名称
  • file --文件的相对路径
  • score --相似性得分(0-1,越高=相关性越高)
  • priority --源优先级权重
  • is_prioritytrue 如果源的优先级≥0.8

配置

Context42开箱即用,无需配置。以下所有设置都是可选的:

变量默认值描述
C42_EMBEDDING_MODELBAAI/bge-small-en-v1.5句子变换器嵌入模型
C42_CHUNK_SIZE500每块字符数
C42_BATCH_SIZE50每个索引批次的块数
C42_DATA_DIR平台默认数据存储目录
HF_TOKEN--拥抱Face代币,加快模型下载速度
# Example: use a different embedding model
export C42_EMBEDDING_MODEL="BAAI/bge-base-en-v1.5"

# Optional: set HuggingFace token for faster downloads
export HF_TOKEN="hf_your_token_here"
注: 更改嵌入模型需要重新索引所有源(c42 index).

获取您的HF代币:https://huggingface.co/settings/tokens

数据存储

平台路径
Linux~/.local/share/context42/
macOS~/Library/Application Support/context42/
窗户%LOCALAPPDATA%\context42\

安全与隐私

Context42在本地处理所有内容。你的代码和文档永远不会离开你的机器。

  • 零数据传输 --无出站网络呼叫
  • 仅本地嵌入 --AI模型在CPU上运行,不向外部API发送令牌
  • 无遥测 --没有分析,没有事故报告,没有电话回家行为
  • 工作气隙 --初始设置后,不需要互联网连接

了解更多信息,请访问 上下文42.io.

路线图

  • \[ \] Git克隆源 --将任何Git存储库添加为源
  • \[ \] 文件监视器 --磁盘上文件更改时自动重新索引
  • \[ \] Git同步 --检测新提交并自动重新索引

查看所有计划中的功能并建议新功能 .

贡献

欢迎投稿!请随意:

许可证

麻省理工学院

目录标签

目录标签

搜索PythonClaude语义搜索本地部署AI助手离线服务编码规范文档管理

支持客户端

Claude DesktopClaude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

token

运行时(runtime,运行环境)

Python

工具数量(toolCount,工具数)

1

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdiotoken部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP