# Use an MCP Server tool to connect agents to external systems

Tools allow agents to interact with repositories and data sources, expanding what they can do beyond generic knowledge. By the end of this quickstart, you will have an AI agent capable of retrieving external data through the [Deepwiki MCP Server](https://docs.devin.ai/work-with-devin/deepwiki-mcp) tool and returning responses in a structured output format.

<figure><img src="https://3750561495-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaD6wuPRxnEQEsYpePq36%2Fuploads%2FqK4JkAesYbo4d5EF5iFw%2FQS%20%233%20(English).gif?alt=media&#x26;token=5ec2f2f0-8a19-4905-808a-06fcd94cd2dc" alt=""><figcaption></figcaption></figure>

## **What is an MCP Server tool?**

An **MCP (Model Context Protocol)** tool enables an Agent to connect to external systems and data sources. Rather than depending only on its pre-trained context, the Agent can retrieve curated information and use it to generate accurate and up-to-date outputs.

## **Prerequisites**

Before you begin, make sure you have the following:

* An API key from an LLM provider (for example, OpenAI, Anthropic, or Google).
* The API key registered in Digibee as a **Secret Key** account. For details, see [how to create a Secret Key account](https://app.gitbook.com/s/jvO5S91EQURCEhbZOuuZ/platform-administration/settings/accounts#secret-key).

Next, add the [**Agent Component**](https://app.gitbook.com/s/EKM2LD3uNAckQgy1OUyZ/connectors/ai-tools/llm) to the pipeline right after the trigger and configure it as follows:

* **Model:** Select your preferred model (for example, **OpenAI – GPT-4o Mini**).
* **Account:** Click the gear icon next to the **Model** parameter, go to **Account**, and select the **Secret Key** account you created in Digibee.

Now that the basic configuration is complete, you can configure your MCP Tool and prompts.

## **Configuring an MCP Server tool**

### **Use case**

In this example, the agent connects to the [**DeepWiki MCP Server**](https://docs.devin.ai/work-with-devin/deepwiki-mcp), a free, remote service that provides access to public repositories. The goal is to retrieve technical knowledge about Event-Driven Architecture and transform it into structured documentation.

The agent will use an MCP Server tool combined with **System Message**, **User Message**, and a **JSON Schema**.

### **Step 1: Add the MCP Server tool**

1. In the [**Agent Component**](https://app.gitbook.com/s/EKM2LD3uNAckQgy1OUyZ/connectors/ai-tools/llm) configuration, click **+ (plus** button) in **Tools** and select **MCP Server**.
2. Configure the MCP Server with the following values:
   * **Name:** `DeepWiki`
   * **Server URL:** `https://mcp.deepwiki.com/mcp`

{% hint style="info" %}
Some MCP Servers require authentication to retrieve data. In these cases, configure the parameters below:

* **Account**
* **Custom Account**
* **Headers**
* **Query Parameters**
  {% endhint %}

3. Click **Confirm**.

Once configured, the agent can retrieve external data from the DeepWiki MCP server and use it as context.

### **Step 2: Define the prompts**

**System Message:** Establishes the Agent’s role and writing standards.

{% code overflow="wrap" %}

```
You are a technical documentation generator. Always write in clear and concise English, using a professional but simple tone.
Your task is to transform raw information retrieved from external tools into well-structured documentation.
Ensure your output is consistent, accurate, and aligned with the requested format.
```

{% endcode %}

**User Message:** Describes the specific task the Agent must perform using the MCP Tool.

{% code overflow="wrap" %}

```
Use the information retrieved about the topic "Event-Driven Architecture" to create a documentation section.
The documentation must include:
- A clear title. 
- A concise description (2–3 sentences).
- At least three practical use cases.
- At least three best practices.
Format the response strictly following the provided JSON schema.
```

{% endcode %}

### **Step 3: Define the JSON Schema**

Once the agent is properly configured, open the **Model** configuration and enable the **Use JSON Schema** option. The JSON Schema guarantees that the output is structured, validated, and ready for downstream consumption.

{% hint style="info" %}
If you are not familiar with this configuration, see the [**Turn AI responses into a structured JSON output** quickstart](https://docs.digibee.com/documentation/resources/quickstarts/turn-ai-into-structured-output).
{% endhint %}

{% code overflow="wrap" expandable="true" %}

```json
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "DocumentationSection",
  "type": "object",
  "required": ["title", "description", "use_cases", "best_practices"],
  "properties": {
    "title": {
      "type": "string",
      "description": "The title of the documentation section"
    },
    "description": {
      "type": "string",
      "description": "A concise description of the topic (2-3 sentences)"
    },
    "use_cases": {
      "type": "array",
      "description": "Practical use cases for the topic",
      "items": {
        "type": "string"
      },
      "minItems": 3
    },
    "best_practices": {
      "type": "array",
      "description": "Recommended best practices for the topic",
      "items": {
        "type": "string"
      },
      "minItems": 3
    }
  },
  "additionalProperties": false
}
```

{% endcode %}

### **Step 4: Execute the Agent and analyze the output**

In the **Test Panel**, click **Play**. After execution, the agent returns a validated JSON object that follows the defined schema.

**Example output:**

{% code overflow="wrap" expandable="true" %}

```json
{
  "body": {
    "title": "Event-Driven Architecture",
    "description": "Event-Driven Architecture (EDA) is a software design pattern where system components communicate by producing and consuming events...",
    "use_cases": [
      "Building microservices that need to communicate asynchronously.",
      "Implementing real-time analytics platforms that process streaming data.",
      "Automating workflows in response to business events, such as order processing or user actions."
    ],
    "best_practices": [
      "Design events to be self-contained and descriptive to ensure clear communication between components.",
      "Use reliable messaging systems to guarantee event delivery and avoid data loss.",
      "Monitor and log event flows to quickly detect and resolve issues in the system."
    ]
  },
  "tokenUsage": {
    "inputTokenCount": 396,
    "outputTokenCount": 162,
    "totalTokenCount": 558
  }
}
```

{% endcode %}

{% hint style="warning" %}
The `body` wrapper is part of the Digibee Integration Platform execution response.
{% endhint %}

## **Result**

You now have a working agent that connects to an MCP Server, retrieves external data, and transforms it into consistent, machine-readable documentation. Congratulations!

You can extend this agent by changing the MCP Server, prompts, or JSON Schema to support additional use cases.

## **Related topics**

* [**AI expense report validation system**](https://docs.digibee.com/documentation/resources/ai-practical-examples/expense-report-validation-with-ai)**:** Explore a real-world implementation in this How-to guide.
* [**Insurance claim analysis with AI**](https://docs.digibee.com/documentation/resources/ai-practical-examples/insurance-claim-analysis-with-ai)**:** Build a multi-agent system to help review insurance claims.
* [**Agent Component — Complete configuration guide**](https://app.gitbook.com/s/EKM2LD3uNAckQgy1OUyZ/connectors/ai-tools/llm): Explore all the configuration options for this component.
