local-mcp-server
README.md
# local-mcp-server
Local MCP server with Docker Compose and one-command wrappers.
## What this provides
- File access tools scoped to one allowed root directory
- Local command execution via an allow-list
- Read-only Postgres query tool
- Dockerized startup with one command
## Prerequisites
- Docker Desktop (running)
## One-time setup
1. Start from project root.
2. Run:
```bash
chmod +x scripts/start-local-mcp.sh scripts/stop-local-mcp.sh scripts/register-mcp-client.sh
./scripts/start-local-mcp.sh
```
On first run, the script creates `.env` from `.env.example` and exits.
3. Edit `.env` and set at least:
- `MCP_ALLOWED_ROOT`
- `DB_PASSWORD`
- Optional: any DB values if your local DB differs
4. Run again:
```bash
./scripts/start-local-mcp.sh
```
## Daily usage
Start:
```bash
./scripts/start-local-mcp.sh
```
Stop:
```bash
./scripts/stop-local-mcp.sh
```
Logs:
```bash
docker compose -f /Users/suresh.gollamudi/projects/marketplace-code-review/local-mcp-server/docker-compose.yml logs -f local-mcp
```
Status:
```bash
docker compose -f /Users/suresh.gollamudi/projects/marketplace-code-review/local-mcp-server/docker-compose.yml ps
```
## Auto-register MCP client (VS Code + Cursor)
Use the auto-detect script to register this server in supported local client config files:
```bash
./scripts/register-mcp-client.sh
```
Dry-run preview only:
```bash
./scripts/register-mcp-client.sh --dry-run
```
Target one client explicitly:
```bash
./scripts/register-mcp-client.sh --target vscode
./scripts/register-mcp-client.sh --target cursor
```
What it updates:
- VS Code (recommended): `~/Library/Application Support/Code/User/mcp.json` under `servers`
- Cursor (if present): `~/Library/Application Support/Cursor/User/mcp.json` under `servers`
- Cursor fallback: `~/.cursor/mcp.json` under `servers`
The script also removes any legacy VS Code `settings.json` entry for this server.
The script creates backup files before writing any existing config.
## MCP endpoint
- `http://localhost:3000/mcp`
## Tools exposed by this server
- `list_files(relative_path)`
- `read_text_file(relative_path, max_chars)`
- `run_local_command(command, args, timeout_sec)`
- `query_postgres_readonly(sql, limit)`
## Security defaults
- Filesystem access constrained to `MCP_ALLOWED_ROOT`
- Command execution constrained to an allow-list in `server.py`
- SQL constrained to `SELECT`/`WITH` only
## Initialize as a local git repo
```bash
git init
git add .
git commit -m "Initial local MCP server scaffold"
```
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessSyncing