# SpecLock MCP server

> Enforces project constraints so AI coding agents check edits, shell commands, and commits against rules before acting.

- Repository: https://github.com/sgroy10/speclock
- Page: https://hostedmcp.org/servers/sgroy10/speclock
- Transport: stdio
- Stars: 26
- License: MIT
- Latest version: 5.5.3

## Install

### Claude Code

```sh
claude mcp add speclock -- npx -y speclock
```

### Cursor (`~/.cursor/mcp.json`)

```json
{
  "mcpServers": {
    "speclock": {
      "command": "npx",
      "args": [
        "-y",
        "speclock"
      ]
    }
  }
}
```

### VS Code (`.vscode/mcp.json`)

```json
{
  "servers": {
    "speclock": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "speclock"
      ]
    }
  }
}
```

### VS Code CLI

```sh
code --add-mcp '{"name":"speclock","type":"stdio","command":"npx","args":["-y","speclock"]}'
```

### Claude Desktop (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "speclock": {
      "command": "npx",
      "args": [
        "-y",
        "speclock"
      ]
    }
  }
}
```

### Codex

```sh
codex mcp add speclock -- npx -y speclock
```

### Codex config.toml (`~/.codex/config.toml`)

```toml
[mcp_servers.speclock]
command = "npx"
args = ["-y", "speclock"]
```

### Gemini CLI

```sh
gemini mcp add -s user speclock npx -- -y speclock
```

### Gemini settings.json (`~/.gemini/settings.json`)

```json
{
  "mcpServers": {
    "speclock": {
      "command": "npx",
      "args": [
        "-y",
        "speclock"
      ]
    }
  }
}
```

## Environment variables

| Name | Required | Secret | Description |
|---|---|---|---|
| `SPECLOCK_ENCRYPTION_KEY` | no | no |  |

## Tools (49)

- `speclock_init`
- `speclock_get_context`
- `speclock_set_goal`
- `speclock_add_lock`
- `speclock_remove_lock`
- `speclock_add_decision`
- `speclock_add_note`
- `speclock_set_deploy_facts`
- `speclock_check_conflict`
- `speclock_set_enforcement`
- `speclock_override_lock`
- `speclock_override_history`
- `speclock_semantic_audit`
- `speclock_detect_drift`
- `speclock_audit`
- `speclock_session_briefing`
- `speclock_session_summary`
- `speclock_log_change`
- `speclock_get_changes`
- `speclock_get_events`
- `speclock_checkpoint`
- `speclock_repo_status`
- `speclock_suggest_locks`
- `speclock_health`
- `speclock_apply_template`
- `speclock_report`
- `speclock_verify_audit`
- `speclock_export_compliance`
- `speclock_policy_evaluate`
- `speclock_policy_manage`
- `speclock_telemetry`
- `speclock_add_typed_lock`
- `speclock_check_typed`
- `speclock_list_typed_locks`
- `speclock_update_threshold`
- `speclock_compile_spec`
- `speclock_build_graph`
- `speclock_blast_radius`
- `speclock_map_locks`
- `speclock_review_patch`
- `speclock_review_patch_diff`
- `speclock_parse_diff`
- `speclock_sync_rules`
- `speclock_list_sync_formats`
- `speclock_replay`
- `speclock_list_sessions`
- `speclock_drift_score`
- `speclock_coverage`
- `speclock_strengthen`

## FAQ

### How do I install SpecLock in my project?

Run npx speclock@latest protect to read your existing AI rule files and install advisory protection, then rerun with --strict to enable blocking.

### Does SpecLock block AI actions or just warn?

It starts in advisory mode with warnings only, and strict mode blocks confirmed conflicts before files change.

### Does SpecLock need an account or cloud connection?

No account is required; it runs locally by default and advisory mode never blocks a change.

### How many MCP tools does SpecLock expose?

The MCP integration exposes 51 tools to clients such as Claude Code, Cursor, Codex, Windsurf, and Cline.

### Can SpecLock catch indirect or disguised violations?

Yes, it uses semantic conflict detection to catch euphemisms, temporal evasion, dilution, and compound requests.
