Git代理服务

通过MCP工具暴露Git功能的代理服务,用于开发工具和UI间接调用Git操作。

  • by PloinkyRepos
  • JavaScript
  • 本地部署
  • 更新于
在 GitHub 查看 PloinkyRepos/gitMCP

使用说明

gitAgent

Ploinky Git代理,通过MCP工具公开Git功能。资源管理器和其他UI调用 gitAgent 而不是直接运行Git。

详细代理文件:

概述

  • MCP工具定义见 mcp-config.json.
  • 工具执行通过以下路径进行 tools/git_tool.mjs.
  • Git逻辑存在于 lib/git-service.mjs.
  • 提交消息生成用途 lib/git-commit-message.js (以法学硕士为基础)。

可用的MCP工具

  • git_info, git_status, git_diff
  • git_stage, git_unstage, git_untrack, git_check_ignore, git_restore
  • git_conflict_versions, git_checkout_conflict
  • git_stash, git_stash_pop
  • git_commit, git_push, git_pull, git_diagnose
  • git_repos_overview, git_identity, git_set_identity
  • git_commit_message

请求示例

将POST JSON-RPC与MCP一起使用:

{
  "jsonrpc": "2.0",
  "id": "1",
  "method": "tools/call",
  "params": {
    "name": "git_status",
    "arguments": {
      "path": "/path/to/workspace/.ploinky/repos/fileExplorer"
    }
  }
}

示例响应

{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "content": [
      {
        "type": "text",
        "text": "{\"ok\":true,\"status\":{...}}"
      }
    ]
  }
}

环境

代理在验证路径时尊重这些根:

  • ASSISTOS_FS_ROOT
  • WORKSPACE_ROOT
  • PLOINKY_WORKSPACE_ROOT

备注

  • git_commit_message 需要通过以下方式进行LLM配置 achillesAgentLib (从加载 node_modules).
  • 路径必须在允许的根内。接受绝对路径或工作空间相对路径。