# Create MCP Tools

## What is MCP?

MCP, or Model Context Protocol, can be used to integrate multi-cloud platform services or run local client applications.

Think of tool usage like a plug - you need to plug it in to access the service. Traditionally, each LLM develops its own tool usage method, like different plug specifications requiring various socket types. To enable both OpenAI and Claude to use Google Calendar services, developers need to design multiple scripts for different AIs.

When Google Calendar updates, developers may need to:

1. Update 3 different integration versions simultaneously
2. Maintain 3 different technical documents

This leads to extended development timelines and increased costs.

### **MCP Solution**

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

1. Standardized tool definition format
2. Unified communication protocol
3. Consistent error handling mechanisms

These simplify the development process.

Using MCP, developing a tool only requires:

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

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

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

## Quick MCP Tool Setup

### 1. Access Tool Management Interface

First, navigate to the "<mark style="color:blue;">AI Features</mark>" section from the left sidebar, then click "<mark style="color:blue;">🔧 Tools</mark>". Once on the tools list page, click the "<mark style="color:blue;">➕ Add Tool</mark>" button in the top right corner.

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

### 2. Select Tool Type

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

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

### 3. Set Display Name

Set a clear display name for the tool, here set as <mark style="color:blue;">Composio mcp for google calendar</mark>.

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

* **Purpose**: This name will be displayed in the platform interface for all users to view.
* **Recommendation**: Choose a name that clearly expresses the tool's primary function for easy user understanding. There are no strict format restrictions for this name.

### 4. Fill in MCP Configuration

#### a. 🔗MCP Server URL

* **Purpose**: MaiAgent currently accepts external MCP servers. By providing the MCP server's service address (URL), AI assistants can invoke MCP services to connect to external applications.
* **Format**:
  * Please provide the complete URL (e.g., `https://mcp.dev/maiagent/mcp_service`).
* **Note**: This field is required.

{% hint style="info" %}
For instructions on obtaining an MCP URL, please 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 tools connected to that server:

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

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

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

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

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

<figure><img src="/files/0ZzNchwIK1B3EYEVzpB1" alt="MCP command arguments configuration diagram"><figcaption><p>Setting MCP Command Arguments</p></figcaption></figure>

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

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

* **Purpose**: Set necessary environment variables for the MCP command execution environment.
* **Format**: Must be a valid JSON object, where the key is the environment variable name and the value is the environment variable content (string).
  * **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 diagram"><figcaption><p>Setting MCP Environment Variables</p></figcaption></figure>

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

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

After clicking, the system will automatically retrieve the tool content connected to that server and display 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>Tool names defined by MCP</p></figcaption></figure>

### 6. 💾 Save 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, it's recommended to test whether the MCP connection is working properly
* Verify tool functionality in a test environment

**Permission Management**

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

**Troubleshooting**

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


---

# Agent Instructions: 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:

```
GET https://docs.maiagent.ai/maiagent-user-guide/maiagent-user-guide-en/tools/setup.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
