Skip to content

Commit 9acb3e2

Browse files
committed
Release v0.10.0
Signed-off-by: Phillip Sitbon <phillip.sitbon@gmail.com>
2 parents 881a488 + 7684963 commit 9acb3e2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+843
-954
lines changed

.env.example

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
# Logging
1515
# MAGG_LOG_LEVEL=WARNING
16-
# MAGG_DEBUG=0
17-
# MAGG_QUIET=0
1816

1917
# Other options
2018
# MAGG_CONFIG_PATH=./magg/config.json

.github/workflows/docker-publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ jobs:
194194
strategy:
195195
matrix:
196196
include:
197-
- target: pre
198-
suffix: "-pre"
197+
# - target: pre
198+
# suffix: "-pre"
199199
- target: pro
200200
suffix: ""
201201

@@ -223,7 +223,7 @@ jobs:
223223
type=ref,event=pr,suffix=${{ matrix.suffix }}
224224
type=semver,pattern=v{{major}}.{{minor}}.{{patch}},pattern={{major}}.{{minor}}.{{patch}},suffix=${{ matrix.suffix }}
225225
type=semver,pattern=v{{major}}.{{minor}}.{{patch}},pattern={{major}}.{{minor}},suffix=${{ matrix.suffix }}
226-
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' && matrix.target == 'pro' }}
226+
# type=raw,value=current,enable=${{ github.ref == 'refs/heads/main' && matrix.target == 'pro' }}
227227
228228
- name: Build and push Docker image
229229
uses: docker/build-push-action@v6

compose.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ services:
1111
MAGG_PRIVATE_KEY: ${MAGG_PRIVATE_KEY:-}
1212
MAGG_LOG_LEVEL: ${MAGG_LOG_LEVEL:-}
1313
MAGG_CONFIG_PATH: ${MAGG_CONFIG_PATH:-}
14-
MAGG_QUIET: ${MAGG_QUIET:-}
15-
MAGG_DEBUG: ${MAGG_DEBUG:-}
1614
MAGG_SELF_PREFIX: ${MAGG_SELF_PREFIX:-}
1715
MAGG_AUTO_RELOAD: ${MAGG_AUTO_RELOAD:-false}
1816
MAGG_RELOAD_POLL_INTERVAL: ${MAGG_RELOAD_POLL_INTERVAL:-}

dockerfile

Lines changed: 45 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ WORKDIR ${HOME}
1717

1818
FROM base AS venv
1919

20-
ARG USER
21-
ARG HOME
22-
ARG PACKAGE
23-
ARG UID
24-
ARG MAGG_READ_ONLY=false
2520
ARG PYTHON_VERSION
2621

2722
ENV PYTHONDONTWRITEBYTECODE=1 \
@@ -30,9 +25,7 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
3025
UV_LINK_MODE=copy \
3126
PATH="${HOME}/.venv/bin:${PATH}" \
3227
VIRTUAL_ENV="${HOME}/.venv" \
33-
PS1="(${PACKAGE}) \h:\w\$ " \
34-
MAGG_CONFIG_PATH="${HOME}/.magg/config.json" \
35-
MAGG_READ_ONLY="${MAGG_READ_ONLY}"
28+
PS1="(${PACKAGE}) \h:\w\$ "
3629

3730
# Activating the venv through bash the "normal" way:
3831
# ENV BASH_ENV="${HOME}/.bashrc" # enables .bashrc to be sourced in non-interactive shells e.g. `bash -c`
@@ -42,12 +35,23 @@ RUN curl -LsSf https://astral.sh/uv/install.sh | sh
4235

4336
ADD --chown=${USER}:${USER} .python-version ./
4437

45-
# Override Python version if provided as build arg
4638
RUN if [ -n "${PYTHON_VERSION}" ]; then \
4739
echo "${PYTHON_VERSION}" > .python-version; \
4840
fi
4941

50-
# Install the project's dependencies using the lockfile and settings
42+
FROM venv AS proj
43+
44+
LABEL org.opencontainers.image.source=https://github.com/sitbon/magg \
45+
org.opencontainers.image.description="Magg - The Model Context Protocol (MCP) Aggregator (Project)" \
46+
org.opencontainers.image.licenses=AGPLv3 \
47+
org.opencontainers.image.authors="Phillip Sitbon <phillip.sitbon@gmail.com>"
48+
49+
ARG MAGG_CONFIG_PATH="${HOME}/.magg/config.json"
50+
ARG MAGG_READ_ONLY=false
51+
52+
ENV MAGG_CONFIG_PATH="${MAGG_CONFIG_PATH}" \
53+
MAGG_READ_ONLY="${MAGG_READ_ONLY}"
54+
5155
RUN --mount=type=cache,uid=${UID},gid=${UID},target=${HOME}/.cache/uv \
5256
--mount=type=bind,source=uv.lock,target=uv.lock \
5357
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
@@ -60,8 +64,6 @@ RUN if [ "${PYTHON_VERSION}" = "3.12" ]; then \
6064
'ln -sf "$(basename "$1")" "$(dirname "$1")/$(echo "$(basename "$1")" | sed "s/-musl\.so$/-gnu.so/")"' _ {} \; ; \
6165
fi
6266

63-
# Then, add the rest of the project source code and install it
64-
# Installing separately from its dependencies allows optimal layer caching
6567
ADD --chown=${USER}:${USER} pyproject.toml uv.lock readme.md license.md ./
6668
ADD --chown=${USER}:${USER} ${PACKAGE}/ ./${PACKAGE}/
6769

@@ -77,18 +79,13 @@ ENTRYPOINT ["/sbin/tini", "--"]
7779
CMD ["magg", "serve", "--http", "--host", "0.0.0.0", "--port", "8000"]
7880

7981

80-
FROM venv AS pre
82+
FROM proj AS pre
8183

8284
LABEL org.opencontainers.image.source=https://github.com/sitbon/magg \
8385
org.opencontainers.image.description="Magg - The Model Context Protocol (MCP) Aggregator (Staging)" \
8486
org.opencontainers.image.licenses=AGPLv3 \
8587
org.opencontainers.image.authors="Phillip Sitbon <phillip.sitbon@gmail.com>"
8688

87-
ARG USER
88-
ARG HOME
89-
ARG PACKAGE
90-
ARG MAGG_READ_ONLY
91-
9289
ENV MAGG_LOG_LEVEL=INFO
9390

9491
USER root
@@ -117,31 +114,47 @@ ENV MAGG_LOG_LEVEL=WARNING
117114
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
118115
CMD ["magg", "status"]
119116

120-
FROM venv AS dev
117+
FROM proj AS dev
121118

122119
LABEL org.opencontainers.image.source=https://github.com/sitbon/magg \
123120
org.opencontainers.image.description="Magg - The Model Context Protocol (MCP) Aggregator (Development)" \
124121
org.opencontainers.image.licenses=AGPLv3 \
125122
org.opencontainers.image.authors="Phillip Sitbon <phillip.sitbon@gmail.com>"
126123

127-
ARG USER
128-
ARG HOME
129-
ARG PACKAGE
130-
131124
ENV MAGG_LOG_LEVEL=DEBUG
132125

133-
# Reinstall dependencies with dev packages
126+
ADD --chown=${USER}:${USER} test/ ./test/
127+
134128
RUN --mount=type=cache,uid=1000,gid=1000,target=${HOME}/.cache/uv \
135129
--mount=type=bind,source=uv.lock,target=uv.lock \
136130
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
137131
uv sync --locked --dev
138132

139-
#USER root
140-
#RUN apk add --no-cache nano
141-
#USER ${USER}
133+
FROM dev AS pkg
134+
135+
LABEL org.opencontainers.image.source=https://github.com/sitbon/magg \
136+
org.opencontainers.image.description="Magg - The Model Context Protocol (MCP) Aggregator (Packaging)" \
137+
org.opencontainers.image.licenses=AGPLv3 \
138+
org.opencontainers.image.authors="Phillip Sitbon <phillip.sitbon@gmail.com>"
139+
140+
RUN --mount=type=cache,uid=${UID},gid=${UID},target=${HOME}/.cache/uv \
141+
--mount=type=bind,source=uv.lock,target=uv.lock \
142+
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
143+
uv build
144+
145+
FROM venv AS user
146+
147+
LABEL org.opencontainers.image.source=https://github.com/sitbon/magg \
148+
org.opencontainers.image.description="Magg - The Model Context Protocol (MCP) Aggregator (User Environment)" \
149+
org.opencontainers.image.licenses=AGPLv3 \
150+
org.opencontainers.image.authors="Phillip Sitbon <phillip.sitbon@gmail.com>"
151+
152+
ENV PS1="(user) \h:\w\$ "
153+
154+
COPY --from=pkg ${HOME}/dist/ ${HOME}/dist/
155+
156+
RUN uv init --no-workspace --no-package --no-readme --no-description --name user && \
157+
uv sync && \
158+
uv add "magg[dev] @ $(ls -t1 dist/*.whl | head -n 1)"
142159

143-
## Keep code writable in dev
144-
#USER root
145-
#RUN chown -R ${USER}:${USER} ${HOME}/${PACKAGE} && \
146-
# chmod -R u+rwX ${HOME}/${PACKAGE}
147-
#USER ${USER}
160+
CMD ["bash"]

docs/index.md

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,37 @@ When configuration changes are detected, Magg:
728728
- `MAGG_PREFIX_SEP` (default: `_`) - Separator between prefix and tool name
729729
- `MAGG_SELF_PREFIX` (default: `magg`) - Prefix for Magg's own tools
730730

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+
731762
### Usage Examples
732763

733764
**Automatic reload (default):**
@@ -996,16 +1027,16 @@ export MAGG_SELF_PREFIX=""
9961027
You can change the separator between prefix and tool name:
9971028

9981029
```bash
999-
# Default underscore separator: calc_add, magg_list_servers
1030+
# Default underscore separator: calc_add, magg_server_list
10001031
export MAGG_PREFIX_SEP="_"
10011032

1002-
# Dash separator: calc-add, magg-list-servers
1033+
# Dash separator: calc-add, magg-server-list
10031034
export MAGG_PREFIX_SEP="-"
10041035

1005-
# Dot separator: calc.add, magg.list.servers
1036+
# Dot separator: calc.add, magg.server.list
10061037
export MAGG_PREFIX_SEP="."
10071038

1008-
# No separator: calcadd, magglistservers
1039+
# No separator: calcadd, maggserverlist
10091040
export MAGG_PREFIX_SEP=""
10101041
```
10111042

docs/mbro.md

