> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.itential.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.itential.com/_mcp/server.

# iagctl mcp server add

Gateway 5.5+

Register an MCP server.

Use this command to register an external MCP (Model Context Protocol) server with Itential Gateway. After registration, Itential Gateway connects to the server, discovers the tools it exposes, and surfaces them in Gateway Manager as native gateway services.

For more information, see [Register and manage MCP servers](../flowai/flowmcp-gateway/manage-mcp-servers).

## Syntax

```bash
iagctl mcp server add <name> <command_or_url> [flags]
```

## Transport auto-detection

If you omit the `--transport` flag, Itential Gateway detects the transport type automatically:

* Arguments beginning with `http` use `streamable-http` transport.
* All other arguments use `stdio` transport.

Use `--transport` to set the transport explicitly when auto-detection would produce the wrong result.

## Secret references

The `<command_or_url>` argument and the `--env` and `--header` flag values support Go template syntax. Use `{{ secret "name" }}` to reference a secret stored in Itential Gateway's secret store instead of providing a sensitive value as plain text.

```bash
--env API_KEY={{ secret "my-api-key" }}
--header Authorization=Bearer {{ secret "my-token" }}
```

## Examples

### Register a stdio MCP server

```bash
iagctl mcp server add my-server "npx -y @modelcontextprotocol/server-filesystem /tmp"
```

### Register an HTTP MCP server

```bash
iagctl mcp server add my-api-server https://mcp.example.com
```

### Register a stdio server with environment variables and tags

```bash
iagctl mcp server add data-processor "python /opt/mcp/processor.py" \
  --description "Data processing MCP server" \
  --tag production \
  --tag data \
  --env DB_HOST=localhost \
  --env DB_PASSWORD={{ secret "db-password" }}
```

### Register a Context7 MCP server

```bash
iagctl mcp server add context7 https://mcp.context7.com/mcp
```

### Register an HTTP server with custom headers

```bash
iagctl mcp server add secure-api https://mcp.internal.example.com \
  --transport streamable-http \
  --description "Internal API gateway" \
  --header Authorization=Bearer {{ secret "api-token" }} \
  --tag internal
```

## Options

```bash
      --description string   A brief description of the MCP server
      --env stringArray      Environment variable to set for the server process, in KEY=VALUE format.
                             stdio transport only. Repeatable. Supports {{ secret "name" }} templates.
      --header stringArray   Custom HTTP header to send to the server, in KEY=VALUE format.
                             HTTP transports only. Repeatable. Supports {{ secret "name" }} templates.
  -h, --help                 Help for add
      --tag stringArray      Metadata tag to associate with the server. Repeatable.
      --transport string     Transport type: stdio, streamable-http, or sse.
                             Auto-detected from <command_or_url> if omitted.
```

## Options inherited from parent commands

```bash
      --config string    Path to the configuration file
      --profile string   Specify the client profile to use (case-insensitive, defaults to [client] section)
      --raw              Display the result of the command in raw format
      --verbose          Enable verbose output
```