Skip to main content
Glama

Title

一个 MCP 服务器,为 AI 助手(Cursor、Claude Desktop 或你自己的语音助手)提供访问本地 git 仓库的能力。

读操作可以自由运行。任何写操作都会先返回一个确认令牌和一段通俗易懂的摘要,并且只有在第二次携带该令牌调用时才会真正执行。助手在提交之前会先征求确认。

You:  commit my changes in api-service with message "fix auth timeout"
LLM:  Commit 3 changed files in api-service with message 'fix auth timeout'. Confirm?
You:  yes
LLM:  Committed — a4f21c9 fix auth timeout

为什么

大多数文件系统 MCP 服务器会让模型对目录树拥有不受限制的读写权限。当你盯着每一次工具调用时,这没有问题;但当模型正在驱动语音助手、无人值守运行,或者刚刚听错了你的话时,这就很麻烦。

otama 假设模型偶尔会犯错,并把后果降到足够低:

  • 路径沙箱。 乐投每个路径都会在与你配置的根目录比对之前解析。..、符号链接和绝对路径都无法逃逸。

  • 两阶段确认。 没有令牌调用的写入和执行工具只是描述它们会做什么,不会真正执行。令牌一次有效,两分钟后过期,并且只与发出该令牌的工具绑定。

  • 集合单。 run_command 直接拒绝任何不在清单中的命令,而不是提供确认。一次听错永远不应该让 rm -rf 距离执行只有一句“是”。

Related MCP server: Git MCP Server

安装

需要 Python 3.11+,并且 git 已在 PATH 中。

git clone https://github.com/Ronith2906/otama.git
cd otama
python -m venv .venv
.venv/bin/pip install -r requirements.txt          # Windows: .venv\Scripts\pip.exe
cp otama.example.toml otama.toml

编辑 otama.toml,将 project_roots 设置为包含你的仓库的目录。在 Windows 上使用正斜杠。

[projects]
project_roots = ["C:/Users/you/code"]

验证:

.venv/bin/python -c "import asyncio; from projects_server import otama; print([t.name for t in asyncio.run(otama.list_tools())])"

出现十个工具名称,说明你就成功运行了。

连接

Cursor~/.cursor/mcp.jsonClaude Desktopclaude_desktop_config.json(设置 → 开发者 → 配置)。两者的配置文件结构相同:

{
  "mcpServers": {
    "otama-projects": {
      "command": "/absolute/path/to/otama/.venv/bin/python",
      "args": ["/absolute/path/to/otama/projects_server.py"]
    }
  }
}

在 Windows 上,JSON 路径请使用 \\C:\\Users\\you\\otama\\.venv\\Scripts\\python.exe

请完全重启应用;仅仅重新加载不够,MCP 服务器在启动时才会加载。

工具

读取 — 立即运行

工具

返回

list_projects

你根路径下的每个仓库或文件夹,并带 is_git_repo 标志

project_tree

两层目录树,跳过 node_modules.venvdist 等目录

read_file

读取一个文本文件,有大小限制

search_code

对项目执行正则搜索,返回文件与行号

git_status

分支、未提交的文件、最近五个提交

git_diff

工作区差异,已截断

daily_brief

最近 N 天内每个仓库中发生的变更

写入并执行 — 需要确认

工具

作用

git_commit

暂存所有并提交

write_file

创建或覆盖文件

run_command

运行一条白名单中的开发命令

配置

[projects]
project_roots            = ["C:/Users/you/code"]
max_file_bytes           = 200000   # refuse to read anything larger
command_timeout_seconds  = 120
confirmation_ttl_seconds = 120      # how long a token stays valid

# run_command refuses anything not on this list. This is not something a
# confirmation can override — add what you actually use.
allowed_commands = ["git","npm","npx","pnpm","yarn","node",
                    "python","py","pip","pytest","ruff","uv",
                    "dotnet","cargo","go"]

给贡献者的说明

两阶段模式体现在 stage()redeem()_expire() 中。如果你为工具添加副作用,请使用它。

一个值得特别注意的位置:redeem() 在工具类型不匹配时不会消耗令牌。模型如果误调用了错误工具,绝不能把用户已经批准的令牌用掉,从而强迫重新确认。这是一个在测试中发现的真实 bug。

新的能力服务器应遵循同样的结构——一个文件、一个领域,读工具免费,写工具需要审批,超出范围时直接拒绝而不是请求确认。

进展

早期阶段。项目服务器已经经过测试并处于日常使用状态;更多能力服务器(媒体、邮件、浏览器)计划作为更大的语音助手项目的一部分。欢迎提交 issue 和 PR。

许可证

MIT

A
license - permissive license
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    Not graded
    maintenance
    A lightweight MCP server that enables AI assistants to manage local Git repositories by executing commands like status, add, and commit. It streamlines development workflows by providing repository context and diffs directly to the assistant.
  • A
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that provides tools for interacting with Git repositories, enabling AI assistants to manage repositories, branches, commits, and files through a standardized interface.
    3,703
    1
    Apache 2.0
  • F
    license
    Not graded
    quality
    D
    maintenance
    A local MCP server that turns AI clients into power users of local git repositories, enabling clone, browse, search, and inspect code without burning API tokens.
  • F
    license
    B
    quality
    B
    maintenance
    A lightweight MCP server that acts as a secure proxy for AI assistants to run local Git operations and GitHub API macros simultaneously.
    1

View all related MCP servers

Related MCP Connectors

  • An MCP server that gives your AI access to the source code and docs of all public github repos

  • A MCP server built for developers enabling Git based project management with project and personal…

  • Driflyte MCP server which lets AI assistants query topic-specific knowledge from web and GitHub.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Ronith2906/Otama'

If you have feedback or need assistance with the MCP directory API, please join our Discord server