Skip to main content
Glama
jawkjiang

Claude Code MCP

by jawkjiang

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

Related MCP server: claude-code-mcp

Installation

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:

{
  "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

Available Tools

7 tools
chatA

Start a new conversation with Claude Code or continue an existing session. Returns sessionId for future interactions. If permission is required, status will be "awaiting_permission" - use "respond" to approve/deny/redirect.

ParametersJSON Schema
NameRequiredDescriptionDefault
modelNoModel to use (sonnet, opus, haiku)
messageYesThe message to send to Claude Code
sessionIdNoSession ID to continue (omit for new session)
workingDirectoryNoWorking directory for Claude Code

TDQS

A3.9/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the burden of behavioral disclosure. It reveals that the tool returns a sessionId and may return a status of 'awaiting_permission', which is valuable. However, it does not describe the full response structure, error handling, or any rate limits or side effects, leaving gaps in the behavior profile.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is three short sentences, each serving a distinct purpose: stating the main action, noting the return value, and giving conditional guidance. It is front-loaded with the primary purpose and avoids any redundant or filler content.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the absence of annotations and output schema, the description covers the essential facts (session start/continue, sessionId, permission status) but is incomplete for a tool with 4 parameters and no return schema. It doesn't explain the overall response format, potential errors, or behaviors like timeouts or asynchronous execution, which are important for a chat interaction tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the parameters are already well-documented. The description adds little beyond what the schema states: it mentions returning a sessionId and the process for continuing sessions, but doesn't elaborate on parameter formats or constraints. This aligns with the baseline score of 3 for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states a specific action: 'Start a new conversation with Claude Code or continue an existing session.' It also mentions the return of a sessionId, which distinguishes it from sibling tools like get_output or list_sessions. The conditional note about 'awaiting_permission' ties it to the 'respond' tool, further clarifying its role.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit context for when to use the tool (starting or continuing a session) and names the alternative 'respond' for handling permission requests. It doesn't explicitly state when not to use this tool (e.g., for retrieving output), but the reference to 'respond' and the session-oriented focus give reasonable guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

close_sessionB

Close and cleanup a session, freeing resources.

ParametersJSON Schema
NameRequiredDescriptionDefault
sessionIdYesSession ID to close

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are present, so the description carries full responsibility for behavioral disclosure. It mentions cleanup and freeing resources, implying side effects, but does not state whether the action is reversible, what happens to ongoing work, or error behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, direct sentence that immediately conveys the action and its purpose. No unnecessary words or repetition.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple one-parameter tool, the description is adequate but lacks usage context and does not clarify the distinction from sibling tools like 'interrupt'. It covers the basic function but leaves questions about when and why to invoke it.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema already documents the sole parameter with 100% coverage (sessionId: 'Session ID to close'). The description adds no extra parameter-specific meaning, so the baseline score of 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('close') and resource ('session'), clearly stating the tool's function. It does not explicitly differentiate from sibling tools like 'interrupt' or 'list_sessions', but the primary purpose is unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided for when to use this tool versus alternatives such as 'interrupt' or 'list_sessions'. There is also no mention of preconditions or consequences that would help an agent decide between them.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_outputA

Get the current output buffer from a running or completed session. Useful for checking progress.

ParametersJSON Schema
NameRequiredDescriptionDefault
sessionIdNoSession ID (defaults to active session)

TDQS

A3.9/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the burden. It discloses that the tool works for running or completed sessions and is non-destructive in implication, but it doesn't state whether the buffer is cleared, if it blocks, or any side effects. This is acceptable but lacks depth.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two concise sentences that are front-loaded with the main action and then a practical use case. No unnecessary words or repetition.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is simple with one optional parameter and no output schema, so the description should clarify return values. It says 'output buffer' but does not specify the format or whether it returns all output or only new output. There is also implied default session behavior only in the schema, not the description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% because sessionId has a description ('Session ID (defaults to active session)'). The description adds no extra parameter information beyond what the schema already provides, so baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool retrieves the current output buffer from a session, specifying both running and completed sessions. This distinguishes it from sibling tools like chat, respond, and list_sessions, which serve different purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It explicitly mentions 'Useful for checking progress,' giving clear context for when to use this tool. While it doesn't list exclusions or compare to alternatives, the purpose is distinct enough among siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_versionA

Get the installed Claude Code CLI version.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. 'Get' suggests a read-only operation, but no further behavioral traits (e.g., no side effects, no network calls) are disclosed. It does not contradict anything, but it's minimal.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single concise sentence, perfectly front-loaded with the action and resource. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (no parameters, no complex behavior), the description is sufficiently complete. It does not explain the return format, but for a version check this is generally obvious and the description covers the essential context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

There are zero parameters, so the input schema is vacuously fully covered. The baseline for 0 params is 4, and the description adds no conflicting information.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('Get') and resource ('installed Claude Code CLI version'), making its purpose crystal clear. It naturally distinguishes from sibling tools which all relate to chat/session management.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage (when you need to know the CLI version) but provides no explicit context, alternatives, or when-not-to-use guidance. For a trivial version-check tool this is acceptable but still lacks the explicit guidance that would merit a higher score.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

interruptA

Interrupt/stop the currently running Claude Code task. Like pressing Ctrl+C.

ParametersJSON Schema
NameRequiredDescriptionDefault
sessionIdNoSession ID to interrupt (defaults to active session)

TDQS

A3.7/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden. It discloses that the action stops a running task and is like Ctrl+C, implying a non-graceful interruption. However, it does not disclose side effects such as session state, cancellability, or reversibility, leaving significant behavioral information unstated.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence, immediately clear with a memorable analogy. It wastes no words and front-loads the core action.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is simple with one optional parameter and no output schema. The description explains the action but does not clarify relationship to sibling tools like close_session, nor the effect on the session state. It is adequate but not comprehensive.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema already provides full coverage with a description for sessionId, including its optionality and default behavior. The tool description does not add additional parameter semantics; it refers to 'task' while the parameter is 'sessionId', which may slightly conflate concepts. Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses specific verb 'interrupt/stop' and identifies the resource as 'currently running Claude Code task', with a helpful analogy to Ctrl+C. This clearly distinguishes from sibling tools like chat or list_sessions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies use when there is a currently running task that needs stopping, reinforced by the Ctrl+C analogy. It does not explicitly state alternatives or exclusions, but provides clear usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_sessionsA

List all active sessions and their status.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the burden of behavioral disclosure. It indicates a read-only action ('List') and the output ('status'), but does not mention potential limitations such as pagination, ordering, or the definition of 'active'. This is adequate but leaves gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence, front-loaded with the action and object. Every word earns its place, with no redundant phrasing. It efficiently conveys the tool's purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple, parameterless tool, the description provides the core function and output ('status'). However, it does not clarify potential edge cases like whether closed sessions are included or if there are any filters. Given the low complexity, this is fairly complete but not exhaustive.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

There are zero parameters, so the schema fully covers any parameter semantics. The description adds nothing beyond the schema, but no description is needed. Baseline 4 is appropriate for a parameterless tool.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('List') and resource ('active sessions'), clearly indicating its function. It distinguishes from sibling tools like chat, respond, and close_session by being the only enumeration tool. The mention of 'status' clarifies the output focus.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is given on when to use this tool versus alternatives. It simply states what it does, leaving the agent to infer that it should be used when the active sessions need to be viewed. There are no exclusions or explicit alternative suggestions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

respondA

Respond to a permission request or send new instructions to Claude Code. Actions:

  • "approve": Allow the pending operation

  • "approve_all": Allow this and similar future operations

  • "deny": Reject the pending operation

  • "redirect": Stop current operation and provide new instructions instead

ParametersJSON Schema
NameRequiredDescriptionDefault
actionYesHow to respond
messageNoNew instructions (required for 'redirect', optional feedback for others)
sessionIdNoSession ID (defaults to active session)

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden of behavioral disclosure. It does well by explaining the effect of each action: 'approve' allows, 'approve_all' allows similar future operations, 'deny' rejects, and 'redirect' stops current operation and provides new instructions. This is transparent, though it omits details like session persistence or side effects beyond the immediate action.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise: two sentences, front-loaded with the purpose, and followed by a clean bulleted list of actions. No word is wasted, and the structure makes the action semantics easy to scan.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (3 params, no output schema), the description covers the main behaviors and action semantics. It lacks details about return values or what happens after the action, but for a control tool of this scope, it is reasonably complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 100% description coverage, but the description adds meaningful parameter semantics by elaborating on the 'action' enum values and specifying that 'message' is required for 'redirect'. This goes beyond the schema's simple 'How to respond' and helpful for correct usage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb and resource: 'Respond to a permission request or send new instructions to Claude Code.' It lists four distinct actions that differentiate it from sibling tools like chat, interrupt, and get_output, making its role unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use the tool—when responding to a permission request or sending new instructions. However, it does not explicitly state when not to use it or mention alternative tools, leaving some differentiation implicit rather than explicit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 7 tool updatesv1.2.0
    • First observedchat
    • First observedclose_session
    • First observedget_output
    • First observedget_version
    • First observedinterrupt
    • First observedlist_sessions
    • First observedrespond

TDQS

A3.7/5.0
Disambiguation3/5

chat and respond have overlapping capabilities: both can send messages to an existing session, though respond is primarily for permission handling. Other tools are clearly distinct, but the boundary between chat and respond may cause misselection.

Naming Consistency4/5

Most tools follow a verb or verb_noun pattern (chat, interrupt, get_output, list_sessions), but the mix of single verbs and prefixed verbs (get_, list_, close_) is a minor inconsistency.

Tool Count5/5

Seven tools is an appropriate scope for managing Claude Code sessions, covering all necessary operations without bloat or deficiency.

Completeness5/5

The set covers the full session lifecycle: create/resume (chat), interact (respond), monitor (get_output, list_sessions), interrupt, and close (close_session), plus version check. No obvious gaps.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    Wraps Claude Code as tools for MCP clients, enabling autonomous coding tasks via a 4-tool lifecycle with session management, async polling, and permission controls.
    4
    57
    20
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables MCP clients to spawn and control Codex CLI and Claude Code sessions on the host machine, with session management and filesystem access.
    4
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jawkjiang/claude-code-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server