> ## Documentation Index
> Fetch the complete documentation index at: https://easy-mcp-use.52kx.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Connection Types

> Understanding the different connection types for MCP servers

# 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 easy-mcp-use:

## 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:

```json theme={null}
{
  "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:

```json theme={null}
{
  "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 easy-mcp-use 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:

```typescript theme={null}
import { MCPClient } from 'easy-mcp-use';

// The connection type is automatically inferred based on your config file
const client = MCPClient.fromConfigFile("config.json", "my_server");
```

For example:

* If your configuration includes `command` and `args`, a 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](./configuration).
