Claude代码的ConPort+MCPorter技能
Claude Code的持久项目内存,无需MCP服务器膨胀。
问题
直接在Claude Code中安装MCP服务器有一个隐藏的成本: 工具描述膨胀.
ConPort MCP单独暴露 25+工具,每个都有详细的JSON模式,在每次请求时都会使用Claude的上下文窗口——即使你没有使用它们。这会浪费令牌,并可能挤出实际的对话上下文。
解决方案
使用 MCPorter 改为通过CLI访问ConPort:
npx mcporter call --stdio "uvx --from context-portal-mcp conport-mcp --mode stdio" conport.get_product_context工具被调用 按需 通过技能,不总是出现在上下文中。
效益比较
| 方面 | 直接安装MCP | MCPorter+技能 |
|---|---|---|
| 上下文中的工具描述 | 始终(25+个工具) | 从不 |
| 每个请求的令牌开销 | ~2000+个令牌 | 0个令牌 |
| 需要配置 | MCP服务器设置 | 无(npx) |
| 工具可用性 | 即时 | 通过CLI按需提供 |
| 上下文窗口影响 | 显著 | 最小 |
包含内容
技能
- 麦克波特 -任何MCP服务器的通用MCPorter CLI访问
- 通讯存储器 -ConPort特定的命令和工作流
Slash命令
/conport-init-初始化项目的ConPort数据库/conport-context-加载并显示当前项目上下文/conport-decision-记录架构决策及其基本原理/conport-pattern-记录可重用的系统模式/conport-link-在项目之间创建知识图链接/conport-export-将所有上下文导出到markdown文件
子代理
- 档案保管员 -用于复杂ConPort查询的自治代理
先决条件
- 克劳德代码CLI
- Node.js(适用于npx)
- 带uvx的Python(用于ConPort MCP)
如果需要,安装uvx:
pip install uvx
# or
pipx install uvx安装
1.复制技巧
cp -r skills/* ~/.claude/skills/2.复制命令
cp commands/* ~/.claude/commands/3.添加子代理(可选)
从添加子代理定义 subagents/conport-archivist.md 你的 ~/.claude/CLAUDE.md 文件。
快速开始
初始化项目
/conport-init这创建了一个 context_portal/context.db SQLite数据库,并提示您输入项目详细信息。
在会话开始时加载上下文
/conport-context显示器:
- 项目概述(产品背景)
- 当前焦点(活动上下文)
- 待处理工作(进行中项目)
- 最近的决定
记录决策
/conport-decision Use PostgreSQL for the database出口交接
/conport-export ./handoff-docs运作原理
MCPorter模式
不要将ConPort安装为MCP服务器:
// NOT THIS - adds 25+ tool descriptions to every request
{
"mcpServers": {
"conport": {
"command": "uvx",
"args": ["--from", "context-portal-mcp", "conport-mcp"]
}
}
}我们使用MCPorter按需调用工具:
# THIS - only invoked when the skill activates
npx mcporter call --stdio "uvx --from context-portal-mcp conport-mcp --mode stdio" \
conport.log_decision summary:"Decision" rationale:"Why"基于技能的激活
这 conport-memory 技能教克劳德:
- 何时使用ConPort(会话开始、决策、任务完成)
- 每个操作的确切MCPorter命令
- 针对不同场景的推荐工作流程
Claude在适当的时候调用该技能,运行CLI命令,并解释结果——所有这些都没有永久的工具存在。
可用的ConPort工具
所有ConPort工具均可通过MCPorter访问:
上下文管理
get_product_context/update_product_contextget_active_context/update_active_context
决策
log_decision/get_decisions/search_decisions_fts
进度跟踪
log_progress/get_progress/update_progress
模式
log_system_pattern/get_system_patterns
知识图谱
link_conport_items/get_linked_items
效用
export_conport_to_markdown/import_markdown_to_conportget_recent_activity_summary/batch_log_items
为何这很重要
Claude Code的上下文窗口非常宝贵。用于工具描述的每个令牌都是不可用于以下对象的令牌:
- 代码
- 对话历史
- 实际解决问题
通过将MCP工具移到技能后面,您可以获得相同的功能,同时大大降低开销。此模式适用于任何MCP服务器,而不仅仅是ConPort。
相关项目
许可证
麻省理工学院
