Featured

Deploy OpenClaw in 60 seconds — 20% off logoDeploy OpenClaw in 60 seconds — 20% off

Launch OpenClaw on Hostinger in about 60 seconds and keep your agent live 24/7. Our referral link gives you 20% off, no coupon code needed.

Launch on Hostinger
Run your Hermes agent on Hostinger, fully managed logoRun your Hermes agent on Hostinger, fully managed

Launch Hermes on Hostinger in one click, fully managed, no VPS knowledge needed. Use code ZACAARON10 for 10% off.

Launch on Hostinger
Crawl and scrape any site into clean data, 10% off logoCrawl and scrape any site into clean data, 10% off

Firecrawl crawls and scrapes any site into clean markdown for your agent. Get 1,000 free credits, and new users get 10% off their first purchase.

Try Firecrawl free
6,000+ web scrapers for your AI agent, start free logo6,000+ web scrapers for your AI agent, start free

Apify gives your agent live web data: 6,000+ prebuilt scrapers and actors, MCP-ready. Sign up free with $5 in usage credits.

Try Apify free
One API to scrape, enrich, and extract the internet. logoOne API to scrape, enrich, and extract the internet.

Context.dev gives your agents a single API to scrape, enrich, and extract live web data — no proxies, no parsers, no maintenance.

Start building free
SetupClaw: done-for-you OpenClaw for founders & exec teams logoSetupClaw: done-for-you OpenClaw for founders & exec teams

White-glove OpenClaw for founders and exec teams (4–50+ employees): we install, harden, integrate your tools, and maintain it — secured from day one.

Get it set up for you
SEO data APIs for your agent, $1 free credit logoSEO data APIs for your agent, $1 free credit

DataForSEO gives your agent live access to SERP results, keyword data, backlinks, and on-page SEO data through one API. New accounts get a $1 credit, good for up to 20,000 keyword or backlink lookups.

Try DataForSEO free
Reach 48,000+ AI builders

A flat monthly placement in front of developers actively installing AI tools. No lock-in, cancel anytime.

Advertise here

Works with

Claude CodeClaude DesktopCursorVS CodeClineCodex CLIOpenClaw+ any MCP client

Install to Claude Code

This server doesn't publish a one-line install command. Follow the setup in the source repository.

Summary

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

README.md

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.

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

See related servers & alternatives →

Related MCP servers

Browse all →

Related guides

Hand-picked reading to help you choose and use AI & ML servers.