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
Copy file name to clipboardExpand all lines: docs/index.md
+35-4Lines changed: 35 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -728,6 +728,37 @@ When configuration changes are detected, Magg:
728
728
-`MAGG_PREFIX_SEP` (default: `_`) - Separator between prefix and tool name
729
729
-`MAGG_SELF_PREFIX` (default: `magg`) - Prefix for Magg's own tools
730
730
731
+
### Environment Variable Inheritance
732
+
733
+
By default, stdio-based MCP servers run with isolated environments. While the recommended approach is to configure environment variables in the server configuration (see Advanced Configuration), you can also pass environment variables at runtime to all stdio subprocesses:
734
+
735
+
**Pass current environment to servers:**
736
+
```bash
737
+
magg serve --env-pass
738
+
```
739
+
740
+
**Set specific environment variables:**
741
+
```bash
742
+
magg serve --env-set API_KEY mykey --env-set LANG en_US.UTF-8
743
+
```
744
+
745
+
**Combined usage:**
746
+
```bash
747
+
# Pass current env and add specific variables
748
+
magg serve --env-pass --env-set DEBUG true
749
+
```
750
+
751
+
This is useful for:
752
+
- Passing API keys and authentication tokens to servers
753
+
- Sharing PATH and system configuration
754
+
- Development environments where servers need local tools
755
+
- CI/CD pipelines with environment-based configuration
756
+
757
+
**Note:**
758
+
- Environment inheritance only affects stdio-based servers. HTTP/URI servers do not receive inherited environment variables.
759
+
- The preferred method is to set environment variables in the server configuration's `env` field for better reproducibility.
760
+
- The `mbro` CLI tool also supports these same `--env-pass` and `--env-set` flags when connecting to servers.
761
+
731
762
### Usage Examples
732
763
733
764
**Automatic reload (default):**
@@ -996,16 +1027,16 @@ export MAGG_SELF_PREFIX=""
996
1027
You can change the separator between prefix and tool name:
0 commit comments