Skip to main content

MCP Tool

Configures a connection to an external tool server using the Model Context Protocol (MCP), enabling agents to use external tools and services.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.

Inputs

  • Command - (string) The command to execute to start the MCP server (e.g., "npx", "python", "/path/to/executable"). Default: "npx".

Options

  • Arguments - (array) Command-line arguments for the MCP server command. Each entry is one argument. For example, for an npm package: ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"].
  • Environment Variables - (array) Environment variables to pass to the MCP server process. Format: "KEY=VALUE" for each entry.
  • Timeout (seconds) - (number) Maximum wait time in seconds for MCP tool operations to finish. Default: 300.

Outputs

This node does not have direct outputs (it provides configuration to the agent).

How It Works

The MCP Tool node establishes a connection to an external tool server:

  1. Configuration - Defines the command, arguments, and environment for starting the MCP server
  2. Server Connection - When an agent needs the tools, it starts the MCP server process using the configuration
  3. Tool Discovery - The server provides a list of available tools via the MCP protocol
  4. Tool Registration - Tools from the server become available to the agent
  5. Tool Execution - When the agent calls a tool, the request is forwarded to the MCP server
  6. Response Handling - The server's response is returned to the agent

Model Context Protocol (MCP)

MCP is a protocol for exposing tools and services to LLM agents. It allows:

  • Tool Discovery - Servers advertise their available tools
  • Schema Definition - Tools include parameter schemas
  • Execution - Agents can call tools with appropriate parameters
  • Resource Access - Servers can provide access to files, databases, and other resources

Common Use Cases

  • File System Access - Use MCP file system server to read/write files
  • Database Integration - Connect to databases via MCP servers
  • External APIs - Wrap external APIs in MCP servers
  • Custom Services - Create custom MCP servers for specialized functionality
  • Third-Party Tools - Use pre-built MCP servers from the community
  • Multi-Tool Servers - Single MCP server can expose multiple related tools

Example Configurations

NPM Package (Filesystem Server):

Command: npx
Arguments:
- "-y"
- "@modelcontextprotocol/server-filesystem"
- "/tmp"

Python MCP Server:

Command: python
Arguments:
- "/path/to/mcp_server.py"
Environment Variables:
- "API_KEY=your_api_key"
- "DEBUG=true"

Custom Executable:

Command: /usr/local/bin/my-mcp-server
Arguments:
- "--config"
- "/etc/mcp/config.json"

Node.js Server:

Command: node
Arguments:
- "/path/to/mcp-server.js"
- "--port"
- "3000"
Environment Variables:
- "NODE_ENV=production"

Usage Notes

  • No Outputs - This node configures the agent but doesn't produce workflow outputs
  • Connection Required - Must be connected to an LLM Agent's tools port
  • Server Lifecycle - The MCP server is started when needed and managed automatically
  • Multiple Servers - You can connect multiple MCP Tool nodes to provide access to different servers
  • Tool Availability - Tools from the MCP server appear alongside other agent tools
  • Arguments Format - Each argument should be a separate array entry
  • Environment Format - Use "KEY=VALUE" format for environment variables
  • Path Resolution - Use absolute paths for executables and configurations when possible

Error Handling

The node will return errors in the following cases:

  • Invalid command - Command doesn't exist or isn't executable
  • Server startup failure - MCP server fails to start
  • Connection errors - Cannot connect to the MCP server
  • Protocol errors - Server doesn't properly implement MCP
  • Timeout - Server doesn't respond within the timeout period
  • Permission errors - Insufficient permissions to execute the command

Available MCP Servers

Some popular MCP servers include:

@modelcontextprotocol/server-filesystem:

  • File system operations (read, write, list)
  • Directory navigation
  • File search

@modelcontextprotocol/server-sqlite:

  • SQLite database queries
  • Schema inspection
  • Data manipulation

@modelcontextprotocol/server-brave-search:

  • Web search via Brave Search API
  • News search
  • Image search

Custom Servers:

  • Create your own MCP servers in Python, Node.js, or other languages
  • Follow the MCP specification
  • Expose tools, resources, and prompts

Best Practices

  • Test Separately - Test the MCP server independently before integrating
  • Use Absolute Paths - Use absolute paths for commands and configuration files
  • Environment Variables - Use environment variables for sensitive data like API keys
  • Error Handling - Enable Continue On Error if MCP server failures shouldn't stop the workflow
  • Server Selection - Choose MCP servers that provide the specific tools you need
  • Resource Limits - Be aware of resource usage by MCP server processes
  • Security - Only use trusted MCP servers, especially with file system access

Security Considerations

  • File System Access - MCP servers with file system access can read/write files; restrict their scope
  • Command Execution - Some MCP servers may allow command execution; use with caution
  • API Keys - Pass sensitive credentials via environment variables, not command arguments
  • Server Trust - Only use MCP servers from trusted sources
  • Permission Boundaries - Run MCP servers with minimal required permissions
  • Network Access - Be cautious with servers that make network requests

Troubleshooting

Server Won't Start:

  • Verify the command is correct and executable
  • Check that all required dependencies are installed
  • Review environment variables
  • Check file permissions

Tools Not Available:

  • Ensure the MCP server implements the protocol correctly
  • Check server logs for errors
  • Verify the server is properly connected

Tool Calls Fail:

  • Check server logs for error messages
  • Verify tool parameters are correct
  • Ensure the server has necessary permissions
  • Check timeout settings

Performance Issues:

  • Monitor MCP server resource usage
  • Adjust timeout values if needed
  • Consider server placement (local vs remote)

Creating Custom MCP Servers

To create your own MCP server:

  1. Choose a Language - Python, Node.js, or others
  2. Implement MCP Protocol - Follow the MCP specification
  3. Define Tools - Create tool definitions with schemas
  4. Handle Requests - Process tool calls and return results
  5. Test - Test with various tool calls
  6. Deploy - Make the server accessible to Robomotion

Refer to the MCP documentation for detailed implementation guides.