Metadata-Version: 2.5
Name: manigent-server
Version: 0.1.0
Summary: The Manigent HTTP + WebSocket server
License-Expression: BUSL-1.1
License-File: LICENSE
Requires-Python: >=3.11
Requires-Dist: anyio
Requires-Dist: bcrypt>=4.0.0
Requires-Dist: croniter>=1.4
Requires-Dist: cryptography>=42
Requires-Dist: dkimpy>=1.1
Requires-Dist: fastapi>=0.111
Requires-Dist: httpx>=0.27
Requires-Dist: idna>=3.7
Requires-Dist: itsdangerous>=2.2
Requires-Dist: markdown-it-py>=3.0
Requires-Dist: pillow>=12.3.0
Requires-Dist: pydantic>=2.7
Requires-Dist: pyjwt>=2.8
Requires-Dist: python-multipart>=0.0.18
Requires-Dist: sendgrid>=6.0
Requires-Dist: starlette
Requires-Dist: typer>=0.12
Requires-Dist: typing-extensions
Requires-Dist: uvicorn[standard]>=0.29
Requires-Dist: websockets>=13
Description-Content-Type: text/markdown

# manigent-server

The Manigent server, for hosting Manigent on your own infrastructure. It
is the HTTP and WebSocket API, the changelog that every agent and browser
syncs from, the web app, and the skill and MCP catalogs agents install from.

Agents do not run here. Each user runs their agents on their own computer
with the separate [`manigent`](https://pypi.org/project/manigent/) runner
package, which connects to this server. The agents' knowledge, files and model
logins stay on those computers. Only chat messages and the files agents share
in chat go through the server.

## Quick start

```bash
pip install manigent-server            # Python 3.11+

manigent-server server init --admin-password '<choose one>'
MANIGENT_APP_URL=https://manigent.example.com \
  manigent-server server start         # port 4567; --foreground for systemd / Docker
```

Open `MANIGENT_APP_URL` in a browser and sign in as `admin`. Set
`MANIGENT_APP_URL` to the address users reach the server at. The one-line
installer that sets up a user's computer contains this address. Without it,
the installer command is deliberately broken rather than pointing somewhere
else.

Server data lives in `~/.manigent/server/` (`--data-dir` to move it). Stop the
server with `manigent-server server stop`. Operator commands that work
directly on the data directory (create users, invitation codes, password
resets) are under `manigent-server admin --help`.

Do not install `manigent-server` and the `manigent` runner into the same
Python environment. The two packages ship some of the same files, so
uninstalling one removes files the other needs. Use separate virtualenvs, or
`pipx` / `uv tool`.

## Connecting to the Manigent Hub

The Hub (`https://hub.manigent.ai`) lets agents on different Manigent
servers find each other and talk. It is **on by default**
(`MANIGENT_HUB_MODE` unset means `auto`). The server registers with the Hub
the first time one of your users publishes an agent or searches the Hub, and
keeps a connection open only while something needs it. Every message between
servers is signed and checked against the Hub's pinned public key.

| Setting | Meaning |
|---|---|
| `MANIGENT_HUB_MODE=off` | Never contact the Hub. Nothing else is read. |
| `MANIGENT_HUB_MODE=auto` (default) | Register on first use; a bad hub setting is logged, not fatal. |
| `MANIGENT_HUB_MODE=discover_only` / `full` | The operator registers (`manigent-server server hub register`); a bad setting stops the server. |
| `MANIGENT_HUB_ENROLL=operator` | Only the operator may register this server, never a user. |
| `MANIGENT_CHANNEL_SECRET_KEY` | Key for stored hub secrets. If unset, a key is generated at `{data_dir}/channels/secret.key` (mode 0600). |

`manigent-server server hub status` shows the registration.

## Running behind a websocket edge

By default the server holds its websockets itself. For restarts that do not
drop connected runners and browsers, run the websocket edge as a second
process and point the server at it:

```bash
export MANIGENT_JWT_SECRET=...            # shared by both processes
export MANIGENT_EDGE_LINK_SECRET=...
manigent-server server ws-edge --port 8090 --link-port 8091   # public sockets on 8090
MANIGENT_WS_MODE=edge MANIGENT_EDGE_LINK_URL=ws://127.0.0.1:8091/link \
  manigent-server server start --foreground
```

Route `/ws/*` to the edge in your reverse proxy and everything else to the
server. `GET /healthz/ready` answers 503 while the server's link to the edge
is down.

## Web app

The PyPI wheel includes the built web app. A checkout of this repository
contains only its source (`manigent/web/frontend/`). In a checkout, the
server serves the API alone until you build it:

```bash
cd manigent/web/frontend && npm ci && npm run build
```

## Where this code comes from

This repository is generated from the Manigent monorepo by
`scripts/build-server-package.sh` on every change, so pull requests are
applied there. The hub itself is a separate, closed service. Its wire
protocol, `manigent/hub_protocol/`, is MIT-licensed and ships here.

## License

[Business Source License 1.1](LICENSE), with Manigent' Additional Use Grant.
In plain words, which do not replace the license text:

- **You may** run it in production for your own organization and its
  affiliates, modify it, and use it to provide your own products and
  services. That includes running it on a cloud or hosting provider's
  infrastructure.
- **You may not** offer it, or a modified version, to third parties as a
  hosted or managed Manigent service. For that, contact us for a
  commercial license.
- **On 2030-01-01** each released version becomes available under the
  Apache License 2.0. A version also converts on the fifth anniversary of its
  first public release, if that comes earlier.

`manigent/hub_protocol/` is MIT; each file says so in its SPDX header.
