# pw code mcp add

> Source: https://parallelworks.com/docs/cli/pw/code/mcp/add

## pw code mcp add

Add an MCP server

### Synopsis

Add an MCP server to a pw code config file.

stdio servers take their command (and arguments) after "--"; http and
sse servers take the endpoint URL as the second positional argument.
Run with no arguments in a terminal to be prompted for each value.

```
pw code mcp add [flags] <name> [url] [-- <command> [args...]]
```

### Examples

```
  # Add a stdio server to <workspace>/.agents/settings.local.json (default scope)
  pw code mcp add -e API_KEY=secret everything -- npx -y @modelcontextprotocol/server-everything
  
  # Add an HTTP server to the shared <workspace>/.mcp.json
  pw code mcp add --transport http -H "Authorization: Bearer token" --scope project context7 https://mcp.context7.com/mcp
  
  # Fill in every value interactively
  pw code mcp add
```

### Options

```
  -e, --env stringArray      Environment variable for a stdio server, KEY=VALUE (repeatable)
      --force                Overwrite an existing server with the same name
  -H, --header stringArray   HTTP header for an http/sse server, 'Key: Value' (repeatable)
  -h, --help                 help for add
      --scope string         Config file to write: user, project, agents, or local (default: local)
      --timeout string       Connection timeout: milliseconds (60000) or a duration (60s)
  -t, --transport string     Transport: stdio, http, or sse (default: inferred from command/url)
  -w, --workspace string     Workspace root directory (default: current directory)
```

### Options inherited from parent commands

```
      --context string         The context to use. Overrides PW_CONTEXT environment variable and current context from config.
      --platform-host string   The Parallel Works ACTIVATE platform host to use. Will override any other platform host settings.
  -v, --verbose                Enable verbose logging
```

### SEE ALSO

* [pw code mcp](/docs/cli/pw/code/mcp)	 - Manage MCP servers for pw code
