MCP ExplorerExplorer

Mcp Client Ts

@jaavieron a month ago
1 MIT
FreeCommunity
AI Systems
A CLI client for Anthropic's Claude using MCP, enabling seamless tool execution without manual confirmation.

Overview

What is Mcp Client Ts

mcp-client-ts is a command-line interface (CLI) client designed for interacting with Anthropic’s Claude models using the Model Context Protocol (MCP). It allows for seamless execution of MCP tools without manual confirmation for each tool call.

Use cases

Use cases for mcp-client-ts include automating interactions with Claude for data processing tasks, integrating AI capabilities into applications without manual intervention, and facilitating rapid prototyping of AI-driven solutions.

How to use

To use mcp-client-ts, first navigate to the client directory, install dependencies using npm, configure your environment variables with your Anthropic API key, build the client, and then run it by providing the path to your MCP tool server’s main script.

Key features

Key features of mcp-client-ts include seamless tool execution without manual confirmations, compatibility with various MCP-compatible tool servers, and the ability to specify different Claude models and response token limits.

Where to use

mcp-client-ts can be used in various fields that require interaction with AI models, such as natural language processing, automated customer support, and data analysis, where automated tool execution enhances efficiency.

Content

MCP Claude Client

This project provides a command-line interface (CLI) client to interact with Anthropic’s Claude models using the Model Context Protocol (MCP). Its primary purpose is to enable seamless execution of MCP tools without requiring manual confirmation for each tool call, offering more flexibility compared to interfaces like Claude Desktop.

Prerequisites

  • Node.js (v18 or later recommended)
  • npm (usually comes with Node.js)
  • An Anthropic API Key
  • An MCP-compatible tool server (e.g., mcp-filesystem-server from this repository).

Setup

  1. Navigate to the Client Directory:

    cd mcp-client-ts
    
  2. Install Dependencies:

    npm install
    
  3. Configure Environment Variables:
    Create a .env file in the clients/claude directory:

    ANTHROPIC_API_KEY=your_anthropic_api_key_here
    # Optional: Specify a different Claude model
    # ANTHROPIC_MODEL=claude-3-opus-20240229
    # Optional: Set max tokens for responses
    # MAX_TOKENS=2048
    

    Replace your_anthropic_api_key_here with your actual Anthropic API key.

  4. Build the Client:
    Compile the TypeScript code to JavaScript:

    npm run build
    

    This will create a build directory containing the compiled JavaScript files.

Running the Client

To run the client, you need to provide the path to the main script of your running MCP tool server.

node build/index.js <path_to_mcp_server_script>

Example:

If your MCP tool server’s entry point is ../mcp-filesystem-server/dist/index.js (relative to the mcp-client-ts directory), you would run:

node build/index.js ../mcp-filesystem-server/dist/index.js

Or if the server is a Python script:

node build/index.js ../mcp-weather-server/main.py

The client will connect to the specified MCP server, list the available tools, and present you with a chat prompt. You can then interact with Claude, and any tool calls requested by the model will be executed automatically via the connected MCP server.

How it Works

  1. The client starts and establishes a connection with the specified MCP server using standard I/O (stdio).
  2. It retrieves the list of available tools from the MCP server.
  3. These tools are provided to the Anthropic API when sending messages.
  4. When Claude decides to use a tool, it sends a tool_use request.
  5. The client intercepts this request, calls the corresponding tool on the MCP server with the provided arguments.
  6. The result from the MCP server is sent back to Claude as user input to continue the conversation.

This process allows for automated tool execution based on Claude’s reasoning, without intermediate user approval steps.

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers