Claude Code MCP

Claude Code MCP

Enables AI agents to interact programmatically with Claude Code CLI, managing sessions, streaming outputs, and handling permission requests.

Category
Visit Server

README

Claude Code MCP

An MCP (Model Context Protocol) server that wraps the Claude Code CLI, enabling other AI agents to interact with Claude Code programmatically.

npm version

Features

  • Session Management: Start, continue, and manage multiple conversation sessions
  • Streaming Output: Real-time output from Claude Code tasks
  • Interrupt Support: Stop running tasks at any time (like Ctrl+C)
  • Permission Delegation: When Claude Code needs permission, the outer agent can approve, deny, or redirect
  • Progress Monitoring: Check task progress and get partial outputs

Installation

From npm (Recommended)

npm install -g @jawkjiang/claude-code-mcp

From source

git clone https://github.com/jawkjiang/claude-code-mcp.git
cd claude-code-mcp
npm install
npm run build

Prerequisites

Configuration

Add to your ~/.mcp.json:

Using npx (Recommended)

{
  "mcpServers": {
    "claude-code": {
      "command": "npx",
      "args": ["@jawkjiang/claude-code-mcp"]
    }
  }
}

Using global install

{
  "mcpServers": {
    "claude-code": {
      "command": "claude-code-mcp"
    }
  }
}

Using local build

{
  "mcpServers": {
    "claude-code": {
      "command": "node",
      "args": ["/path/to/claude-code-mcp/dist/index.js"]
    }
  }
}

Available Tools

Tool Description
chat Start a new conversation or continue an existing session
respond Respond to permission requests: approve, deny, or redirect with new instructions
interrupt Stop a running task (like Ctrl+C)
get_output Get current output/progress from a session
list_sessions List all active sessions
close_session Close and cleanup a session
get_version Get Claude Code CLI version

Usage Examples

Basic Chat

{
  "tool": "chat",
  "params": {
    "message": "Create a hello world Python script",
    "workingDirectory": "/path/to/project"
  }
}

Permission Handling

When Claude Code needs permission, you'll receive:

{
  "status": "awaiting_permission",
  "sessionId": "abc-123",
  "pendingPermission": {
    "tool": "Bash",
    "action": "rm -rf /tmp/test",
    "description": "Delete temporary directory"
  },
  "currentOutput": "I need to clean up the temp directory...",
  "message": "Use 'respond' tool to approve, deny, or redirect."
}

You can then respond with:

Approve:

{
  "tool": "respond",
  "params": {
    "sessionId": "abc-123",
    "action": "approve"
  }
}

Deny:

{
  "tool": "respond",
  "params": {
    "sessionId": "abc-123",
    "action": "deny"
  }
}

Redirect (provide alternative instructions):

{
  "tool": "respond",
  "params": {
    "sessionId": "abc-123",
    "action": "redirect",
    "message": "Don't delete the directory. Instead, just remove the .tmp files inside it."
  }
}

Interrupt a Task

{
  "tool": "interrupt",
  "params": {
    "sessionId": "abc-123"
  }
}

Architecture

Outer Agent                    claude-code-mcp                Claude Code CLI
    │                              │                              │
    │── chat(message) ────────────>│                              │
    │                              │──── spawn process ──────────>│
    │                              │                              │
    │<── awaiting_permission ─────│<── permission request ───────│
    │                              │                              │
    │── respond(action) ──────────>│                              │
    │   - approve                  │──── send response ──────────>│
    │   - deny                     │                              │
    │   - redirect(new_message)    │                              │
    │                              │                              │
    │<── completed ───────────────│<── task complete ────────────│

Permission Checkpoint Philosophy

Permission requests are not just approve/deny gates - they are audit and steering points where the outer agent can:

  1. Review what Claude Code is doing
  2. Approve and let it continue
  3. Deny and stop the current operation
  4. Redirect with new instructions ("No, do this instead...")

This gives the outer agent the same level of control a human would have when using Claude Code interactively.

License

MIT

Author

Created with Claude Code

Recommended Servers

playwright-mcp

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.

Official
Featured
TypeScript
Magic Component Platform (MCP)

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.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

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.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

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.

Official
Featured
Python
graphlit-mcp-server

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.

Official
Featured
TypeScript
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

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.

Official
Featured