Skip to main content

LoyJoy Agent as MCP Server

Every agent you create in LoyJoy can be used as a MCP server. Model Control Protocol (MCP) is a protocol that allows you to control the agent from an external application. This means you can use the agent as a server to handle requests and responses, making it a powerful tool for building interactive applications.

How to use an agent as a MCP server

You can use the agent as a MCP server by sending requests to the agent's URL. The URL format is as follows:

https://app-stable.loyjoy.com/mcp/<AGENT_ID>

You can find the <AGENT_ID> if you open an agent and use the ID from the URL in your browser. For example, if the URL is https://cloud.loyjoy.com/processes/12345, then the <AGENT_ID> is 12345.

The authorization for the MCP server is done using an API key from the tenant. While you're logged in, open the API settings screen, select any role such as knowledge_viewer and click on the "Create" button. This will generate a new API key for you. You can use this key to authorize your requests to the MCP server with Authorization: Bearer <API_KEY> header.

In the agent there needs to exist a single AI Agent process module. In the AI Agent module, you can configure the tools that should be made available via the MCP server. If no such AI Agent module exists, the MCP endpoint will throw an HTTP status 400 error.

danger

Be sure to publish the agent after making changes to the AI Agent module to ensure the MCP server reflects the latest configuration.