A Nix flake wrapping the mcp-hub CLI (version 3.4.0) — a centralized manager for Model Context Protocol servers.
mcp-hub is a centralized manager for Model Context Protocol (MCP) servers, allowing you to connect, monitor, and use multiple MCP servers through a unified CLI and REST API :contentReference[oaicite:1]{index=1}.
Key capabilities include:
- Dynamic management of local (STDIO) and remote (streamable-http / SSE) MCP servers
- Real-time monitoring of servers, tools, and resources
- Support for OAuth PKCE and header‑based authentication
- Seamless SSE event streaming to clients
- Auto-reconnection and health check mechanisms :contentReference[oaicite:2]{index=2}
Add this flake as an input in your flake.nix:
inputs = {
mcp-hub = { url = "github:NikitolProject/mcp-hub-flake"; };
nixpkgs = ...;
};Include it in your packages:
outputs = { self, nixpkgs, mcp-hub }:
{
environment.systemPackages = [
mcp-hub.packages.${system}.default
];
};This makes the mcp-hub binary available across your system.
Run from terminal:
mcp-hub --port 3000 --config path/to/config.jsonFlags:
--port <port>— (required) REST server port--config <path>— (required) JSON config file- Additional flags supported upstream include
--watch,--auto-shutdown,--shutdown-delay
Check builtin help and version:
mcp-hub --help
mcp-hub --version # 3.4.0Launch a dev environment with nix develop to access both mcp-hub and jq:
nix develop
mcp-hub --port 3000 --config ./mcp-servers.jsonYour JSON config can define:
- Local servers via
"command"and"args" - Remote servers via
"url"and optional"headers" - Variable substitution via
${ENV_VAR}or${cmd:...}syntax - Hot-reloading in dev mode with server restarts
Example structure:
{
"mcpServers": {
"local-server": {
"command": "${MCP_BINARY_PATH}/server",
"args": ["--token", "${API_TOKEN}"],
"env": { "API_TOKEN": "${cmd: aws ssm get-parameter ...}" },
"dev": {
"enabled": true,
"watch": ["src/**/*.js"],
"cwd": "/path/to/server"
}
},
"remote-server": {
"url": "https://${HOST}/mcp",
"headers": {
"Authorization": "Bearer ${cmd: op read op://...}"
}
}
}
}Detailed syntax is documented in the upstream mcp-hub documentation (github.com, github.com).
Neovim integration with mcphub.nvim:
{ mcphub-nvim, mcp-hub, ... }:
{
extraPlugins = [ mcphub-nvim ];
extraConfigLua = ''
require("mcphub").setup({
port = 3000,
config = "~/mcp-servers.json",
cmd = "${mcp-hub}/bin/mcp-hub"
})
'';
}This enables tool/resource execution directly in Neovim via the MCP hub (github.com, reddit.com).
- Version: 3.4.0 (npm official)
- License: MIT
- Platform: x86_64-linux
- Dependencies: nodejs, jq
Feel free to:
- Update
versionandsrcinflake.nixto track newer upstream versions - Add support for other platforms by adjusting
system
mcp-hub --help
mcp-hub --version- Core
mcp-hubGitHub repo (manager for MCP servers) (github.com) - Features overview: streamable‑http, SSE, OAuth, SSE events, reconnect logic (github.com)