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.
A TypeScript implementation of a Model Context Protocol (MCP) client designed for LLM agents.
npm install mcp-client
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
.
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.
For more control, use MCPClient
directly with transports like StdioTransport
to connect, list tools, and call them.
Servers available via npx include @modelcontextprotocol/server-memory
, @modelcontextprotocol/server-filesystem
, @modelcontextprotocol/server-brave-search
, @modelcontextprotocol/server-puppeteer
, and @modelcontextprotocol/server-fetch
.
Explore examples in the /examples
directory, such as memory-app
, llm-app
, and llm-app-tools
.
Provides details on MCPConnectionManager
and MCPClient
classes, including methods for connection management, tool interaction, resource handling, and prompt retrieval.
Contributions are welcome via Pull Requests.
MIT
edanyal/mcp-client
December 2, 2024
March 24, 2025
TypeScript