Osmcp

io.github.KrushnaVardhanReddy由 GitHub 账号 KrushnaVardhanReddy 发布v1.0.5更新于 Oct 24, 2026

A typed, policy-controlled OS capability layer for AI agents.

已验证STDIO仅桌面文件与存储开发者工具

概览

AI 生成的概览

一个本地 MCP 服务器,在策略约束下为 AI 助手提供文件系统、git 和文本处理工具,并记录审计日志。

可以做什么
在允许的根目录内搜索和查看文件:grep、find、ls、cat、stat、wc、head、tail、tree、du。读取 git 状态:status、diff、log。处理文本与数据:jq、sed、diff。启用变更后写入、追加、建目录、删除、移动、复制和打补丁文件。启用变更后执行 git 暂存、提交、切换、分支、拉取和推送。每次调用返回统一类型化响应并写入仅追加的审计日志。
适用场景
适合让助手读取和修改你机器上某个项目目录中的代码或文件,或查看并提交 git 变更,同时把操作限制在设定的路径边界和工具白名单内。
运行要求
以本地进程通过 stdio 运行,可通过 Homebrew 安装、从源码构建或使用容器镜像。需要通过 --policy 参数提供 TOML 策略文件,设置 allowed_root、allowed_tools、变更开关和各项限制。未声明账号、API 密钥或环境变量。
安装前请注意
变更类工具(写入、删除、移动、复制、打补丁、git 提交、推送)会改动文件和仓库;不需要时应保持 allow_mutation 为 false 并限制 allowed_tools。git_push 和 git_pull 会访问远程仓库。审计日志记录每次调用,请谨慎选择其输出位置和路径。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Osmcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

osmcp — OS Capabilities for AI Agents

A typed, policy-controlled OS capability layer for AI agents via the Model Context Protocol (MCP).

osmcp exposes a curated set of safe filesystem, git, and text-processing tools to AI agents — all governed by a strict Policy Engine that enforces path boundaries, tool allowlists, output limits, mutation controls, and an immutable audit trail.

📖 Read the comprehensive Architecture & Design Document for a deep dive into the philosophy, safety boundaries, and design decisions behind osmcp.

[LiteLLM Compatible] [Smithery Verified]

Features

CategoryToolsPhase
🔍 Searchgrep, find1
📁 File Inspectionls, cat, stat, wc, head, tail1
🌳 Filesystemtree, du1
🔀 Git Intelligencegit_status, git_diff, git_log1
🔧 Transformjq, sed, diff1
✍️ File Mutationwrite_file, append_file, mkdir, rm, mv, cp, patch2
🚀 Git Mutationgit_add, git_commit, git_checkout, git_branch, git_pull, git_push2

Architecture

AI Agent (Claude, GPT, etc.)    │  MCP JSON-RPC (stdio)    ▼osmcp binary    ├── Policy Engine      ← enforces allowed_root, allowed_tools, limits    ├── Audit Logger       ← append-only NDJSON log of every invocation    ├── Tool Registry      ← self-registering tools via RegisterMCP()    └── Envelope Builder   ← typed {ok, data, error, meta} responses

Demo

[osmcp Demo Action] A demonstration of Claude Desktop securely editing code via osmcp, safely bounded by a TOML policy engine.

Quick Start

1. Install via Homebrew

bash
brew tap KrushnaVardhanReddy/tapbrew install osmcp

Alternatively, build from source:

bash
make build# Binary: bin/osmcp

2. Configure a Policy

toml
# policy.toml[policy]allowed_root   = "/home/user/myproject"allowed_tools  = ["grep", "ls", "cat", "git_status", "git_log"]allow_mutation = false
[limits]timeout_ms       = 5000max_output_bytes = 1048576max_matches      = 100
[audit]destination = "stderr"   # or "file"path        = "/var/log/osmcp-audit.ndjson"

3. Run

bash
bin/osmcp --policy policy.toml

The binary communicates over stdio using MCP JSON-RPC. Connect any MCP-compatible client.

Client Integrations

Claude Desktop

Add the following to your claude_desktop_config.json:

json
{  "mcpServers": {    "osmcp": {      "command": "osmcp",      "args": ["--policy", "/absolute/path/to/policy.toml"]    }  }}

Smithery (npx)

To install osmcp for Claude Desktop automatically via Smithery:

bash
npx @smithery/cli install osmcp

LiteLLM

Integrate osmcp into your enterprise LLM proxy using the LiteLLM MCP Gateway.

5. Test

bash
make test     # unit testsmake e2e      # end-to-end tests against real binarymake lint     # golangci-lint

Policy Security Model

  • allowed_root — All filesystem paths are validated to be inside this root. Traversal outside is blocked with POLICY_DENIED.
  • allowed_tools — Only tools in this list are visible to the MCP client. Unlisted tools do not appear in tools/list.
  • allow_mutation — When false, mutating tools (write, delete, git commit) are globally blocked.
  • Limits — Per-invocation timeout, output byte cap, and match count cap prevent runaway operations.

Envelope Response Format

All tool responses follow a consistent typed envelope:

json
{  "ok": true,  "tool": "grep",  "data": { ... },  "error": null,  "meta": {    "execution_time_ms": 12,    "truncated": false  }}

License

MIT

Acknowledgements

osmcp would not be possible without the incredible open-source libraries it is built upon:

  • mcp-go for the core Model Context Protocol SDK.
  • go-git for pure Go git manipulation.
  • gojq for pure Go JSON processing.
  • go-gitdiff for parsing and applying patches.
  • grep-go for regular expression searching.
  • toml for configuration parsing.

来源:README.md,提交 3e5c928

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v1.0.5最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分