osmcp
A typed, policy-controlled OS capability layer for AI agents via MCP, exposing safe filesystem, git, and text-processing tools governed by a strict policy engine.
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.
Features
| Category | Tools | Phase |
|---|---|---|
| 🔍 Search | grep, find |
1 |
| 📁 File Inspection | ls, cat, stat, wc, head, tail |
1 |
| 🌳 Filesystem | tree, du |
1 |
| 🔀 Git Intelligence | git_status, git_diff, git_log |
1 |
| 🔧 Transform | jq, sed, diff |
1 |
| ✍️ File Mutation | write_file, append_file, mkdir, rm, mv, cp, patch |
2 |
| 🚀 Git Mutation | git_add, git_commit, git_checkout, git_branch, git_pull, git_push |
2 |
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 withPOLICY_DENIED.allowed_tools— Only tools in this list are visible to the MCP client. Unlisted tools do not appear intools/list.allow_mutation— Whenfalse, 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:
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。