Compare commits

...
Author SHA1 Message Date
Juan Pablo 2370d9d88f docs: remove redundant MCP transport config examples
Replace duplicate STDIO and SSE JSON configuration examples with
references to existing examples earlier in the document. This reduces
redundancy and keeps the transport sections focused on explaining
when to use each type.
2025-12-15 17:30:59 -08:00
Juan Pablo ab5b1ea131 docs(mcp): update section headings for clarity on environment variable usage 2025-12-15 15:48:06 -08:00
Juan Pablo 24e4591080 docs(mcp): update environment variable referencing instructions for MCP server configuration 2025-12-15 15:44:32 -08:00
Juan Pablo 406d86eec8 docs(mcp): document env var references for secrets 2025-12-14 23:35:42 -08:00
2 changed files with 49 additions and 38 deletions
+45 -38
View File
@@ -59,7 +59,28 @@ Settings for all installed MCP servers are located in the `cline_mcp_settings.js
2. Select the "Configure" tab.
3. Click the "Configure MCP Servers" button at the bottom of the pane.
The file uses a JSON format with a `mcpServers` object containing named server configurations:
The file uses a JSON format with a `mcpServers` object containing named server configurations.
## Referencing environment variables
You can reference environment variables in your MCP server configuration using `${env:VAR_NAME}` syntax. Cline expands these values at runtime while keeping the `${env:...}` placeholder in the settings file, so your secrets never get written to disk.
### Why use environment variables
Most MCP servers need credentials somewhere.
- Local STDIO servers often read secrets from their process environment (for example `API_KEY` in an `env` block).
- Remote servers often expect secrets in request headers (for example `Authorization: Bearer ...`).
Hardcoding these values in a JSON settings file makes them easy to leak through normal workflows like commits, diffs, screenshots, and copy-pasted snippets.
Environment variables keep the secret out of the file, make rotation easier, and make the config safe to share.
<Note>
If the environment variable is not set, Cline leaves the `${env:VAR_NAME}` value unchanged and the server will likely fail to connect.
</Note>
#### Example: STDIO server env vars
```json
{
@@ -68,7 +89,7 @@ The file uses a JSON format with a `mcpServers` object containing named server c
"command": "python",
"args": ["/path/to/server.py"],
"env": {
"API_KEY": "your_api_key"
"API_KEY": "${env:MY_SERVER_API_KEY}"
},
"alwaysAllow": ["tool1", "tool2"],
"disabled": false
@@ -77,7 +98,24 @@ The file uses a JSON format with a `mcpServers` object containing named server c
}
```
_Example of MCP Server config in Cline (STDIO Transport)_
#### Example: Remote server auth headers
```json
{
"mcpServers": {
"remote-server": {
"type": "streamableHttp",
"url": "https://your-server-url.com/mcp",
"headers": {
"Authorization": "Bearer ${env:MY_MCP_TOKEN}"
},
"disabled": false
}
}
}
```
_Examples of MCP server config using environment variable references_
---
@@ -95,26 +133,10 @@ Used for local servers running on your machine:
- Simpler setup (no HTTP server needed)
- Runs as a child process on your machine
STDIO servers use `command` and `args` fields to launch the server process. See the [STDIO example above](#example-stdio-server-env-vars) for a complete configuration.
For more in-depth information about how STDIO transport works, see [MCP Transport Mechanisms](/mcp/mcp-transport-mechanisms).
STDIO configuration example:
```json
{
"mcpServers": {
"local-server": {
"command": "node",
"args": ["/path/to/server.js"],
"env": {
"API_KEY": "your_api_key"
},
"alwaysAllow": ["tool1", "tool2"],
"disabled": false
}
}
}
```
### SSE Transport
Used for remote servers accessed over HTTP/HTTPS:
@@ -125,25 +147,10 @@ Used for remote servers accessed over HTTP/HTTPS:
- Requires network access
- Allows centralized deployment and management
SSE servers use `url` and optional `headers` fields for authentication. See the [remote server example above](#example-remote-server-auth-headers) for a complete configuration.
For more in-depth information about how SSE transport works, see [MCP Transport Mechanisms](/mcp/mcp-transport-mechanisms).
SSE configuration example:
```json
{
"mcpServers": {
"remote-server": {
"url": "https://your-server-url.com/mcp",
"headers": {
"Authorization": "Bearer your-token"
},
"alwaysAllow": ["tool3"],
"disabled": false
}
}
}
```
---
## Using MCP Tools in Your Workflow
@@ -156,6 +156,10 @@ Key configuration options:
- **autoApprove**: List of tool names that don't require confirmation
- **timeout**: Maximum time in seconds to wait for server responses (default: 60)
<Tip>
For auth tokens, use `${env:VAR_NAME}` inside `headers` instead of hardcoding secrets in `cline_mcp_settings.json`. See <a href="/mcp/configuring-mcp-servers#referencing-environment-variables">Referencing environment variables</a>.
</Tip>
For additional MCP settings, click the "Advanced MCP Settings" link to access VSCode settings.
### Using MCP Server Tools