> For the complete documentation index, see [llms.txt](https://docs.maiagent.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.maiagent.ai/tech/en/remote-mcp/remote-mcp.md).

# Remote MCP Service Overview

> This document aims to help readers who already have a basic understanding of Model Context Protocol (MCP) to explore **Remote MCP Cloud Services** in depth.

## 1. Why Choose Remote MCP Services?

Compared to traditional self-hosted tool integration services, Remote MCP services offer significant advantages:

| Consideration                   | Traditional Self-Hosted Solution                                                                 | Remote MCP Cloud Service                                                                                                    |
| ------------------------------- | ------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------- |
| **Infrastructure**              | Requires self-deployment, maintenance, and backend service scaling                               | Professionally managed by cloud providers, ensuring high availability, auto-scaling, and security compliance                |
| **Authentication**              | Authentication and authorization processes (like OAuth) need to be self-developed and maintained | Providers typically offer **Managed Auth** and secure credential storage services                                           |
| **Tool Ecosystem**              | Limited available tool set, new tool integration requires self-development                       | Usually integrates hundreds to thousands of ready-to-use tools and Actions, significantly accelerating development          |
| **Maintenance & Compatibility** | Must handle tool version upgrades and API compatibility issues independently                     | Platform continuously updates and maintains compatibility, client applications typically benefit without code modifications |

Common Application Scenarios:

* **Personal Task Assistant**: Directly calls developer-common services like GitHub, Slack, Linear to implement code generation, issue tracking, automatic Pull Request merging, and other functions.
* **Smart Customer Service & Ticket System Integration**: AI customer service uses Remote MCP to query customer data in real-time, create or update tickets in systems like Zendesk or Salesforce Service Cloud, and even process refunds and other customer service operations.
* **Automated Marketing Campaign Execution**: Marketing personnel can use natural language to instruct AI to operate marketing automation platforms like HubSpot through Remote MCP, such as: adding potential customer lists, sending personalized marketing emails, or dynamically adjusting advertising strategies.
* **Google Workspace Automation**: AI assistants use Remote MCP to read/write Gmail emails, manage Google Calendar schedules, search/manage documents in Google Drive, or read/update data in Google Sheets, achieving personal or team office automation.

***

## 2. Typical Architecture of Remote MCP Services

```mermaid
flowchart TD
    Agent["LLM / AI Assistant"]
    Server["Remote MCP Server (Cloud-Hosted)"]
    SDK["Client SDK"]
    Vault["Credentials Vault"]
    Runner["Tool Runner & Connectors"]

    Agent -- "WebSocket / SSE (Streaming Session)" --- Server
    Agent -. "JSON Tool Schema & Authentication Information" .- Server

    SDK -- "HTTPS (Secure Request)" --> Vault
    Vault -- "gRPC / Secure Channel" --> Runner
    Server --> Vault
    Server --> Runner
```

### 2.1 Client / AI Assistant SDK (Client / Agent SDK)

* Provides a standardized interface that enables an LLM or AI assistant to dynamically retrieve the list of available tools and their capability definitions (schemas) through an API such as `GET /tools`.
* It usually encapsulates common logic such as request retries, timeout controls, and JSON Schema-based input and output validation, reducing application-layer development complexity and improving robustness.

### 2.2 Streaming Session Layer

* A persistent streaming session is commonly established using **Server-Sent Events (SSE)** or **WebSocket** technology:
  * **Bidirectional streams**: Allow an AI assistant to make multiple consecutive tool calls during a single conversation lifecycle, enabling a more natural interactive experience.
  * This architecture works well in serverless environments such as AWS Lambda and Google Cloud Functions, making horizontal scaling easier to implement.

### 2.3 Authentication & Credentials Vault

* Users generally only need to complete an OAuth 2.0 authorization flow once in a trusted environment such as a browser. The resulting refresh token is encrypted and securely stored in the credentials vault.
* For each session or request, the credentials vault generates a strictly time-limited **Session Token** or **Signed JWT**, allowing the tool runner to access external services on the user's behalf for a limited period.

### 2.4 Tool Registry & Schema Store

* Standard formats such as the **OpenAPI Specification or JSON Schema** precisely describe each tool's (Action's) expected input parameters, data structures, and output formats.
* Tool definition **versioning** (for example, `v1.2.0` and `v2-beta`) preserves backward compatibility for older clients as tool capabilities evolve.
* Some advanced platforms also provide **AI-optimized schemas**—for example, automatically removing optional fields that are unnecessary for an LLM and supplying richer contextual examples—to help the LLM understand tool capabilities and usage more efficiently.

### 2.5 Execution Orchestrator

* As the central coordination component, the execution orchestrator parses incoming parameters according to the tool's schema and intelligently routes the request to the corresponding **Connector** or **Runner**.
* It commonly incorporates the **Circuit-Breaker** design pattern. When an external API connection fails or times out, the orchestrator can automatically retry with exponential backoff or fail fast with a clear error status such as HTTP 50x. This prevents cascading resource exhaustion and improves system resilience.

### 2.6 Observability & Governance

* **Distributed Tracing**: Each tool call generates a unique Trace ID, making it easier to follow the complete call chain across multiple microservices and simplifying troubleshooting and performance analysis.
* **Quota & Rate-Limit**: Fine-grained request quotas and rate limits—such as queries per second (QPS) and calls per minute (RPM)—can be configured by tenant, individual user, or specific tool to prevent service abuse.
* **Audit Log**: Key details of tool calls, including timestamps, sources, parameter summaries, execution results, and statuses, are recorded to meet enterprise compliance and security-audit requirements.

