Skip to content

Commit 7bbb1c3

Browse files
committed
Merge branch 'main' into marketplace-registry
2 parents d9ea432 + 3f676c6 commit 7bbb1c3

7 files changed

Lines changed: 56 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [5.11.1] - 2025-07-08
9+
10+
### Added
11+
12+
- **`cwd` field support for stdio servers**:
13+
- Added `cwd` field to `MCPServerConfig` type definition
14+
- Added validation for `cwd` field in server configuration
15+
- Updated documentation with examples and use cases
816

917
## [5.11.0] - 2025-06-26
1018

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ MCP Hub is a MCP client for neovim that seamlessly integrates [MCP (Model Contex
2828

2929
## 💜 Sponsors
3030

31-
<!-- sponsors --> <p align="center"> <a href="https://github.com/CryogenicPlanet"><img src="https://github.com/CryogenicPlanet.png" width="50px" alt="CryogenicPlanet" /></a> <a href="https://github.com/olimorris"><img src="https://github.com/olimorris.png" width="50px" alt="Oli Morris" /></a> <a href="https://github.com/supermemoryai"><img src="https://github.com/supermemoryai.png" width="50px" alt="Super Memory" /></a> <a href="https://github.com/yingmanwumen"><img src="https://github.com/yingmanwumen.png" width="50px" alt="yingmanwumen" /></a> <a href="https://github.com/yetone"><img src="https://github.com/yetone.png" width="50px" alt="Yetone" /></a> <a href="https://github.com/omarcresp"><img src="https://github.com/omarcresp.png" width="50px" alt="omarcresp" /></a> <a href="https://github.com/petermoser"><img src="https://github.com/petermoser.png" width="50px" alt="petermoser" /></a> <a href="https://github.com/watsy0007"><img src="https://github.com/watsy0007.png" width="50px" alt="watsy0007" /></a> <a href="https://github.com/kohane27"><img src="https://github.com/kohane27.png" width="50px" alt="kohane27" /></a> <a href="https://github.com/copleykj"><img src="https://github.com/copleykj.png" width="50px" alt="Kelly Copley" /></a></p><!-- sponsors -->
31+
<!-- sponsors --> <p align="center"> <a href="https://github.com/CryogenicPlanet"><img src="https://github.com/CryogenicPlanet.png" width="50px" alt="CryogenicPlanet" /></a> <a href="https://github.com/olimorris"><img src="https://github.com/olimorris.png" width="50px" alt="Oli Morris" /></a> <a href="https://github.com/supermemoryai"><img src="https://github.com/supermemoryai.png" width="50px" alt="Super Memory" /></a> <a href="https://github.com/yingmanwumen"><img src="https://github.com/yingmanwumen.png" width="50px" alt="yingmanwumen" /></a> <a href="https://github.com/yetone"><img src="https://github.com/yetone.png" width="50px" alt="Yetone" /></a> <a href="https://github.com/omarcresp"><img src="https://github.com/omarcresp.png" width="50px" alt="omarcresp" /></a> <a href="https://github.com/petermoser"><img src="https://github.com/petermoser.png" width="50px" alt="petermoser" /></a> <a href="https://github.com/watsy0007"><img src="https://github.com/watsy0007.png" width="50px" alt="watsy0007" /></a> <a href="https://github.com/kohane27"><img src="https://github.com/kohane27.png" width="50px" alt="kohane27" /></a> <a href="https://github.com/copleykj"><img src="https://github.com/copleykj.png" width="50px" alt="Kelly Copley" /></a><a href="https://github.com/nom-social"><img src="https://github.com/nom-social.png" width="50px" alt="Nom Social" /></a></p><!-- sponsors -->
3232

3333
<p align="center">
3434
<b>Special thanks to:</b>

doc/mcp/servers_json.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ The `config` file should have a `mcpServers` key. This contains `stdio` and `rem
6161
"DB_URL": "postgresql://user:${DB_PASSWORD}@localhost/myapp",
6262
"DB_PASSWORD": "password123",
6363
"FALLBACK_VAR": null
64-
}
64+
},
65+
"cwd": "/home/ubuntu/server-dir/"
6566
}
6667
}
6768
}
@@ -73,6 +74,7 @@ The `config` file should have a `mcpServers` key. This contains `stdio` and `rem
7374
##### Optional fields:
7475
- `args`: Array of command arguments (supports `${VARIABLE}` and `${cmd: command}` placeholders)
7576
- `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)
7678
- `dev`: Development mode configuration for auto-restart on file changes
7779
- `name`: Display name that will be shown in the UI
7880
- `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:
9698

9799
> ⚠️ **Legacy Syntax**: `$VAR` (args) and `$: command` (env) are deprecated but still supported with warnings. Use `${VAR}` and `${cmd: command}` instead.
98100
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+
99128
##### `dev` Development Mode
100129

101130
The `dev` field enables automatic server restarts when files change during development:

lua/mcphub/types.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
---@field command? string
4848
---@field args? table
4949
---@field env? table<string,string>
50+
---@field cwd? string
5051
---@field headers? table<string,string>
5152
---@field url? string
5253

lua/mcphub/utils/installers.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ local Installers = {
9292
})
9393
cc_chat:add_buf_message({
9494
role = "user",
95-
content = "@files @cmd_runner Please follow the provided instructions carefully to install this MCP server",
95+
content = "@{files} @{cmd_runner} Please follow the provided instructions carefully to install this MCP server",
9696
})
9797
end,
9898
create_native_server = function(self)
@@ -110,7 +110,7 @@ local Installers = {
110110
})
111111
cc_chat:add_buf_message({
112112
role = "user",
113-
content = "@mcp I have provided you a guide to create Lua native MCP servers for mcphub.nvim plugin. My Neovim config directory is '"
113+
content = "@{mcp} I have provided you a guide to create Lua native MCP servers for mcphub.nvim plugin. My Neovim config directory is '"
114114
.. vim.fn.stdpath("config")
115115
.. "'. Once you understood the guide thoroughly, please ask me what kind of server, tools, or resources I want to create.",
116116
})

lua/mcphub/utils/validation.lua

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,17 @@ function M.validate_server_config(name, config)
151151
),
152152
}
153153
end
154+
155+
if config.cwd and (type(config.cwd) ~= "string" or config.cwd == "") then
156+
return {
157+
ok = false,
158+
error = Error(
159+
"VALIDATION",
160+
Error.Types.SETUP.INVALID_CONFIG,
161+
string.format("Server '%s' has invalid cwd: must be a non-empty string", name)
162+
),
163+
}
164+
end
154165
elseif has_sse then
155166
-- Validate SSE config
156167
if type(config.url) ~= "string" or config.url == "" then

lua/mcphub/utils/version.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
return {
2-
PLUGIN_VERSION = "5.11.0", -- Current plugin version
2+
PLUGIN_VERSION = "5.11.1", -- Current plugin version
33
REQUIRED_NODE_VERSION = { -- Required mcp-hub version
44
major = 3,
55
minor = 7,
6-
patch = 0,
7-
string = "3.7.0",
6+
patch = 2,
7+
string = "3.7.2",
88
},
99
}

0 commit comments

Comments
 (0)