Skip to content

MCP Agent

The MCP Agent is a smart helper within your Nappai workflow. It acts as a bridge between your data and specialized AI tools. By using the Model Context Protocol (MCP), this agent can access specific functions or tools to provide accurate answers, perform searches, or execute tasks that require external data.

Think of it as a versatile assistant that doesn’t just “know” information but can also “do” things by connecting to specific services or tools you define.

How it Works

This component uses a language model (like those from OpenAI or other providers) to understand your requests. However, unlike a standard chat bot, this agent is configured to use the Model Context Protocol (MCP).

  1. Input Processing: You provide a question or task via the Input field, along with any specific instructions in the System Prompt.
  2. Tool Access: The agent connects to the MCP tools you have specified. These tools allow the AI to read, write, or interact with external data sources or applications.
  3. Response Generation: The AI processes your request using the available tools and generates a final answer or action.
  4. Memory Management: If Use Memory is enabled, the agent remembers previous parts of your conversation to provide more context-aware responses.

Connection & Credentials

This component does not require a specific API key or credential configuration within the Nappai panel itself. However, it relies on the Model you select, which may require its own credentials, and the MCP tools you connect to, which may have their own authentication requirements.

Inputs

Input Fields

The following fields are available to configure this component:

  • Input: The main question, command, or message you want the agent to process.

    • Visible in: All operations
  • Model: The AI language model to use for generating responses. This determines the intelligence and style of the agent.

    • Visible in: All operations
  • MCP: The definition of external tools that the agent is allowed to use. These tools enable the agent to perform actions beyond just text generation.

    • Visible in: All operations
  • Agent Name: A label for the agent when it is used as a tool by other components. This helps identify the agent in logs or downstream workflows.

    • Visible in: All operations
  • Agent Description: A short description of what the agent does. This helps other components understand its purpose when selecting it.

    • Visible in: All operations
  • Use Memory: A toggle switch. When enabled, the agent remembers the context of previous messages in the conversation. When disabled, it treats each input as a fresh start.

    • Visible in: All operations
  • Memory Limit: An integer value. If Use Memory is enabled, this sets the maximum number of past messages the agent will remember. Enter -1 to remember all messages without limit.

    • Visible in: All operations
  • Memory ID: An optional text field. If you want the agent to remember conversations across different sessions or workflows, you can assign a fixed ID here.

    • Visible in: All operations
  • System Prompt: Additional instructions you can provide to guide the agent’s behavior. These instructions are added to the agent’s built-in rules. For example, you could add: “Always answer in Spanish” or “Keep responses under 50 words.”

    • Visible in: All operations

Outputs

  • Response: The final text answer or result generated by the agent after processing your input and using the MCP tools. This is the primary output you will likely connect to other components.

    • Type: Any (Text/String)
  • Agent: The configured agent object itself. This can be used if you need to pass the agent configuration to another component for further processing or tool use.

    • Type: Any (Object)

Output Data Example (JSON)

json { “Response”: “Based on the data from the database tool, the total sales for Q3 were $1,250,000. This is a 10% increase from Q2.”, “Agent”: { “name”: “mcp_agent”, “tools_used”: [“database_search”, “chart_generator”], “tokens_used”: 150 } }

Connectivity

This component is typically placed in the middle of a workflow, acting as the “brain” that processes information.

  • Upstream (Inputs): Connect the output of a Trigger (like a webhook or schedule), a Text Input component, or another Agent to the Input field. You can also connect a Tool component to the MCP field.
  • Downstream (Outputs): Connect the Response output to:
    • A Text Output component to display the result to a user.
    • A Filter component to check if the response meets certain criteria.
    • Another Agent or Tool component if you need to further process the answer.
    • An Email or Slack component to send the result as a notification.

Usage Example

Scenario: Customer Support Inquiry

  1. Trigger: A customer sends a question via a web form.
  2. Agent Setup:
    • Input: {{Trigger.Body.Question}}
    • Model: Select your preferred AI model (e.g., GPT-4).
    • MCP: Connect a “Knowledge Base Search” tool that has access to your company’s FAQ.
    • System Prompt: Always be polite and concise. If you don't know the answer, say so.
  3. Execution: The MCP Agent uses the Knowledge Base tool to find the answer to the customer’s question.
  4. Output: The Response field contains the answer, which is then sent to the customer via an Email component.

Tips and Best Practices

  • Start Simple: If you are new to MCP, start with the Use Memory toggle disabled. This makes it easier to debug issues because each request is independent.
  • Define Clear Instructions: Use the System Prompt to set clear boundaries. For example, specify the tone of voice or the format of the response.
  • Monitor Memory: If you enable Use Memory, consider setting a Memory Limit to prevent the agent from becoming overwhelmed with too much conversation history, which can slow down responses or increase costs.
  • Tool Specificity: The more specific your MCP tools are, the better the agent’s performance. Ensure the tools you connect to are relevant to the task.

Security Considerations

  • Tool Permissions: Be cautious about which tools you connect to the MCP field. Agents with access to write or delete data can have significant security implications. Only grant access to tools necessary for the task.
  • Data Privacy: If you are handling sensitive customer data, ensure your Model provider has appropriate data privacy agreements and that your System Prompt does not inadvertently encourage the agent to share confidential information.
  • Memory Storage: If Use Memory is enabled, remember that conversation history is stored. Ensure this aligns with your data retention policies.