Skip to main content
Glama

Claude MCP Server

A Model Context Protocol (MCP) server that provides a bridge to Anthropic's Claude CLI. This allows MCP-compliant clients (like Claude Desktop or Gemini) to interact with the Claude CLI to start new chat sessions or continue existing ones.

Features

  • Start New Sessions: Initiate a new conversation with a specific Claude model.

  • Continue Sessions: Reply to existing sessions using their Session ID.

  • Session Management: Automatically continues the latest session if no Session ID is provided.

  • Model Selection: Supports specifying different Claude models (e.g., sonnet, opus, haiku).

  • System Prompt: Native support for custom system prompts.

  • Working Directory: Specify custom working directory for CLI execution.

Related MCP server: MCP Server Example

Prerequisites

# Install Claude CLI
npm install -g @anthropic-ai/claude-code

# Authenticate
claude setup-token

Installation

Global Installation

npm install -g @2lab.ai/claude-mcp-server

Run directly with npx

npx @2lab.ai/claude-mcp-server

Usage

Running the server

After global installation:

claude-mcp-server

Or with npx:

npx @2lab.ai/claude-mcp-server

Testing with MCP Inspector

You can test and debug the server using the MCP Inspector:

npx @modelcontextprotocol/inspector npx @2lab.ai/claude-mcp-server

Or if globally installed:

npx @modelcontextprotocol/inspector claude-mcp-server

Claude Desktop Configuration

Add the following to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "claude-cli": {
      "command": "npx",
      "args": ["-y", "@2lab.ai/claude-mcp-server"]
    }
  }
}

Or if globally installed:

{
  "mcpServers": {
    "claude-cli": {
      "command": "claude-mcp-server"
    }
  }
}

Claude Code Configuration

Add to your Claude Code settings:

{
  "mcpServers": {
    "claude-cli": {
      "command": "npx",
      "args": ["-y", "@2lab.ai/claude-mcp-server"]
    }
  }
}

Available Tools

chat

Start a new Claude session with a prompt.

Parameters:

  • prompt (required): The prompt to start the session with

  • model (optional): The model to use (e.g., 'sonnet', 'opus', 'haiku')

  • systemPrompt (optional): System prompt to set the assistant's behavior

  • cwd (optional): Working directory for the claude CLI execution

Returns: Response text and new Session ID in _meta.sessionId

chat-reply

Continue an existing Claude session.

Parameters:

  • prompt (required): The prompt to continue the conversation

  • sessionId (optional): The session ID to continue. If not provided, continues the most recent session

  • model (optional): The model to use for this turn

  • systemPrompt (optional): Additional system prompt to append for this turn

  • cwd (optional): Working directory for the claude CLI execution

Returns: Response text and Session ID in _meta.sessionId

Development

# Clone the repository
git clone https://github.com/2lab-ai/claude-mcp-server.git
cd claude-mcp-server

# Install dependencies
npm install

# Build
npm run build

# Run tests
npm test

# Run locally
npm start

# Test with MCP Inspector
npm run inspect

CI/CD

This project uses GitHub Actions to automatically publish to npm when changes are pushed to the main branch.

To enable automatic publishing:

  1. Generate an npm access token from npmjs.com

  2. Add the token as a secret named NPM_TOKEN in your GitHub repository settings

  3. Bump the version in package.json before pushing to trigger a publish

License

ISC

Available Tools

2 tools
chatA

Start a new Claude session with a prompt. Returns the response and the new Session ID.

ParametersJSON Schema
NameRequiredDescriptionDefault
cwdNoOptional: Working directory for the claude CLI execution.
modelNoOptional: The model to use (e.g., 'sonnet', 'opus', 'haiku').
promptYesThe prompt to start the session with.
systemPromptNoOptional: System prompt to set the assistant's behavior.

TDQS

A4.1/5.0
Behavior4/5

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

No annotations are provided, so the description carries full burden. It discloses that the tool returns 'the response and the new Session ID', which is key behavioral info. However, it does not detail side effects, authentication needs, or rate limits, but for a simple session starter, it is reasonably transparent.

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, front-loaded with the core action. Every word is necessary; no redundancy. It is optimally concise.

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 four parameters (one required), no output schema, and a sibling tool, the description is minimal. It explains the basic action and return values but lacks details like return format, prerequisites, or how session IDs are used. Adequate but not complete for complex usage.

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 baseline is 3. The description adds no extra meaning beyond the schema; it only mentions 'with a prompt', which aligns with the required parameter. No additional semantics provided.

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: 'Start a new Claude session with a prompt.' The verb 'start' and resource 'Claude session' are specific. The sibling tool 'chat-reply' suggests continuation, so this description effectively differentiates.

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 when to use—initiating a new session—by contrasting with 'chat-reply' tool name. It provides clear context but does not explicitly state when not to use or mention alternatives.

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

chat-replyB

Continue an existing Claude session.

ParametersJSON Schema
NameRequiredDescriptionDefault
cwdNoOptional: Working directory for the claude CLI execution.
modelNoOptional: The model to use for this turn.
promptYesThe prompt to continue the conversation.
sessionIdNoThe session ID to continue. If not provided, continues the most recent session.
systemPromptNoOptional: Additional system prompt to append for this turn.

TDQS

B3.3/5.0
Behavior2/5

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

No annotations are present, so the description must supply all behavioral context. It fails to disclose side effects (e.g., mutating session state), authentication requirements, or rate limits.

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

Conciseness4/5

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

A single concise sentence that is front-loaded with the core purpose. However, it could include a brief note on context without becoming verbose.

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

Completeness2/5

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

With 5 parameters, no output schema, and no annotations, the description does not cover return values or behavioral details, leaving gaps for effective use.

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 baseline is 3. The description adds no parameter-specific information beyond what the schema already provides.

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 verb 'continue' and the resource 'existing Claude session', effectively distinguishing it from the sibling tool 'chat' which likely starts a new session.

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?

No explicit when-to-use or when-not-to-use guidance is provided. The description implies usage for continuing sessions rather than starting new ones, but lacks exclusions or alternatives.

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. 2 tool updatesv1.0.1
    • First observedchat
    • First observedchat-reply

TDQS

A3.7/5.0
Disambiguation5/5

The two tools have clearly distinct purposes: one starts a new session, the other continues an existing one. There is no ambiguity.

Naming Consistency5/5

Both tools use the 'chat' prefix and follow a clear verb_noun pattern: 'chat' for starting, 'chat-reply' for continuing. Consistent and predictable.

Tool Count4/5

Only two tools cover the core workflow of starting and continuing a chat, which is reasonable for a minimal chat server. However, it could be slightly expanded.

Completeness3/5

The tool surface covers starting and continuing sessions but lacks session management operations like listing, deleting, or fetching history, which are notable 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

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/2lab-ai/claude-mcp-server'

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