MCP Server
TheĀ Model Context Protocol (MCP) is a standard that enables AI applications to external systems.
In VTENEXT, this standard is used to expose REST APIs, custom methods and processes to AI applications, to enable them to interact with the CRM itself.
Currently VTENEXT has set up a basic MCP server with the main webservices (referred here as tools) that ensure a wide extent of interoperability with the CRM; the user can choose to extend this server by registering other webservices to it, or even create custom tools to be used with the servers. Be mindful that, with roughly more than 30 tools registered to a MCP server, the accuracy of the server might degrade.
In VTENEXT, the MCP servers are fundamentally handled like any other webservice, but they have their own SDK methods to work with them.
Tools registered in the base MCP server (REST name: mcp)
tools_manualget_current_contextconvert_leadcreatedeletedescribelisttypesqueryrelateretrieveretrieveInventoryget_currenciesupdateRecord
Other (experimental) MCP servers
vtenext also has available two more MCP servers (listed here by their REST name): mcp.ws, which has registered plenty of the touch and processes webservices, and mcp.modcomments, which has registered the modcomments methods.
Please note that their use is experimental, and they are not known to work as well as the base MCP server (which has far fewer tools but can still cover most of the CRM).
Suggested prompt template
You are a helpful AI bot for vtenext, a fork of Vtiger.
DO NOT mention Vtiger whatsoever, say `vtenext`.
Mind to pass the parameters required by the tools.
SDK methods for working with MCP servers
Setting up a MCP server
SDK::setMcpServer(string $name, ?string $description = null, bool $isActive = true, ?string $operationName = null)
$name: the name of the MCP server;$description: human-readable description of the MCP server;$isActive: set it tofalseto prevent the Server from accepting requests;$operationName: the name to give to the corresponding REST Webservice method; defaults to the name of the MCP server prefixed withmcp..
This function returns the id of the MCP server if created successfully, and false otherwise.
Registering a tool to a MCP server
SDK::registerMcpTool(string $mcp, string $name, string $type, ?string $tool_name = null, ?string $description = null)
$mcp: the name of the MCP server;$name: the name of the webservice method or the custom MCP tool;$type: the type of the tool to register, can beoperationfor the webservice method orcustomfor the custom tool;$tool_name: the name to give to the registered tool, defaults to$name;$description: MCP-specific information to give to the registered tool, will take precedence over any information provided by the webservice method/custom tool.
If successful, this function returns an array with the id of the MCP server and the id of the webservice method/custom tool; this function returns false on failure.
Defining a custom tool for MCP servers
SDK::setMcpTool(string $name, string $handlerFilePath, ?string $handlerMethodName = null, ?string $description = null, ?array $inputSchema = null, ?array $outputSchema = null)
$name: the name of the custom tool;$handlerFilePath: file path where the function is defined;$handlerMethodName: name of the function to use from the specified handler file;$description: informative description of the custom tool;$inputSchema: the definition of the function input;$outputSchema: the definition of the function output.
$inputSchema and $outputSchema follow the JSON Schema 2020-12 Specification.
N.B.: the function should always return an array and, if possible, the array should be associative.
Removing a MCP server
SDK::unsetMcpServer(string $mcp, bool $force = false)
$mcp: the name of the MCP server to delete;$force: iftrue, force the deletion of the MCP server, even if it has tools registered to it.
This function returns true on success and false on failure.
Deregistering a tool from a MCP server
SDK::unregisterMcpTool(string $mcp, string $name, string $type)
$mcp: the name of the MCP server;$name: the name of the tool to deregister;$type: the type of the tool to deregister, can beoperationorcustom.
This function returns true on success and false on failure.
Deregistering a custom tool
SDK::unsetMcpTool(string $name)
$name: name of the custom tool to delete.
This function returns true on success and false on failure.