Skip to main content

MCP API reference

The @agenite/mcp package provides a client implementation for the Model Context Protocol (MCP), enabling Agenite agents to access external data sources and tools through a standardized interface.

MCPClient

The main class for interacting with MCP servers.

Constructor

Parameters

Example

Methods

getTools

Retrieves tools from a specific MCP server.
Returns: A promise that resolves to an array of Tool instances.

getAllTools

Retrieves tools from all connected MCP servers as a flat array.
Returns: A promise that resolves to an array of Tool instances from all servers.

getAllToolsByServer

Retrieves tools from all connected MCP servers, organized by server.
Returns: A promise that resolves to an object mapping server names to arrays of Tool instances.

getServerNames

Returns the names of all configured servers.
Returns: An array of server name strings.

Interfaces

MCPServerConfig

Represents the configuration for an MCP server. This is a union type of MCPSSEConfig and MCPStdioConfig.

MCPSSEConfig

Configuration for connecting to an MCP server via Server-Sent Events (SSE).

MCPStdioConfig

Configuration for launching and connecting to an MCP server as a local process via standard I/O.

MCPToolCallResult

Represents the result of a tool call from an MCP server.

Usage examples

Basic usage

Using multiple servers

Getting server names

Integration with Agenite

The tools returned by the MCP client are standard @agenite/tool instances and can be used directly with any Agenite agent:
For more detailed usage examples and guidance, see the MCP package documentation and the building a web research agent guide.