MaiAgent MCP: Let External AI Tools Operate the Platform
Use MaiAgent MCP to operate the platform from MCP-compatible AI tools such as Claude and Cursor: service endpoint and available tools, API Key and OAuth connections, verification, and troubleshooting
This page is for developers who want to let AI tools such as Claude Code, Claude Desktop, and Cursor operate the platform through MaiAgent MCP. It covers the service endpoint and available tools, API Key and OAuth connection setup, connection verification, and troubleshooting. For an introduction to MCP itself, see MCP (Model Context Protocol).
1. What Is MaiAgent MCP?
MaiAgent MCP is the official remote MCP (Model Context Protocol) service provided by MaiAgent. Add it to an MCP-compatible AI tool such as Claude Code, Claude Desktop, or Cursor to operate the MaiAgent platform directly using natural language, for example:
“Create a customer service Agent for me using the Claude Sonnet model.”
“List all the knowledge bases in my organization and upload this FAQ to the product knowledge base.”
“Check yesterday's conversation records and summarize the questions users ask most often.”
Service endpoint
https://mcp.maiagent.ai/mcp
Transport
Streamable HTTP (remote connection, no local software installation required)
Authentication
API Key (in an HTTP header), or OAuth 2.1 (members sign in to MaiAgent in a browser and grant authorization)
Coverage
The full MaiAgent platform API: more than 300 endpoints for Agents, knowledge bases, conversations, tools, organization management, and more
Available Tools
Once connected, your AI tool receives the following six tools. The AI combines them automatically (search for an API, look up its specification, then execute it), so you do not need to memorize any API details:
debug_auth
Check whether authentication is configured correctly
list_api_categories
List all API categories
search_apis
Search API endpoints by category or keyword
get_api_details
Retrieve the full specification of a specific API (parameters, request body, and response format)
call_api
Execute an API call
refresh_schema
Force a reload of the API list (use when a newly released API cannot be found; normally updates automatically every 5 minutes)
Tool Input Formats
debug_auth, list_api_categories, refresh_schema
None
—
search_apis
category (string, optional), search (string, optional), limit (number, optional, default 20)
search accepts multiple space-separated terms; every term must match. Returns matching endpoints and their operation_id
get_api_details
operation_id (string, required)
Returns the endpoint's path, method, parameters, and request and response structures
call_api
operation_id (string, required), path_params (object, optional), query_params (object, optional), body (object, optional)
Executes the call; all three objects are flat “name → value” objects
Rules for call_api:
operation_idis the operationId shown for each endpoint in the API documentation, such asv1KnowledgeBasesFilesList.Keys in
path_paramscorrespond to the{…}names in the path (such asknowledgeBasePk). Values are URL-encoded before substitution. If a path parameter is missing, the call fails without sending a request.query_paramsbecomes the query string directly.bodyis sent as JSON and is only needed forPOST/PUT/PATCH.Authentication uses the API Key or OAuth token from the connection. You do not need to include a key in the parameters; permissions match the member's role.
Responses larger than 50,000 bytes are truncated and marked as such. Use pagination parameters or filters to reduce the results.
Errors returned by the API (
400,403,404, etc.) are passed back to the AI unchanged. For the content format, see API Conventions: Error Responses.
For example, to “list the PDF files in a particular knowledge base,” the AI calls the tools in this order:
2. Prerequisites
Before you begin, choose an authentication method:
API Key
Individuals or automation scripts; works with any MCP client that supports custom headers
An API Key; see Get an API Key below
OAuth
Multiple members connecting with their own accounts, without pasting keys into configuration files
An administrator must first create an OAuth application; see Prepare an OAuth Application below
Both methods grant the same permissions as the member's own role.
Get an API Key
Sign in to the MaiAgent Admin Console, click your avatar in the upper-right corner → Account → switch to the API Keys tab → click Create Key, then copy the generated API Key.
For details, see Personal Account Settings: API Keys in the user manual. For administrators issuing keys on behalf of members, see API Key Management.
Prepare an OAuth Application
Before connecting with OAuth, an administrator with “OAuth application management permissions” must create an application in the organization:
Go to Organization Settings → Organization Overview → Management Actions → OAuth Applications, then click Create Application.
Set Application Type to Public.
In Redirect URIs, enter the URL to which the MCP client redirects after authorization. It must exactly match the URL the client actually uses, such as
https://claude.ai/api/mcp/auth_callbackfor Claude on the web. For Claude Code, see Connect with OAuth below.After creation, provide the Client ID to the members who will connect.
For the full procedure, see OAuth Applications in the user manual.
3. Connection Setup
Choose the setup method for your AI tool. The following examples use an API Key. Replace <YOUR_API_KEY> with the API Key you obtained in the prerequisites. To use OAuth instead, see Connect with OAuth.
Run in your terminal:
-s user makes the connection available in all projects. To use it only in the current project, change this to -s project (the configuration is written to .mcp.json in the project root).
You can also edit .mcp.json manually:
Edit the Claude Desktop configuration file (macOS: ~/Library/Application Support/Claude/claude_desktop_config.json; Windows: %APPDATA%\Claude\claude_desktop_config.json) and add:
Save the file and restart Claude Desktop.
Edit ~/.cursor/mcp.json (global) or .cursor/mcp.json in your project and add:
After saving, go to Cursor Settings → MCP and confirm that maiagent is shown as connected.
Any MCP client that supports remote Streamable HTTP connections can use this service. Key settings:
Server URL
https://mcp.maiagent.ai/mcp
Transport
Streamable HTTP
Header:Authorization
Api-Key <YOUR_API_KEY>
Connect with OAuth
When connecting with OAuth, do not include an Authorization header in the configuration. On the first connection, the MCP client receives a response from MaiAgent MCP requesting authorization, then opens a browser for you to sign in to MaiAgent. The authorization page shows the application name, its organization, and the currently signed-in account. Confirm these details and click “Authorize” to complete the process. The client then renews authorization automatically, so you do not need to sign in each time.
MaiAgent does not support dynamic client registration. The MCP client must allow you to enter a pre-created Client ID.
Run in your terminal (8765 can be replaced with any fixed port):
Register http://localhost:8765/callback in the OAuth application's Redirect URIs. The port must match --callback-port.
After setup, enter /mcp in Claude Code, select maiagent, and follow the prompts to complete authorization in your browser.
Add a custom connector in Claude's connector settings: enter https://mcp.maiagent.ai/mcp as the URL, enter the OAuth Client ID in the advanced settings, then follow the prompts to connect and complete authorization.
Register https://claude.ai/api/mcp/auth_callback in the OAuth application's Redirect URIs.
The client must support MCP OAuth authorization (authorization code + PKCE) and allow you to enter a pre-registered Client ID:
Server URL
https://mcp.maiagent.ai/mcp
Transport
Streamable HTTP
OAuth Client ID
The OAuth application's Client ID
Redirect URI
The callback URL actually used by the client; must be registered in the OAuth application
For authorization server endpoints and protocol details, see MaiAgent as an OAuth 2.1 Authorization Server.
4. Verify the Connection
After setup, ask the AI in your AI tool to call debug_auth (for example, enter “Call maiagent's debug_auth tool to check the connection”). You should see:
If has_auth_header is true, the configured authentication is included. When connecting with OAuth, auth_header_preview starts with Bearer. It is normal for organization_id to show null: the organization to operate in is determined by the API Key or the organization that owns the OAuth application. To confirm that calls actually succeed, ask the AI to run a query next (for example, “List all my Agents”).
5. Start Using the Service
Once connected, give instructions directly in natural language. The AI automatically follows the search_apis → get_api_details → call_api flow to find and execute the appropriate API. Here are some useful examples:
Query: “List all my Agents”, “Who are the members of this organization?”
Create: “Create an Agent named ‘Product Support’ with the role instructions…”
Knowledge base: “Create a new knowledge base and list the files currently in it.”
Operations: “Check recent conversations for the ‘Product Support’ Agent and summarize common questions for me.”
6. Troubleshooting
API calls return 401
The API Key is incorrect, revoked, or disabled. Confirm the format is Api-Key <YOUR_API_KEY> (with one space between Api-Key and the key).
Using an API Key, but the client asks you to sign in or says authentication is required
The configuration is not sending the Authorization header, so MaiAgent MCP asks the client to use OAuth instead. Check how the header is configured. To use OAuth, configure the Client ID as described in Connect with OAuth.
Redirect URI mismatch during OAuth authorization
The client's callback URL does not match the one registered in the OAuth application. Confirm that the scheme, host, port, and path are exactly the same.
Cannot sign in on the OAuth authorization page
The authorization page supports only Email and password sign-in. Accounts that use only SSO should use an API Key instead.
Operating in the wrong organization (expected Agents/knowledge bases are not found)
An API Key is bound to the “organization selected when the key was created.” Switch to the correct organization, create a new key, and update the configuration file. OAuth operations apply to the organization that owns the application; use the Client ID for the correct organization.
The tool list is empty
The connection was not established successfully. Restart the AI tool. In Claude Code, use /mcp to check the connection status.
Claude Code shows Pending approval
A project-level (-s project) MCP server must be trusted before it can connect. Start interactive Claude Code and follow the prompts to approve it.
Permission errors when executing APIs
call_api executes using your identity and can only operate on resources your account has permission to access. Check your role permissions in that organization.
Last updated
Was this helpful?