You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -75,6 +76,7 @@ The `config` file should have a `mcpServers` key. This contains `stdio` and `rem
75
76
##### Optional fields:
76
77
-`args`: Array of command arguments (supports `${VARIABLE}` and `${cmd: command}` placeholders)
77
78
-`env`: Environment variables with placeholder resolution and system fallback
79
+
-`cwd`: The current working directory for the MCP server process (supports `${VARIABLE}` and `${cmd: command}` placeholders)
78
80
-`dev`: Development mode configuration for auto-restart on file changes
79
81
-`name`: Display name that will be shown in the UI
80
82
-`description`: Short description about the server (useful when the server is disabled and `auto_toggle_mcp_servers` is `true`)
@@ -98,6 +100,33 @@ Given `API_KEY=secret` in the environment:
98
100
99
101
> ⚠️ **Legacy Syntax**: `$VAR` (args) and `$: command` (env) are deprecated but still supported with warnings. Use `${VAR}` and `${cmd: command}` instead.
100
102
103
+
104
+
#### `cwd` Example:
105
+
106
+
The `cwd` field is particularly useful when your MCP server needs to run in a specific directory context. Here's a practical example:
107
+
108
+
```json
109
+
{
110
+
"mcpServers": {
111
+
"project-server": {
112
+
"command": "npm",
113
+
"args": ["start"],
114
+
"cwd": "/home/ubuntu/my-mcp-project/",
115
+
"env": {
116
+
"NODE_ENV": "development"
117
+
}
118
+
}
119
+
}
120
+
}
121
+
```
122
+
123
+
**Use cases for `cwd`:**
124
+
- When the MCP server needs to access relative files in its project directory
125
+
- When using npm/yarn scripts that depend on being in the project root
126
+
127
+
> **Note**: The top-level `cwd` field sets the working directory for the server process itself, while `dev.cwd` (used in development mode) sets the directory for file watching. These serve different purposes and can be used together.
128
+
129
+
101
130
##### `dev` Development Mode
102
131
103
132
The `dev` field enables automatic server restarts when files change during development:
0 commit comments