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
Parameter | Type | Description |
---|---|---|
config.mcpServers | { [name: string]: MCPServerConfig } | Configuration for MCP servers |
config.name | string | Optional client name (defaults to ‘mcp-client’) |
config.version | string | Optional client version (defaults to ‘1.0.0’) |
Example
Methods
getTools
Retrieves tools from a specific MCP server.Parameter | Type | Description |
---|---|---|
serverName | string | Name of the server to get tools from |
Tool
instances.
getAllTools
Retrieves tools from all connected MCP servers as a flat array.Tool
instances from all servers.
getAllToolsByServer
Retrieves tools from all connected MCP servers, organized by server.Tool
instances.
getServerNames
Returns the names of all configured servers.Interfaces
MCPServerConfig
Represents the configuration for an MCP server. This is a union type ofMCPSSEConfig
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: