speclock — Claude Code MCP server: what it does, how to install
Enforces rules written in CLAUDE.md and .cursorrules as active constraints. It intercepts edits and shell calls before they break project boundaries.
claude mcp add speclock -- npx -y speclockWhat speclock does
The server turns written guidance from CLAUDE.md and .cursorrules into hard boundaries for coding agents. Instead of literal keyword matches, it spots semantic violations. If your project forbids editing authentication, a request to add social sign-in will be blocked before any file changes. The package exposes 51 MCP tools and checks commands ahead of time.
Everything runs locally through npx with no account setup. Decisions are logged to an HMAC audit chain. Git hooks provide an extra checkpoint right before code commits.
Advisory mode is the starting state. It issues warnings without interrupting work. Hard blocking requires the --strict flag.
What it helps with
- block unintended edits to sensitive project components
- catch policy violations based on meaning rather than literal keywords
- intercept forbidden shell commands before the agent executes them
- enforce repository guidelines at the Git commit stage
Example prompts for the agent
- Check if modifying the session handler violates rules in
CLAUDE.md - Run
speclock protect --strictto enable hard enforcement on this repository - Inspect all active constraint locks for the current project
How to install speclock
Platform CLI
claude mcp add speclock -- npx -y speclockPlatform CLI
codex mcp add speclock -- npx -y speclockConfig file
{
"mcpServers": {
"speclock": {
"command": "npx",
"args": [
"-y",
"speclock"
]
}
}
}Config file
{
"servers": {
"speclock": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"speclock"
]
}
}
}Platform CLI
gemini mcp add speclock npx -y speclockStep by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about speclock
How to install speclock in Claude Code?
Run claude mcp add speclock -- npx -y speclock. The agent will connect to the server and register its tools.
What does speclock do?
It evaluates proposed agent actions against guidelines in CLAUDE.md or .cursorrules. When an edit or shell command conflicts with a rule, the server stops execution.
How do advisory and strict modes differ?
Advisory mode only displays conflict warnings. You need the --strict flag to actively reject conflicting file edits and shell commands.