{"type":"mcp_client","name":"mcp-client","description":"This repository provides a convenient Node.js client for the Model Context Protocol (MCP), abstracting away complexities and offering a more user-friendly API for interacting with MCP servers. This repository provides","category":"Developer Tools","language":"TypeScript","stars":101,"forks":2,"owner":"punkpeye","github_url":"https://github.com/punkpeye/mcp-client","homepage":"https://glama.ai/mcp/clients","setup":"## Setup\n\nTo create a client:\n\n```ts\nimport { MCPClient } from \"mcp-client\";\n\nconst client = new MCPClient({\n  name: \"Test\",\n  version: \"1.0.0\",\n});\n```\n\nTo connect using `stdio`:\n\n```ts\nawait client.connect({\n  type: \"stdio\",\n  args: [\"--port\", \"8080\"],\n  command: \"node\",\n  env: {\n    PORT: \"8080\",\n  },\n});\n```\n\nTo connect using SSE:\n\n```ts\nawait client.connect({\n  type: \"sse\",\n  url: \"http://localhost:8080/sse\",\n});\n```","tools":"## Available Tools\n\n1.  Pinging the server (Checks if the server is reachable).\n2.  Calling a tool (Executes a specific tool with provided arguments).\n3.  Calling a tool with a custom result schema (Executes a tool and validates the result against a custom schema).\n4.  Listing tools (Retrieves a list of available tools).\n5.  Listing resources (Retrieves a list of available resources).\n6.  Reading a resource (Retrieves a specific resource by its URI).\n7.  Getting a prompt (Retrieves a specific prompt by its name).\n8.  Listing prompts (Retrieves a list of available prompts).\n9.  Setting the logging level (Configures the logging level of the client).\n10. Completing a prompt (Completes a prompt with a given argument).\n11. Listing resource templates (Retrieves a list of available resource templates).\n12. Receiving logging messages (Subscribes to and processes logging messages from the server).","faq":null,"created_at":"2025-03-11T04:25:57+00:00","updated_at":"2025-03-28T05:09:46+00:00","source_url":"https://model-context-protocol.com/clients/nodejs-mcp-client-model-context-protocol","related_articles":[]}