Skip to main content

Listen

Starts an MCP (Model Context Protocol) server that listens for incoming client connections via Server-Sent Events (SSE). This is the core node for building MCP servers that expose tools, prompts, and resources to AI applications.

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.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Options

  • SSE Server IP - IP address to bind the SSE server to. Default: 127.0.0.1. Use 0.0.0.0 to accept connections from any network interface.
  • SSE Server Port - Port number for the SSE server. Default: 8888. Ensure this port is available and not blocked by firewall.
  • SSE Server Endpoint - URL endpoint path for the MCP server. Default: /sse. Clients connect to http://{IP}:{Port}{Endpoint}.
  • Server Name - Human-readable name for your MCP server. Default: My MCP Server. This appears in client discovery.
  • Server Version - Version string for your MCP server. Default: 0.0.1. Use semantic versioning (e.g., 1.2.3).

Output Ports

The Listen node has three output ports for connecting different types of MCP capabilities:

  • tools (Port 0) - Connect Tool In nodes here to expose executable tools to clients. Only accepts Tool In nodes.
  • prompts (Port 1) - Connect Prompt In nodes here to expose prompt templates to clients. Only accepts Prompt In nodes.
  • resources (Port 2) - Connect Resource In nodes here to expose resources to clients. Only accepts Resource In nodes.

How It Works

The Listen node creates an MCP server and registers all connected capabilities when the flow starts:

  1. Initialization - When the flow starts, the node waits for the runtime to be ready
  2. Registration - Scans all connected Tool In, Prompt In, and Resource In nodes on the respective ports
  3. Server Setup - Registers each capability with the MCP server using their configurations
  4. SSE Server - Starts an HTTP server that provides SSE transport for MCP protocol
  5. Request Routing - Incoming requests are routed to the appropriate Tool In/Prompt In/Resource In node
  6. Response Handling - Results from Tool Out/Prompt Out/Resource Out nodes are sent back to clients

Server Capabilities

The Listen node automatically enables the following MCP capabilities:

  • Tool Support - Clients can list and call tools
  • Prompt Support - Clients can list and retrieve prompts
  • Resource Support - Clients can list and read resources (with subscription support)
  • Logging - Server-side logging for debugging

Requirements

  • Network Access - The specified port must be available and accessible
  • Connected Nodes - At least one Tool In, Prompt In, or Resource In node should be connected
  • Firewall - Ensure firewall rules allow incoming connections on the configured port

Usage Notes

Server Lifecycle

  • The MCP server starts automatically when the flow begins execution
  • The server runs continuously until the flow is stopped or encounters an error
  • Proper cleanup is performed when the flow stops (via OnClose)

Connection Management

  • Each connected Tool In/Prompt In/Resource In node is registered at startup
  • If a node registration fails, a warning is logged but the server continues
  • Client connections are managed by the SSE transport layer
  • The server supports multiple concurrent client connections

Network Configuration

  • Local Testing - Use 127.0.0.1 to restrict access to localhost only
  • Network Access - Use 0.0.0.0 to allow connections from other machines
  • Port Selection - Choose a port that doesn't conflict with other services
  • Endpoint Path - The default /sse endpoint works for most cases

Error Handling

The node handles errors gracefully:

  • Port Already in Use - Server will fail to start if port is occupied
  • Registration Failures - Individual node registration failures are logged as warnings
  • Runtime Not Ready - Waits with retry logic until runtime is available
  • Context Cancellation - Properly shuts down when flow is stopped

Security Considerations

  • The SSE server does not include authentication by default
  • Consider using a reverse proxy (nginx, Caddy) for production deployments
  • Use HTTPS in production to encrypt communication
  • Restrict IP binding to 127.0.0.1 if only local access is needed
  • Implement network-level security (firewall, VPN) for sensitive deployments

Examples

Example 1: Basic MCP Server with Tools

Setup:

  1. Add a Listen node
  2. Configure:
    • Server Name: "My Automation Server"
    • SSE Server Port: 8888
  3. Connect a Tool In node to the tools port
  4. Connect a Tool Out node after your automation logic

Result: An MCP server that exposes one or more automation tools to AI clients.


Example 2: Multi-Capability Server

Setup:

  1. Add a Listen node
  2. Connect multiple nodes:
    • 3 Tool In nodes → tools port
    • 2 Prompt In nodes → prompts port
    • 2 Resource In nodes → resources port
  3. Configure each capability with appropriate settings

Result: A comprehensive MCP server offering tools, prompts, and resources.


Example 3: Network-Accessible Server

Setup:

  1. Add a Listen node
  2. Configure:
    • SSE Server IP: 0.0.0.0
    • SSE Server Port: 9000
    • Server Name: "Company Automation Hub"
    • Server Version: "1.0.0"

Connection URL: http://your-server-ip:9000/sse

Result: An MCP server accessible from other machines on the network.


Example 4: Custom Endpoint Path

Setup:

  1. Add a Listen node
  2. Configure:
    • SSE Server Endpoint: /mcp/api
    • SSE Server Port: 8080

Connection URL: http://127.0.0.1:8080/mcp/api

Result: Server with a custom endpoint path for organizational purposes.

Best Practices

  1. Server Configuration:

    • Use descriptive server names that identify the purpose
    • Follow semantic versioning for Server Version
    • Document the capabilities your server provides
  2. Network Setup:

    • Start with 127.0.0.1 during development
    • Use specific IP addresses in production, not 0.0.0.0
    • Choose high ports (8000+) to avoid privileged port issues
  3. Capability Organization:

    • Group related tools, prompts, and resources logically
    • Use clear, descriptive names for each capability
    • Document the expected inputs and outputs
  4. Production Deployment:

    • Use a reverse proxy with HTTPS for production
    • Implement proper authentication at the proxy level
    • Monitor server logs for errors and performance
    • Set up health checks and monitoring
  5. Testing:

    • Test with local connections first
    • Verify all capabilities are registered correctly
    • Test error handling scenarios
    • Validate with multiple concurrent clients
  6. Resource Management:

    • Ensure long-running servers don't leak resources
    • Monitor memory usage for servers with many capabilities
    • Implement proper cleanup in connected nodes

Common Errors and Solutions

Error: "Port already in use"

Cause: Another service is using the configured port.

Solution:

  • Change the SSE Server Port to an available port
  • Stop the conflicting service
  • Use netstat -ano | grep :8888 (Linux/Mac) or netstat -ano | findstr :8888 (Windows) to find the process

Error: "Flow stopped before starting SSE server"

Cause: Flow was stopped during server initialization.

Solution:

  • This is expected when stopping the flow during startup
  • Ensure the flow runs long enough for initialization

Warning: "Failed to register tool/prompt/resource"

Cause: Configuration error in a connected node.

Solution:

  • Check the configuration of the referenced Tool In/Prompt In/Resource In node
  • Ensure all required fields are filled
  • Verify the node is properly connected to the correct port

Tips for Effective Use

  1. Start Simple - Begin with one capability type, then expand
  2. Use Meaningful Names - Server name and version help clients identify your server
  3. Test Locally First - Use localhost binding during development
  4. Monitor Logs - Watch for registration warnings and connection issues
  5. Document Your Server - Maintain documentation of available capabilities
  6. Version Your Server - Increment version when capabilities change
  7. Plan for Scale - Consider load if many clients will connect
  8. Secure Production - Always use HTTPS and authentication in production