io.github.KrushnaVardhanReddy/osmcp

السجل الرسمي الذكاء الاصطناعي والوكلاء

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

التثبيت

أضف هذا إلى إعدادات MCP في عميلك (Claude Desktop: claude_desktop_config.json، وCursor: ‏.cursor/mcp.json، ويستخدم VS Code وغيره الصيغة نفسها «mcpServers»).

OCI package ghcr.io/krushnavardhanreddy/osmcp:latest
Claude Code
claude mcp add osmcp -- docker run -i --rm ghcr.io/krushnavardhanreddy/osmcp:latest
إعداد JSON (Claude Desktop وCursor وVS Code)
{
    "mcpServers": {
        "osmcp": {
            "command": "docker",
            "args": [
                "run",
                "-i",
                "--rm",
                "ghcr.io/krushnavardhanreddy/osmcp:latest"
            ]
        }
    }
}

التوثيق

مأخوذ من ملف README للمشروع على GitHub ويُحدَّث أسبوعيًا. تفتح الروابط على GitHub.

المحتويات
  1. osmcp — OS Capabilities for AI Agents
  2. Features
  3. Architecture
  4. Demo
  5. Quick Start
  6. Client Integrations
  7. Policy Security Model
  8. Envelope Response Format
  9. License
  10. Acknowledgements

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.

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

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

Quick Start

1. Install via Homebrew
brew tap KrushnaVardhanReddy/tap
brew install osmcp

Alternatively, build from source:

make build
# Binary: bin/osmcp
2. Configure a Policy
# policy.toml
[policy]
allowed_root   = "/home/user/myproject"
allowed_tools  = ["grep", "ls", "cat", "git_status", "git_log"]
allow_mutation = false

[limits]
timeout_ms       = 5000
max_output_bytes = 1048576
max_matches      = 100

[audit]
destination = "stderr"   # or "file"
path        = "/var/log/osmcp-audit.ndjson"
3. Run
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:

{
  "mcpServers": {
    "osmcp": {
      "command": "osmcp",
      "args": ["--policy", "/absolute/path/to/policy.toml"]
    }
  }
}
Smithery (npx)

To install osmcp for Claude Desktop automatically via Smithery:

npx @smithery/cli install osmcp
LiteLLM

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

5. Test
make test     # unit tests
make e2e      # end-to-end tests against real binary
make 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:

{
  "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.

الأسئلة الشائعة

ما هو io.github.KrushnaVardhanReddy/osmcp؟

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

كيف أثبّت io.github.KrushnaVardhanReddy/osmcp؟

يعمل على جهازك. في Claude Code: claude mcp add osmcp -- docker run -i --rm ghcr.io/krushnavardhanreddy/osmcp:latest. وفي العملاء الآخرين، الصق إعداد JSON من هذه الصفحة في إعدادات MCP الخاصة بهم.

هل يحتاج io.github.KrushnaVardhanReddy/osmcp إلى مفتاح API؟

لا يذكر إدراجه في السجل أي مفتاح أو سر إلزامي. قد تتطلب بعض الميزات حسابًا لدى الخدمة التي يتصل بها.

هل io.github.KrushnaVardhanReddy/osmcp مفتوح المصدر؟

نعم. شيفرته متاحة على GitHub بترخيص MIT.

من يصون io.github.KrushnaVardhanReddy/osmcp؟

ينشره KrushnaVardhanReddy. يدرجه AI.tn لكنه لا يصونه ولا يوصي به.

من سجل MCP الرسمي. الإدراج ليس توصية: راجع شيفرة الخادم وصلاحياته قبل منحه الوصول إلى بياناتك.