mcp-client

This repository provides a TypeScript implementation of a Model Context Protocol (MCP) client, enabling LLM agents to interact with MCP servers through stdio or HTTP+SSE transports, supporting resources, tools, prompts, and sampling.

22
0

MCP Client

A TypeScript implementation of a Model Context Protocol (MCP) client designed for LLM agents.

Installation

npm install mcp-client

Features

  • Implements the full MCP specification.
  • Supports stdio and HTTP+SSE transports.
  • Manages MCP server processes.
  • Integrates with Claude's native tool calling.
  • Offers a type-safe API with an event-based architecture and promise-based async/await functionality.
  • Supports MCP operations for Resources, Tools, Prompts, and Sampling.

Usage

Using with MCP Servers

Utilize standard MCP servers via npx, configuring them in mcp-config.json. The MCPConnectionManager facilitates connections to these servers, enabling access to tools like those from @modelcontextprotocol/server-memory or @modelcontextprotocol/server-filesystem.

Integration with Claude

Seamlessly integrates with Claude's tool calling by mapping MCP tools to Claude's tool definitions. Call tools using memoryClient?.callTool and send the results back to Claude.

Low-level Usage

For more control, use MCPClient directly with transports like StdioTransport to connect, list tools, and call them.

Available MCP Servers

Servers available via npx include @modelcontextprotocol/server-memory, @modelcontextprotocol/server-filesystem, @modelcontextprotocol/server-brave-search, @modelcontextprotocol/server-puppeteer, and @modelcontextprotocol/server-fetch.

Examples

Explore examples in the /examples directory, such as memory-app, llm-app, and llm-app-tools.

API Reference

Provides details on MCPConnectionManager and MCPClient classes, including methods for connection management, tool interaction, resource handling, and prompt retrieval.

Contributing

Contributions are welcome via Pull Requests.

License

MIT

Repository

ED
edanyal

edanyal/mcp-client

Created

December 2, 2024

Updated

March 24, 2025

Language

TypeScript

Category

AI