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 分