Skip to main content

MCP API

The MCP (Model Context Protocol) API provides comprehensive access to MCP servers and tools, enabling you to discover, configure, and execute tools across multiple servers.

Overview

The MCP module enables you to:

  • Discover Servers: Find available and enabled MCP servers
  • Manage Tools: List, configure, and execute tools
  • Search: Search for servers and tools by query
  • Configure: Set up servers and tools with custom configurations

Quick Start Example

// Get enabled MCP servers
const enabledServers = await codebolt.mcp.getEnabledMCPServers();
console.log('Enabled servers:', enabledServers);

// Get all tools from enabled servers
const allTools = await codebolt.mcp.getAllMcpTools();
console.log('Available tools:', allTools);

// Execute a tool
const result = await codebolt.mcp.executeTool(
'server-name',
'tool-name',
{ param1: 'value1' }
);
console.log('Execution result:', result);

Common Use Cases

Tool Discovery

Discover and explore available tools:

async function discoverTools() {
// Get list of all MCP servers
const servers = await codebolt.mcp.getMcpList();

// Get tools from specific servers
const tools = await codebolt.mcp.getMcpTools(['server1', 'server2']);

return { servers, tools };
}

Tool Execution

Execute tools with parameters:

async function runTool(server, tool, params) {
const result = await codebolt.mcp.executeTool(server, tool, params);
return result;
}

Response Structure

MCP API functions return typed responses:

Server Discovery:

Tool Operations: