local-exec
Integrates with a local Ollama instance to run a fast local LLM sub-agent that executes shell steps and returns concise extracted outputs, reducing the main agent’s context usage.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
mcp-local-exec
A lightweight Model Context Protocol (MCP) server that delegates shell/terminal tasks from a cloud reasoning agent (Antigravity, Claude Desktop, Claude Code, Cursor, etc.) to a local LLM running on Ollama.
Instead of flooding your main agent's context window with raw ls, grep, git diff, or log outputs, local-exec runs a fast local sub-agent that executes up to 4 shell steps and returns only the clean, extracted data—drastically cutting token usage.
Hybrid Architecture (Recommended: Graphify + local-exec)
mcp-local-exec works standalone, but it shines in a hybrid cloud-local setup paired with Graphify (or any codebase indexing MCP):
Main Agent (Cloud): Handles high-level reasoning and planning.
Graphify (MCP): Maps the codebase structure and locates relevant files without reading everything.
local-exec(MCP + Ollama): Acts as the local "hands", running shell commands and returning concise extracted outputs.
Zero-Token Graphify Setup: Want to initialize Graphify, link your Markdown docs into
graph.jsonat 0 token cost, or convert PDFs to Markdown for your agents? Check out my companion toolkit:llm-workflow-utils.
Related MCP server: token-ninja
Prerequisites
Node.js v18+
Ollama installed and running (ollama.com)
Recommended Local Models
Pick one model based on your available RAM/VRAM:
Model (Ollama Tag) | Size | Recommended RAM | Best For |
| ~1.2 GB | 8–16 GB | Maximum speed and minimal battery impact ( |
| ~2.5 GB | 16 GB | Best balance: reliable with chained bash commands, pipes, |
| ~5.5 GB | 16–32 GB | Maximum accuracy on long logs and complex shell pipelines. |
Pull your chosen model:
ollama pull qwen3.5:4bInstallation
git clone https://github.com/AdvisingDesert/mcp-local-exec.git
cd mcp-local-exec
npm installQuick check (it should stay idle waiting on stdio; press Ctrl+C to exit):
node index.jsConfiguration
Find your absolute Node path first (GUI apps on macOS often don't inherit your shell PATH):
which nodeAntigravity / Claude Desktop / Generic MCP Clients
Add local-exec to your mcpServers config:
{
"mcpServers": {
"local-exec": {
"command": "/path/to/node",
"args": ["/path/to/mcp-local-exec/index.js"],
"env": {
"OLLAMA_MODEL": "qwen3.5:4b",
"OLLAMA_URL": "http://localhost:11434/api/chat"
}
}
}
}(The env block is optional—qwen3.5:4b and http://localhost:11434/api/chat are the defaults.)
Claude Code (CLI)
claude mcp add local-exec -- /path/to/node /path/to/mcp-local-exec/index.jsAgent Rules (Prompting)
To make your main agent delegate automatically, add the rule template from examples/local-exec-rule.md to your .agents/rules/, CLAUDE.md, or project instructions.
Safety & Guardrails
local-exec executes shell commands generated by a local LLM. It includes:
A code-level regex guardrail that blocks destructive/privileged patterns (rm -rf, sudo, git reset --hard, git clean -f, dd, mkfs, etc.).
Strict 15s command timeout, 4-step execution cap, and 2-error circuit breaker.
Disclaimer: Always run this tool inside trusted development directories and maintain backups/git commits. Regex guardrails reduce risk but cannot guarantee 100% sandboxing.
License
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Source-checked CLI guides and model-aware planning for Claude Code, Codex, and Grok Build.
Work on your own computers from Claude or ChatGPT: run commands, edit and search files.
Use your Mac, Windows or Linux computer from ChatGPT, Claude or Codex: files, commands, documents.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables Claude to delegate coding tasks to local Ollama models, reducing API token usage by up to 98.75% while leveraging local compute resources. Supports code generation, review, refactoring, and file analysis with Claude providing oversight and quality assurance.27AGPL 3.0
- AlicenseNot gradedqualityBmaintenanceEnables AI coding assistants to execute shell commands locally, intercepting deterministic commands like git status and npm test before they reach the LLM, saving tokens and reducing latency.25 npm40MIT
- AlicenseAqualityBmaintenanceOffloads cheap work from cloud LLM agents to a local Ollama model, reducing costs and keeping frontier models focused on complex tasks.879 PyPI3MIT
- AlicenseBqualityFmaintenanceBridges Claude with a local Ollama coding model, letting Claude delegate bounded implementation tasks to the local model while retaining reasoning, review, and safety enforcement.122,089 npmMIT