New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@purinton/mcp-client

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

@purinton/mcp-client

A robust Node.js client for connecting to Model Context Protocol (MCP) servers with automatic reconnect, authentication, and flexible transport support.

latest
Source
npmnpm
Version
1.0.7
Version published
Maintainers
1
Created
Source

Purinton Dev

@purinton/mcp-client npm versionlicensebuild status

A robust Node.js client for connecting to Model Context Protocol (MCP) servers with automatic reconnect, authentication, and flexible transport support.

Table of Contents

Features

  • Connects to MCP servers with automatic reconnect
  • Supports both ESM and CommonJS
  • Customizable log, transport, and client classes
  • Reads configuration from environment variables or options
  • TypeScript type definitions included

Installation

npm install @purinton/mcp-client

Usage

ESM Example

import mcpClient from '@purinton/mcp-client';

(async () => {
  try {
    const client = await mcpClient({
      // token: 'your-mcp-token',
      // baseUrl: 'http://localhost:1234/',
    });
    console.log('MCP Client connected:', !!client);
    // Use the client as needed...
  } catch (err) {
    console.error('Failed to connect MCP Client:', err);
  }
})();

CommonJS Example

const mcpClient = require('@purinton/mcp-client');

(async () => {
  try {
    const client = await mcpClient({
      // token: 'your-mcp-token',
      // baseUrl: 'http://localhost:1234/',
    });
    console.log('MCP Client connected:', !!client);
    // Use the client as needed...
  } catch (err) {
    console.error('Failed to connect MCP Client:', err);
  }
})();

API

mcpClient(options?: McpClientOptions): Promise<any>

Creates and connects an MCP client. Returns a connected client instance. Automatically reconnects on disconnect.

Options (McpClientOptions)

  • log (optional): Custom log (default: @purinton/log)
  • port (optional): MCP server port (default: 1234)
  • baseUrl (optional): MCP server URL (default: http://localhost:1234/)
  • token (optional): Authentication token (default: from MCP_TOKEN env)
  • ClientClass (optional): Custom client class (default: SDK Client)
  • TransportClass (optional): Custom transport class (default: SDK StreamableHTTPClientTransport)

TypeScript

Type definitions are included:

import mcpClient, { McpClientOptions } from '@purinton/mcp-client';

const client = await mcpClient({
  token: 'your-mcp-token',
  baseUrl: 'http://localhost:1234/',
} as McpClientOptions);

Support

For help, questions, or to chat with the author and community, visit:

DiscordPurinton Dev

Purinton Dev on Discord

License

MIT © 2025 Russell Purinton

Keywords

mcp

FAQs

Package last updated on 11 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts