Metadata-Version: 2.4
Name: mcpassistant-gateway
Version: 0.1.0
Summary: Local outbound bridge agent for MCP capability forwarding
Author: Your Name
Requires-Python: >=3.11
Requires-Dist: httpx<1.0.0,>=0.28.1
Requires-Dist: mcp<2.0.0,>=1.6.0
Requires-Dist: pyjwt<3.0.0,>=2.10.1
Requires-Dist: python-dotenv<2.0.0,>=1.0.1
Requires-Dist: websockets<16.0.0,>=15.0.1
Description-Content-Type: text/markdown

# mcpassistant-gateway

Async local bridge that connects outbound to the remote MCP bridge over WSS and forwards invoke requests to local MCP servers using the MCP Python client library.

## Run

```bash
pip install -e .
mcpassistant-gateway
```

`mcpassistant-gateway` initializes MCP client sessions for configured `mcpServers` (stdio) and opens the outbound bridge connection to the remote server.

Startup token behavior:
- If `AGENT_JWT` is already configured (env or `config.json`), startup continues without prompting.
- If `AGENT_JWT` is missing, the CLI shows a styled prompt and asks you to paste the token.
- If WebSocket auth fails with `HTTP 403`, the CLI asks for a fresh `AGENT_JWT` and retries immediately.
- `AGENT_ID` is auto-derived from JWT claims (or token fingerprint fallback), so no manual `AGENT_ID` prompt.
- Prompted values are saved into resolved `config.json`, so next runs do not ask again.

Set `START_MCP_SERVERS=false` if you only want the bridge process.

Configuration can be provided through `.env` and/or `config.json`.

Minimal dynamic `.env`:

```env
REMOTE_SERVER_BASE_URL=https://your-remote-domain
AGENT_JWT=your_agent_jwt
```

With this mode:
- `REMOTE_WEBSOCKET_URL` is derived as `wss://.../connect`
- `AGENT_ID` and `CAPABILITIES` are derived from JWT claims (`sub`, `capabilities`) if not explicitly set
- Local MCP calls are handled via MCP client sessions for `mcpServers`

## mcpServers + mcpassistant-gateway-bridge

You can run MCP servers from config (supergateway-style) and derive local HTTP endpoints:

```json
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "supergateway", "--stdio", "npx", "-y", "@modelcontextprotocol/server-filesystem", "--port", "3004"],
      "port": 3004
    }
  }
}
```

Run one server:

```bash
mcpassistant-gateway-bridge --config ./config.json --name filesystem
```

Run all servers in config:

```bash
mcpassistant-gateway-bridge --config ./config.json
```


