> 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/maiagent-user-guide/maiagent-user-guide-en/tools/mcp-setup.md).

# Create an MCP Tool

## What Is MCP?

MCP, or Model Context Protocol, is used to integrate multi-cloud platform services or execute local client applications.

Think of tool usage like electrical plugs — the plug must be connected to power before the service can be used. Traditionally, each LLM develops its own tool usage methods, like plugs of different standards that require multiple socket types. If you want both OpenAI and Claude to use Google Calendar services, developers need to build multiple scripts for different AIs.

When Google Calendar updates, developers may need to:

1. Update 3 different integration versions simultaneously
2. Maintain 3 separate sets of technical documentation

This leads to extended development timelines and excessive costs.

### **MCP Solution**

MCP is a standardized protocol designed to solve this problem through:

1. Standardized tool definition formats
2. Unified communication protocols
3. Consistent error handling mechanisms

These approaches simplify the development process.

With MCP, developing a tool requires only:

1. Building an MCP Server (one-time development)
2. Defining standardized tool specifications
3. Implementing unified business logic
4. All AI platforms that support MCP can use it

<figure><img src="/files/MPib6SUwta3TkQDIbOTz" alt=""><figcaption><p>Before and after MCP integration</p></figcaption></figure>

MCP is fundamentally a protocol designed for **standardizing AI tool integration**, enabling development teams to "<mark style="color:blue;">build once, use everywhere</mark>," significantly reducing the complexity and maintenance costs of the AI assistant tool ecosystem.

## Quick MCP Tool Setup

### 1. Access the Tool Management Interface

From the left navigation panel, go to the "<mark style="color:blue;">AI Features</mark>" section, then click "<mark style="color:blue;">🔧 Tools</mark>." On the tool list page, click the "<mark style="color:blue;">➕ Add Tool</mark>" button in the upper right corner.

<figure><img src="/files/s2HRgUh4CTJqz43tH2KU" alt="Tool list page and add button"><figcaption><p>Click "➕ Add Tool" to get started</p></figcaption></figure>

### 2. Select the Tool Type

Select <mark style="color:blue;">MCP</mark> as the tool type.

<figure><img src="/files/Ic83pECbM7c6o5RbAkFZ" alt=""><figcaption></figcaption></figure>

### 3. Set the Display Name

Set a clear display name for the tool. In this example, set it to <mark style="color:blue;">Composio mcp for google calendar</mark>.

<figure><img src="/files/nCzTMqmDgc3koTZhDRTe" alt=""><figcaption></figcaption></figure>

* **Purpose**: This name is displayed on the platform interface for all users to see.
* **Recommendation**: Choose a name that clearly describes the tool's main function for easy user understanding. There are no strict formatting requirements for this name.

### 4. Fill In the MCP Configuration

#### a. 🔗 MCP Server URL

* **Purpose**: MaiAgent currently accepts external MCP servers. By providing the MCP server's service URL, the AI assistant can call the MCP service to connect to external applications.
* **Format**:
  * Enter the full URL (e.g., `https://mcp.dev/maiagent/mcp_service`).
* **Note**: This field is required.

{% hint style="info" %}
For instructions on obtaining an MCP URL, refer to [Technical Manual — Remote MCP Service Overview](https://docs.maiagent.ai/tech/remote-mcp/remote-mcp)
{% endhint %}

Paste your MCP server URL here, and the system will automatically retrieve the list of connected tools from that server:

<figure><img src="/files/VqPHHuLvfJTLGM5xKtyV" alt=""><figcaption></figcaption></figure>

#### b. 🎛️ MCP Command Arguments (mcp\_args)

{% hint style="warning" %}
If you don't need to set specific environment variables, this field can be left empty.
{% endhint %}

* **Purpose**: Define parameter names that need to be passed when executing MCP commands or calling MCP services. The content is automatically generated by the AI assistant.
* **Format**: Use JSON array format, where each element is a string representing a parameter.
  * **Example** (JSON array):

    ```json
    [
        "--user",
        "admin",
        "--config",
        "/path/to/config.yaml"
    ]
    ```
  * **At runtime**: The AI assistant passes these parameters to the MCP tool in order
  * If you enter a comma-separated string (e.g., `arg1,arg2,arg3`), the system will attempt to parse it as a parameter list. To avoid ambiguity, use JSON arrays.

<figure><img src="/files/0ZzNchwIK1B3EYEVzpB1" alt="MCP command arguments configuration"><figcaption><p>Configure MCP command arguments</p></figcaption></figure>

#### c. 🌳 MCP Environment Variables (mcp\_env)

{% hint style="warning" %}
If you don't need to set specific environment variables, this field can be left empty.
{% endhint %}

* **Purpose**: Set required environment variables for the MCP command execution environment.
* **Format**: Must be a valid JSON object where keys are environment variable names and values are environment variable contents (strings).
  * **Example**:

    ```json
    {
      "API_KEY": "{{SECRET_MCP_API_KEY}}",
      "REGION": "us-west-1",
      "DEBUG_MODE": "true"
    } 
    ```

<figure><img src="/files/tB1guv5oLKHaYI1Bnl8d" alt="MCP environment variables configuration"><figcaption><p>Configure MCP environment variables</p></figcaption></figure>

### 5. Find "<mark style="color:blue;">Allowed Tools (JSON Array)</mark>" and Click Refresh

* **Purpose**: Specify which sub-tools the AI assistant is authorized to use under this MCP client. A single MCP client may provide multiple different features or sub-tools.
* **Auto-detect/Leave empty**: If this field is left empty or not provided, the system will attempt to auto-detect all available sub-tools when first connecting to the MCP client, and allow all detected sub-tools by default. If you want to restrict the AI assistant to only specific sub-tools, explicitly list them here.

After clicking, the system automatically retrieves the tool content connected to that server and displays it in the list:

<figure><img src="/files/NYw6eukK0Z5K9gRK9F4i" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/gj0RVRm1fofj7zAiypxE" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/jp9SsM7p0Vpg9jI0nfkH" alt=""><figcaption><p>MCP-defined tool names</p></figcaption></figure>

### 6. 💾 Save the Tool

After confirming all settings are correct, scroll to the bottom of the page and click the "<mark style="color:blue;">Confirm</mark>" button. Your new tool is now created!

<figure><img src="/files/nPlvDTezi4YfK6ydJYAG" alt=""><figcaption></figcaption></figure>

## ⚠️ Important Reminders

**Connection Testing**

* After creating the tool, test the MCP connection to ensure it works properly
* Verify tool functionality in a test environment

**Permission Management**

* Carefully select allowed tools to avoid authorizing unnecessary features
* Regularly check tool usage status

**Troubleshooting**

* If the connection fails, check whether the MCP server URL is correct
* Confirm that environment variables and parameter formats meet the requirements


---

# 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/maiagent-user-guide/maiagent-user-guide-en/tools/mcp-setup.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.