### 2.7 Multi-Tenant Isolation

* Access tokens for the target SaaS service are strictly bound to a specific Workspace Entity or tenant identifier. Rigorous access-control policies prevent unauthorized cross-tenant access and potential data leakage.
* Some platforms support **Bring-Your-Own-Key (BYOK)** encryption, allowing enterprises to encrypt sensitive data with encryption keys they manage themselves, thereby strengthening data sovereignty and control.

***

## 3. Typical Workflow (Sequence Diagram)

<figure><img src="https://3415477754-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNBTi475lqozGpB7xObpE%2Fuploads%2Fgit-blob-8b112117c9b20f54352b15da3da988e08232791f%2Fimage%20(1)%20(1)%20(1).png?alt=media" alt=""><figcaption><p>Workflow diagram</p></figcaption></figure>

1. **Discovery**: The AI assistant requests the list of available tools and their corresponding JSON Schemas from the Remote MCP service through a standardized API.
2. **Planning**: Based on the user's current intent and conversation context, the large language model (LLM) analyzes the request, generates an execution plan, and determines whether one or more tools (Actions) are needed.
3. **Invocation**: The AI assistant's SDK strictly formats the required parameters according to the selected tool's schema and securely sends the tool-call request to the Remote MCP service through an API.
4. **Authentication & Authorization**: The Remote MCP server first validates the API key included in the request, then checks whether the tenant or user is authorized to execute the specified tool.
5. **Execution**: After authentication and authorization succeed, the orchestrator dispatches the request and processed parameters to the registered Connector for the target external service. The Connector then interacts with that service, such as the Google Calendar API.
6. **Streaming Response**: Tool execution results, which may include intermediate status updates or final data, are returned to the AI assistant in real time as JSON chunks or a complete object over a streaming protocol such as SSE or WebSocket.
7. **Post-Processing**: After receiving the response, the AI assistant's SDK validates its format and completeness against the tool's schema. If validation fails, tool execution encounters an error, or the result does not meet expectations, the SDK may trigger an automatic retry where appropriate or submit the error information and context to the LLM for its next decision—for example, correcting input parameters, asking the user for clarification, or trying another tool.

***

## 4. Using Remote MCP in MaiAgent

By integrating MCP services, the MaiAgent platform gives its AI assistants powerful access to external tools. This enables seamless interaction with a wide range of third-party services and significantly improves productivity and service quality.

### 4.1 Integration Features and Benefits

* **Simplified tool configuration**: MaiAgent users only need to provide the Remote MCP server URL and complete authentication. They do not need to manage complex API keys, OAuth authorization flows, or connector code.
* **Rich tool ecosystem**: Through Remote MCP providers such as Composio and Zapier MCP, MaiAgent users can immediately access hundreds of pre-integrated tools and services, including:
  * **Productivity suites**: Google Workspace, Notion, Slack
  * **Project management**: Jira, Asana, Trello, Monday.com
  * **Customer relationship management**: Salesforce, HubSpot, Zendesk
  * **Development tools**: GitHub, Bitbucket, Linear
* **Fine-grained permission management**: Administrators can assign each AI assistant a specific set of MCP tools, ensuring that the assistant can access only the services and capabilities required for its work.

### 4.2 Typical Use Cases

* **Administrative assistant**: An AI assistant can directly manage schedules (create, modify, or cancel meetings), organize email inboxes, prepare meeting summaries, and update shared documents.
* **Customer support**: An AI assistant can look up order status, create support tickets, update customer records, and even handle simple refund or order-change requests.
* **Development team collaboration**: An AI assistant can help create Issues, assign tasks, update project status, and retrieve specific information from a codebase.
* **Data analysis and reporting**: An AI assistant can retrieve external data from sources such as Web Search and Salesforce, then generate formatted reports or visualizations.

### 4.3 MaiAgent-Specific Security and Privacy Protections

* **Data-flow control**: MaiAgent enforces strict data-flow controls to ensure that sensitive information is transmitted only between authorized tools and assistants.
* **Activity auditing**: Every tool call is recorded in a detailed audit log, including the call time, user, operation performed, and a summary of the result.
* **Dynamic configuration**: AI assistant administrators can adjust or revoke an assistant's configured tools at any time through the MaiAgent platform, with changes taking effect immediately.

***

### References

* [Model Context Protocol Spec 0.4](https://modelcontextprotocol.io/specification/2024-11-05)
* [Server-Sent Events for Tool Calling (Blog, 2024)](https://www.honeycomb.io/blog/mcp-easy-as-1-2-3)
* [Designing OAuth Vault for AI Agents (Whitepaper, 2025 Q1)](https://assets.ctfassets.net/2ntc334xpx65/6gCPuASKatuu1n1bsgaKX1/db160ef1b6a3023260129595f4bd3d41/Auth0_for_GenAI.pdf)
* [CNCF Webinar: LLM × Remote Execution Patterns](https://www.cncf.io/online-programs/cncf-on-demand-webinar-design-patterns-for-agentic-ai-infoq-webinar/)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.maiagent.ai/tech/en/remote-mcp/remote-mcp.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
