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:
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.