Claude Code Directive MCP
MCP server to temporarily add a global Codex directive requiring Claude Code usage until a configured expiry date, with guardrails and cleanup.
README
Claude Code Directive MCP
claude-code-directive-mcp is a local stdio MCP server that lets an agent temporarily add a global Codex AGENTS directive requiring Claude Code usage until a configured expiry date.
It is designed for temporary, opt-in delegation policy:
- Adds one clearly marked block to the effective global Codex instruction file.
- Uses Codex precedence: non-empty
AGENTS.override.md, otherwiseAGENTS.md. - Skips project-local
.codexdirectories unless explicitly opted in. - Records a manifest and creates a user-level cleanup timer.
- Removes only the exact marked block recorded in the manifest.
- Adds guardrails for Claude context, Main Codex context, retries, parallelism, and rate limits.
- Never asks for or stores secrets.
Install
git clone <repo-url>
cd claude-code-directive-mcp
npm install
npm run install:codex
Restart Codex after installation so the new MCP server is loaded.
The installer writes a user wrapper to:
~/.local/bin/codex-claude-code-directive-mcp
and registers this MCP server in:
${CODEX_HOME:-~/.codex}/config.toml
MCP Tools
claude_directive_enable
Enable or update the temporary directive.
Example arguments:
{
"expiresAt": "2026-08-17T23:59:59",
"timezone": "Europe/Berlin",
"cleanupDelayMinutes": 5,
"maxClaudePromptChars": 60000,
"maxClaudeOutputChars": 20000,
"maxClaudeRuntimeSeconds": 900,
"maxClaudeRetries": 1,
"mainContextReservePercent": 25,
"maxClaudeCallsPerTask": 3,
"maxParallelClaudeAgents": 2,
"minSecondsBetweenClaudeCalls": 30
}
claude_directive_status
Reports discovered Codex homes, effective global instruction files, marker counts, scheduler state, manifest content, and optional Claude CLI status.
claude_directive_disable
Runs the idempotent cleanup and disables/removes the one-time user scheduler.
Cleanup
On Linux with a working user systemd, the MCP creates a user timer named:
codex-claude-code-directive-cleanup.timer
The timer executes:
${CODEX_HOME:-~/.codex}/maintenance/cleanup-temporary-claude-code-directive.py
The cleanup script uses the manifest to remove only the exact marked directive block. It is safe to run repeatedly.
Budget And Rate Guardrails
The directive generated by this MCP tells the main agent to:
- keep a Main Codex context reserve,
- cap Claude prompt and output size,
- cap Claude runtime and retries,
- limit per-task Claude calls and parallel Claude agents,
- wait between separate Claude calls unless parallelism is justified,
- stop fast retry loops on rate limits, context limits, timeouts, or overload.
The MCP writes these rules into the global instruction block; it does not have privileged access to live provider token counters.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.