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