Local Dev MCP
# Local Dev MCP
[简体中文](README.zh-CN.md)
Run Git, npm, Maven, and other local development tools from an MCP client. The server accepts a program, arguments, and a working directory over STDIO. Common commands have built-in rules. Other commands can use an editable allowlist or go through a local approval request. [MCP STDIO transport](https://modelcontextprotocol.io/specification/2025-11-25/basic/transports)
## Background
This project began when Quick's sandbox prevented the agent from using Maven, npm, and Git installed on the local machine. With a local STDIO connection, Quick can run commands such as `mvn test`, `npm test`, and `git status` in the project directory under the local allowlist and approval rules.
## Quick start
You need Python 3.11 or newer, `uv`, and an MCP client that can launch a local STDIO server. On Windows, the approval window uses Python's Tk support. [Install uv](https://docs.astral.sh/uv/getting-started/installation/)
Clone the repository, install the dependencies, and generate the client configuration.
```sh
git clone https://github.com/Pillow0-0/local-dev-mcp.git
cd local-dev-mcp
uv sync --locked
uv run --locked python -B main.py config
```
### Example MCP configuration
Paste the generated JSON into your client's local STDIO configuration, or use the Windows example below and replace both paths with your repository's absolute paths. If your client already has other servers, merge just the `local-dev-mcp` entry into `mcpServers`.
```json
{
"mcpServers": {
"local-dev-mcp": {
"command": "C:\\Projects\\local-dev-mcp\\.venv\\Scripts\\python.exe",
"args": ["-E", "-B", "C:\\Projects\\local-dev-mcp\\main.py", "serve"],
"env": {
"LOCAL_DEV_MCP_LANGUAGE": "en"
}
}
}
}
```
For a client with separate fields, copy `command`, `args`, and any optional `env` entries into their respective fields. On macOS and Linux, the example paths would be `/path/to/local-dev-mcp/.venv/bin/python` and `/path/to/local-dev-mcp/main.py`. Save and reload the MCP connection.
The server looks up programs on the PATH it inherits from your client. Configure the PATH and any tool-specific environment variables in the MCP client if needed.
## Run a command
Call `run_command` with one program and one array entry per argument. Use an existing absolute directory for `cwd`.
```json
{
"command": "mvn",
"args": ["-B", "test", "-Dtest=UserServiceTest"],
"cwd": "D:\\code\\backend",
"timeout_seconds": 300
}
```
| MCP tool | Purpose |
| --- | --- |
| `run_command` | Run an allowed command and return the exit code, stdout, stderr, and timing. |
| `request_permission` | Submit a command for review, including sample arguments, a working directory, a reason, and the requested scope. |
| `permission_status` | Look up a request and its actual approved scope. |
| `list_allowed_commands` | Inspect the built-in rules, current file rules, and active display language. |
On Windows, a command still running after about one second opens a live output window. The first line shows the executable path and all its arguments. The window closes three seconds after the command ends, or immediately if you press Enter. Pass `live_window: false` to keep that window closed for a call. MCP clients that request progress updates also receive output excerpts while the command runs. [MCP progress notifications](https://modelcontextprotocol.io/specification/2025-11-25/basic/utilities/progress)
Commands run non-interactively. The final result retains the last 32 KiB of each output stream and marks truncated streams. The default timeout is 300 seconds. You can set `timeout_seconds` from 1 to 1800 seconds.
## Approve a command
When `run_command` returns `approval_required`, the agent can submit the same command and arguments to `request_permission`. Use `requested_scope` to specify the breadth of access and `reason` to explain the purpose.
| Scope | What it matches |
| --- | --- |
| `exact` | The full example argument list. |
| `subcommand` | The first entry in `args`. Later arguments can vary. |
| `program` | All subcommands and arguments for the same command and resolved executable. |
Every approval applies across working directories. In `permission_status`, `scope` records the actual decision, `any_directory` describes directory access, and `all_arguments_allowed` is true for a program-wide rule.
The Windows dialog lists the executable, example arguments, directory, and reason. The green approval button names the scope. The red Reject button is on the opposite side. Choose Later or close the window to leave a request pending.
### Command-line approvals
Run these commands from the repository directory. Replace `REQUEST_ID` with the ID returned by the tool.
```sh
uv run --locked python -B main.py pending
uv run --locked python -B main.py approve REQUEST_ID
uv run --locked python -B main.py approved
uv run --locked python -B main.py revoke REQUEST_ID
```
Add `--scope program` or `--scope exact` to `approve` to choose the scope explicitly. A plain `approve` defaults to subcommand where available and exact arguments otherwise. Use `reject REQUEST_ID` to reject a pending request.
## Edit the allowlist
Open `allowlist.txt` in the state directory and save it as UTF-8. Enter a program name from PATH, optionally followed by its subcommand. Use `#` for comments. Added and removed rules take effect on the next tool call.
```text
# Allow git fetch with any following arguments.
git fetch
# Allow all Maven goals and arguments.
mvn
```
| Platform | Default state directory |
| --- | --- |
| Windows | `%LOCALAPPDATA%\LocalDevMCP` |
| macOS and Linux | `$XDG_STATE_HOME/local-dev-mcp` or `~/.local/state/local-dev-mcp` |
The server stores approved requests in `permissions.sqlite3`. Built-in rules live in `policy.py` and cover common Git, Maven, Node.js, Python, Go, Rust, and .NET development tasks.
## Language and display options
English (`en`) and Simplified Chinese (`zh-CN`) are bundled. The server checks the Windows display-language preferences or, on other systems, the message-locale environment. It uses English when no catalog matches.
The optional `env` block in the [MCP configuration example](#example-mcp-configuration) sets `LOCAL_DEV_MCP_LANGUAGE` to `en`. Use `zh-CN` for Simplified Chinese, or omit this setting to follow the system language. Reload the connection after changing it.
Set `LOCAL_DEV_MCP_APPROVAL_POPUP=0` for command-line approvals only. To add a translation, copy `locales/en.json` to a new language-tag file in `locales/`, such as `fr.json`. Keep the keys and format placeholders. Missing messages inherit the English version.
## Execution model
Commands run with the local account used to start the server. Approved build tools can execute project scripts, Maven plugins, and Git hooks with that account's access. Connect the server to clients and projects that you trust.
Windows batch files accept space-containing arguments. Their filenames and arguments are restricted to characters compatible with safe `cmd.exe` argument handling. Use a mapped drive when running a batch file from a network share.
## Development
Run the catalog checks after editing a translation.
```sh
uv run --locked python -B -m unittest discover -s tests
```
## License
[MIT License](LICENSE)
TDQS
Scored across 4 tools
Each tool has a distinct action: executing commands, checking granted scope, requesting approval, and listing configured rules. The only mild overlap is between permission_status (runtime approved scope) and list_allowed_commands (configured allowlist), which an agent could occasionally confuse, but the descriptions distinguish 'actual approved scope' from 'bundled rules and file rules' clearly enough.
All names are snake_case and three of four follow a verb_noun pattern (run_command, request_permission, list_allowed_commands). permission_status is a noun_phrase that breaks the verb pattern slightly, but the overall convention is predictable and readable.
Four tools is well-scoped for a permission-gated local command runner: execute, request approval, inspect approval, and inspect rules. No tool feels redundant or missing from the core loop.
The lifecycle of run -> request -> verify -> list is covered, which handles the main agent workflow. Minor gaps exist: no explicit revoke/reset of granted permissions and no direct allowlist editing tool (the path is surfaced instead), but agents can work around these via run_command.