{"library":"mcp-client","title":"MCP Client for Node.js","description":"mcp-client is a Node.js client library designed for simplified interaction with servers implementing the Model Context Protocol (MCP). As of version 1.13.1, this library offers a more convenient and less verbose API compared to the official MCP TypeScript SDK, abstracting lower-level details such as pagination and direct Zod schema handling. It distinguishes itself by employing more conventional method names (e.g., `getTools` instead of `listTools`). The client supports `httpStream` (recommended) and `stdio` connection types, with Server-Sent Events (SSE) connections explicitly marked as deprecated. It provides comprehensive functionalities for tool discovery and invocation, resource management (reading, listing), prompt interaction (getting, listing, completing), and receiving logging messages from the MCP server. While a specific release cadence is not detailed, the version history and recent publish date indicate active development.","language":"javascript","status":"active","last_verified":"Sat Apr 25","install":{"commands":["npm install mcp-client"],"cli":null},"imports":["import { MCPClient } from 'mcp-client';","import type { MCPClientEvents } from 'mcp-client';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { MCPClient } from 'mcp-client';\nimport { z } from 'zod'; // Only needed if you use custom schemas\n\nasync function runClient() {\n  const client = new MCPClient({\n    name: \"MyAwesomeMCPClient\",\n    version: \"1.0.0\",\n  });\n\n  try {\n    // Connect using the recommended Streamable HTTP transport\n    await client.connect({\n      type: \"httpStream\",\n      url: process.env.MCP_SERVER_URL ?? \"http://localhost:8080/mcp\",\n    });\n    console.log('Connected to MCP server.');\n\n    // Ping the server to check connectivity\n    await client.ping();\n    console.log('Server responded to ping.');\n\n    // List all available tools\n    const tools = await client.getAllTools();\n    console.log('Available tools:', tools.map(t => t.name));\n\n    // Example: Call a simple 'add' tool\n    const addResult = await client.callTool({\n      name: 'add',\n      arguments: { a: 5, b: 3 }\n    });\n    console.log('Result of add(5, 3):', addResult);\n\n  } catch (error) {\n    console.error('MCP client encountered an error:', error);\n  } finally {\n    // Clean up if necessary (e.g., disconnect stdio processes)\n    // For httpStream, connection is typically stateless.\n  }\n}\n\nrunClient();","lang":"typescript","description":"Initializes an MCP client, connects via httpStream, pings the server, lists tools, and calls a basic tool.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}