Connection Types for MCP Servers

MCP servers can communicate with clients using different connection protocols, each with its own advantages and use cases. This guide explains the three primary connection types supported by OmniMind:

Standard Input/Output (STDIO)

STDIO connections run the MCP server as a child process and communicate through standard input and output streams.

Characteristics:

  • Local Operation: The server runs as a child process on the same machine
  • Simplicity: Easy to set up with minimal configuration
  • Security: No network exposure, ideal for sensitive operations
  • Performance: Low latency for local operations

Configuration Example:

{

  "mcpServers": {

    "stdio_server": {

      "command": "npx",

      "args": ["@my-mcp/server"],

      "env": {}

    }

  }

}

HTTP Connections

HTTP connections communicate with MCP servers over standard HTTP/HTTPS protocols.

Characteristics:

  • RESTful Architecture: Follows familiar HTTP request/response patterns
  • Statelessness: Each request is independent
  • Compatibility: Works well with existing web infrastructure
  • Firewall-Friendly: Uses standard ports that are typically open

Configuration Example:

{

  "mcpServers": {

    "http_server": {

      "url": "http://localhost:3000",

      "headers": {

        "Authorization": "Bearer ${AUTH_TOKEN}"

      }

    }

  }

}

Choosing the Right Connection Type

The choice of connection type depends on your specific use case:

  1. STDIO: Best for local development, testing, and enhanced security scenarios where network exposure is a concern
  2. HTTP: Ideal for stateless operations, simple integrations, and when working with existing HTTP infrastructure

When configuring your OmniMind environment, you can specify the connection type in your configuration file as shown in the examples above.

Using Connection Types

Connection types are automatically inferred from your configuration file based on the parameters provided:

from omnimind import OmniMind


# The connection type is automatically inferred based on your config file
agent = OmniMind(config_path="my_config.json")
agent.run()

For example:

  • If your configuration includes command and args, an STDIO connection will be used
  • If your configuration has a url starting with http:// or https://, an HTTP connection will be used

This automatic inference simplifies the configuration process and ensures the appropriate connection type is used without requiring explicit specification.

For more details on connection configuration, see the Configuration Guide.