Custom MCP

Overview

The Custom MCP connector enables your Leena AI Agents to connect to any remote Model Context Protocol (MCP) server, allowing your organisation to extend Leena AI with tools and capabilities exposed by your own or third-party MCP servers, without building a dedicated connector for each one.

Model Context Protocol (MCP) is an open standard that lets AI applications discover and invoke tools hosted on external servers through a consistent interface. The Custom MCP connector allows Leena AI to register a connection to any MCP-compliant server, automatically discover the tools that the server exposes, and make those tools available to your Agents as actions.

API Details

Leena AI integrates with remote MCP servers using the Model Context Protocol over Streamable HTTP (Server-Sent Events) transport.

Documentation link: https://modelcontextprotocol.io

Setup

The Custom MCP connector supports four authentication methods, allowing you to connect to public servers as well as servers protected by custom headers or OAuth 2.0:

  • No authentication: For public MCP servers that do not require credentials
  • Custom authentication: For servers that authenticate using HTTP headers (for example, an API key or bearer token)
  • Admin OAuth 2.0: OAuth 2.0 where an administrator authorises the connection once, and access is shared for the connection
  • User OAuth 2.0: OAuth 2.0 where each end user authorises individually with their own identity

Prerequisites

Before setting up the Custom MCP connector, ensure you have:

  • The remote URL of the MCP server you want to connect to
  • Network connectivity between Leena AI and the MCP server endpoint
  • For custom-header authentication: the API key, token, or header values required by the MCP server
  • For OAuth 2.0 authentication: the ability to register an OAuth client with the MCP server's authorization server, and the resulting Client ID and Client Secret
  • Access to your Leena AI workspace with connector management permissions

Get credentials

The credentials you need depend on the authentication method required by the target MCP server.

No authentication

No credentials are required. Use this option for public MCP servers that do not enforce authentication. You only need the MCP server's remote URL.

Custom authentication

Use this option when the MCP server expects authentication through HTTP headers (for example, an API key or a bearer token).

  1. Obtain the required header name(s) and value(s) from the MCP server's provider or documentation.
  2. Have these ready to enter as a JSON object when adding the connection (for example, an Authorization header carrying a bearer token, or a provider-specific API-key header).

Admin OAuth 2.0 / User OAuth 2.0

Use these options when the MCP server is protected by OAuth 2.0. Leena AI runs the OAuth 2.0 authorization code flow and automatically discovers the server's authorization and token endpoints from its published metadata (the server's .well-known OAuth 2.0 / OpenID configuration), so you only need to supply client credentials.

  1. Register an OAuth client (application) with the MCP server's authorization server. The exact steps vary by provider.
  2. Note the Client ID and Client Secret issued for that OAuth client.
  3. After the connection is created in Leena AI, copy the generated Redirect URI from Leena AI and add it to the list of allowed redirect URIs for your OAuth client.

The difference between the two OAuth options:

  • Admin OAuth 2.0: An administrator authorises the connection once, and the resulting access is shared for the connection.
  • User OAuth 2.0: Each end user authorises individually with their own identity, so tools run in the context of that specific user.

Add connection

Here is how to add a connection on Leena AI:

  1. Log in to your Leena AI workspace
  2. Navigate to Settings > Integrations
  3. Search for "Custom MCP" and select it from the list to add its new connector
  4. Start configuring the connector:
    1. MCP remote URL: The URL of the MCP server to connect to (for example, https://mcp-server.example.com)
    2. Authentication type: The authentication method for the MCP server (Pre-filled as 'No authentication')
    3. Provide the fields required for the selected authentication type (see the table below)
  5. Complete OAuth Flow and Save Configurations (applicable only for Admin OAuth 2.0 and User OAuth 2.0)
    1. Click Connect in Leena AI for the Custom MCP connector setup
    2. You'll be redirected to the MCP server's authorization page
    3. Sign in to the authorization server if prompted
    4. Click Allow to grant the requested permissions
    5. You'll be redirected back to Leena AI with a successful connection
    6. The connector will be saved
  6. Copy Redirect URI and Update OAuth Client (applicable only for OAuth authentication)
    1. Once the connector is saved in Leena AI, you can reopen the connector to view the Redirect URI
    2. Copy the Redirect URI from Leena AI
    3. Go to your OAuth client configuration on the MCP server's authorization server
    4. Add the Redirect URI to the list of allowed redirect URIs
    5. Save the changes

The following are the configuration parameters for the connection:

NameDescriptionApplies to
MCP remote URLThe URL of the remote MCP server to connect toAll authentication types
Authentication typeThe authentication method used by the MCP server (Pre-filled as 'No authentication')All authentication types
Authentication headersThe HTTP headers sent with every request to the MCP server, entered as a JSON objectCustom authentication
Client IDThe OAuth client ID issued by the MCP server's authorization serverAdmin OAuth 2.0, User OAuth 2.0
Client SecretThe OAuth client secret issued by the MCP server's authorization serverAdmin OAuth 2.0, User OAuth 2.0
Redirect URIThe callback URL for the OAuth flow (Auto-generated by Leena AI)Admin OAuth 2.0, User OAuth 2.0

Actions

The Custom MCP connector does not ship with a fixed set of actions. Instead, once a connection to a remote MCP server is established, Leena AI automatically discovers every tool that the MCP server exposes and makes each one available as an action that your Agents can invoke.

How actions work for this connector:

  • Dynamic discovery: The list of available actions is determined entirely by the connected MCP server. Leena AI queries the server for its tools at runtime and surfaces each tool as an action. The available actions can change whenever the server adds, removes, or updates its tools.
  • Action names: Each discovered tool is surfaced using the tool's own name (presented in a readable, title-case form) and its description, exactly as defined by the connected MCP server.
  • Input parameters: Input parameters are defined dynamically by each tool's own input schema, as published by the MCP server. Because these schemas are specific to each server and tool, they are not enumerated here; the Agent reads each tool's schema at runtime to determine the required and optional inputs.
  • Response: The connector returns the output produced by the invoked tool, as returned by the MCP server, back to the Agent.


Did this page help you?