Lines changed: 45 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ mbro> call magg_server_enable <TAB>
296296
└─────────────────────────────────────────────────────┘
297297
```
298298
299-
#### 🔍 Enhanced Tab Completion
299+
#### 🔍 Tab Completion
300300
Tab completion provides rich parameter information:
301301
- **Parameter names with types**: `server=` | `string` | `required` | `Name of server to enable`
302302
- **Type-aware value suggestions**: Enum values, boolean `true/false`, examples
@@ -312,7 +312,7 @@ Error: Tool 'wether' not found.
312312
Did you mean: weather, whether_tool?
313313
```
314314
315-
#### ⚡ Enhanced Search
315+
#### ⚡ Search
316316
- Multi-word search support: `search file manager`
317317
- Searches across names, descriptions, and URIs
318318
- More flexible matching algorithms
@@ -559,35 +559,51 @@ mbro:magg> call weather_current location=London
559559
}
560560
```
561561
562-
### Example 4: Using Natural Language (Enhanced Mode)
562+
### Example 3.1: Using Magg in Hybrid Mode
563563
564564
```bash
565+
# mbro can host Magg in hybrid mode and connect via stdio
565566
$ mbro
566-
MBRO - MCP Browser
567-
Type 'help' for available commands or 'quit' to exit.
568-
Enhanced mode: Ctrl+M for multiline JSON, natural language supported
567+
mbro> connect magg "magg serve --hybrid --port 8080"
568+
Connected to 'magg' (Tools: 11, Resources: 5, Prompts: 2)
569569
570-
mbro> connect to calculator at npx -y @modelcontextprotocol/server-calculator
571-
Connected to 'calculator' (Tools: 4, Resources: 0, Prompts: 0)
570+
# Now Magg is:
571+
# - Connected to mbro via stdio
572+
# - Also accessible via HTTP at http://localhost:8080
572573
573-
mbro:calculator> what tools are available?
574-
Available tools:
575-
- add: Add two numbers
576-
- subtract: Subtract two numbers
577-
- multiply: Multiply two numbers
578-
- divide: Divide two numbers
574+
# In another terminal, different mbro instances can connect via HTTP
575+
$ mbro
576+
mbro> connect magg-remote http://localhost:8080
577+
Connected to 'magg-remote' (Tools: 11, Resources: 5, Prompts: 2)
579578
580-
mbro:calculator> call add with a=25 and b=17
581-
42
579+
# Both connections can use Magg simultaneously
580+
mbro:magg> call calc_add a=5 b=3
581+
8
582582
583-
mbro:calculator> search for mult
584-
Search results for 'mult':
583+
mbro:magg-remote> call calc_multiply a=5 b=3
584+
15
585+
```
585586
586-
Tools (1):
587-
- multiply: Multiply two numbers
587+
### Example 4: Script Automation
588+
589+
```bash
590+
# Create a script file for common tasks
591+
$ cat > weather_check.mbro << 'EOF'
592+
# Weather check script
593+
connect weather npx -y @modelcontextprotocol/server-weather
594+
call get_forecast location="San Francisco" days=3
595+
disconnect
596+
quit
597+
EOF
588598
589-
mbro:calculator> call multiply a=6 b=7
590-
42
599+
# Execute the script
600+
$ mbro -x weather_check.mbro
601+
602+
# Or execute non-interactively
603+
$ mbro -X weather_check.mbro
604+
605+
# Chain multiple scripts
606+
$ mbro -x setup.mbro -x weather_check.mbro -x cleanup.mbro
591607
```
592608
593609
## Output Modes
@@ -636,6 +652,9 @@ echo $result | jq
636652
637653
# One-liner with proper escaping
638654
mbro --json connect calc npx -y @modelcontextprotocol/server-calculator \; call add a=5 b=3 | jq
655+
656+
# Quiet mode - suppress informational messages
657+
mbro -q connect calc npx -y @modelcontextprotocol/server-calculator \; call add a=5 b=3
639658
```
640659
641660
## Tips and Tricks
@@ -649,11 +668,14 @@ mbro --json connect calc npx -y @modelcontextprotocol/server-calculator \; call
649668
650669
### Command Line Options
651670
- `commands` - Commands to execute (positional arguments)
671+
- `--version` / `-V` - Show version information
652672
- `--json` / `-j` - Output only JSON (machine-readable)
653673
- `--no-rich` - Disable Rich formatting
654674
- `--indent N` - Set JSON indent level (0 for compact, default: 2)
655675
- `--verbose` / `-v` - Enable verbose output (can be used multiple times)
656-
- `--no-enhanced` - Disable enhanced features (shell-style args, multiline, etc.)
676+
- `--quiet` / `-q` - Suppress informational messages
677+
- `--env-pass` / `-e` - Pass environment to stdio MCP servers
678+
- `--env-set KEY VALUE` / `-E KEY VALUE` - Set environment variable for stdio MCP servers (can be used multiple times)
657679
- `--repl` - Drop into REPL mode on startup
658680
- `-n` / `--no-interactive` - Don't drop into interactive mode after commands
659681
- `-x SCRIPT` / `--execute-script SCRIPT` - Execute .mbro script file (can be used multiple times)

examples/authentication.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"""
99
import argparse
1010
import asyncio
11+
import logging
1112
import os
1213
import sys
1314
from typing import Any
@@ -19,7 +20,6 @@
1920

2021
async def bearer_auth(args: argparse.Namespace) -> None:
2122
"""Test bearer token authentication with configurable options."""
22-
# Get JWT from environment or command line
2323
jwt = args.token
2424
if not jwt:
2525
jwt = os.environ.get(args.env_var)
@@ -175,7 +175,6 @@ async def main():
175175
args = parser.parse_args()
176176

177177
if args.debug:
178-
import logging
179178
logging.basicConfig(level=logging.DEBUG)
180179

181180
# Check if subcommand was provided

magg/auth.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ def load_keys(self) -> None:
3737
if not self.enabled:
3838
raise RuntimeError("Authentication is not enabled")
3939

40-
# Already loaded
4140
if self._private_key and self._public_key:
4241
return
4342

0 commit comments

Comments
 (0)