GitHub Copilot历史会话搜索工具

一个用于搜索和管理GitHub Copilot历史会话的工具,提供全文搜索、会话统计和文件引用查找等功能。

  • by MicroMichaelIE
  • Python
  • 本地部署
  • 4 星标
  • 更新于
在 GitHub 查看 MicroMichaelIE/mcp-copilotcli-history

使用说明

mcp副作用历史

MCP服务器,提供搜索GitHub Copilot对话历史记录的工具,存储在 ~/.copilot/session-state/.

特性

  • 搜索会话:在所有副驾驶对话中进行全文搜索
  • 列出最近的会话:使用从第一条用户消息中提取的标题查看最近的会话
  • 会话统计信息:获取有关您的Copilot使用情况的汇总统计数据
  • 查看对话:阅读任何会话的完整对话
  • 按文件搜索:查找引用特定文件的会话
  • 搜索工具使用:查找工具使用示例

安装

使用uvx(推荐)

使用时 uv 不需要特定的安装:

uvx mcp-copilotcli-history

使用pip

pip install mcp-copilotcli-history

安装后,作为模块运行:

python -m mcp_copilotcli_history

配置

为Claude桌面配置

添加到您的 claude_desktop_config.json:

Using uvx
{
  "mcpServers": {
    "copilot-history": {
      "command": "uvx",
      "args": ["mcp-copilotcli-history"]
    }
  }
}
Using pip installation
{
  "mcpServers": {
    "copilot-history": {
      "command": "python",
      "args": ["-m", "mcp_copilotcli_history"]
    }
  }
}

配置VS代码

将配置添加到用户级MCP配置文件中。打开命令选项板(Ctrl + Shift + P)然后跑 MCP: Open User Configuration.

Using uvx
{
  "servers": {
    "copilot-history": {
      "command": "uvx",
      "args": ["mcp-copilotcli-history"]
    }
  }
}
Using pip installation
{
  "servers": {
    "copilot-history": {
      "command": "python",
      "args": ["-m", "mcp_copilotcli_history"]
    }
  }
}

为Zed配置

添加到您的Zed settings.json:

"context_servers": {
  "copilot-history": {
    "command": "uvx",
    "args": ["mcp-copilotcli-history"]
  }
}

可用工具

搜索会话

在所有Copilot会话历史中搜索模式。

论据:

  • query (必填):搜索词或正则表达式模式
  • event_type (可选):按事件类型筛选(user.message、assistant.message等)
  • max_results (可选):返回的最大结果数(默认值:20)
  • case_sensitive (可选):区分大小写的匹配(默认值:false)

list_recent_sessions

列出最近的Copilot会话及其标题。

论据:

  • limit (可选):要返回的最大会话数(默认值:10)

get_session_stats

获取所有Copilot会话历史的统计信息。

get_session_conversation

从特定会话中获取对话。

论据:

  • session_id (必填):会话ID(完整或部分)
  • include_tool_calls (可选):包括工具调用详细信息(默认值:false)
  • max_messages (可选):要返回的最大消息数(默认值:50)

搜索_文件_路径

查找引用特定文件或路径模式的会话。

论据:

  • file_pattern (必填):要搜索的文件路径或模式
  • max_results (可选):最大结果(默认值:20)

搜索工具用法

查找使用特定工具的会话。

论据:

  • tool_name (可选):要筛选的工具名称
  • max_results (可选):最大结果(默认值:20)

示例用例

配置后,您可以向AI助手提出以下问题:

  • “搜索我的副驾驶历史记录,了解有关地形的讨论”
  • “这周我参加了哪些课程?”
  • “查找我在main.py上工作的对话”
  • “我以前是如何使用create_file工具的?”
  • “显示会话abc123中的对话”

调试

使用MCP检查器进行调试:

npx @modelcontextprotocol/inspector uvx mcp-copilotcli-history

许可证

麻省理工学院