Skip to content

Commit 45f5c65

Browse files
committed
feat(config): make local dashboard authentication optional
1 parent e7ef406 commit 45f5c65

28 files changed

Lines changed: 258 additions & 103 deletions

‎.env.example‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ POWERCONTEXT_SERVER_ACCESS_DEPLOYMENT_ID=powercontext
3434
# POWERCONTEXT_SERVER_ACCESS_BACKGROUND_PRINCIPAL_DESCRIPTION=Scheduled processing
3535

3636
# Dashboard -------------------------------------------------------------------
37-
# Personal/demo viewer. Enabling requires ACCESS_MODE=enforced and a static AUTH_TOKEN.
37+
# Personal/demo viewer. Local access needs no token with ACCESS_MODE=disabled.
38+
# To require a token, set ACCESS_MODE=enforced and AUTH_TOKEN.
3839
# Injected authentication or authorization Providers are not supported by the Dashboard.
3940
POWERCONTEXT_SERVER_DASHBOARD_ENABLED=false
4041

‎docs/en/development/dashboard.md‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Dashboard design principles
22

3-
The Dashboard is a content viewer for personal use and demonstrations, authenticated by a static token and disabled by default. This document helps developers and reviewers decide what a page should show, how to organize reading, and whether a change preserves the behavior users need. The API contract in `openapi/powercontext.yaml` and the service implementation define the available capabilities.
3+
The Dashboard is a content viewer for personal use and demonstrations, disabled by default. It shares the Server access mode: local access can be anonymous, while enforced access requires a static token. This document helps developers and reviewers decide what a page should show, how to organize reading, and whether a change preserves the behavior users need. The API contract in `openapi/powercontext.yaml` and the service implementation define the available capabilities.
44

55
## What the Dashboard helps users do
66

@@ -96,9 +96,10 @@ Chinese, English, light and dark settings apply across the Dashboard, including
9696

9797
Pages show actual readable data, and actions correspond to existing capabilities. If one section fails, other independently readable content remains visible. Read errors, insufficient permissions and missing generation configuration have different meanings and must not collapse into an empty state.
9898

99-
The Dashboard supports the built-in static Bearer identity, with the same permissions for every token holder. Enabling it
100-
requires `POWERCONTEXT_SERVER_DASHBOARD_ENABLED=true`, `ACCESS_MODE=enforced`, and `AUTH_TOKEN`. Team deployments that
101-
inject authentication or authorization Providers must disable it. Pages reuse the existing API and its access checks;
99+
Enable Dashboard with `POWERCONTEXT_SERVER_DASHBOARD_ENABLED=true`. Local `ACCESS_MODE=disabled` opens directly without
100+
a token. With `ACCESS_MODE=enforced`, it requires `AUTH_TOKEN` and uses the built-in static Bearer identity, with the
101+
same permissions for every token holder. Team deployments that inject authentication or authorization Providers must
102+
disable it. Pages reuse the existing API and follow the Server access mode;
102103
they add no data endpoints or member and role management. See [Install and run](../docs/get-started/install-and-run.md)
103104
for personal setup.
104105

‎docs/en/docs/get-started/configure-server-environment.md‎

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ then asks about Dashboard and access settings and only the model connections nee
2323
memory uses explicit Agent-saved memories and full-text recall without a separate model API; automatic processing
2424
and semantic retrieval require their respective model settings. Existing files can be reused or adjusted by module.
2525

26-
A fresh local setup leaves Dashboard and authentication disabled. Enable Dashboard to opt into authenticated
27-
access, or set `POWERCONTEXT_SERVER_ACCESS_MODE=enforced` and `POWERCONTEXT_SERVER_AUTH_TOKEN` explicitly.
26+
A fresh local setup leaves Dashboard and authentication disabled. Enabling Dashboard does not require authentication.
27+
For manual authentication setup, set `POWERCONTEXT_SERVER_ACCESS_MODE=enforced` and `POWERCONTEXT_SERVER_AUTH_TOKEN`.
2828
Remote setup enables authentication. Existing Dashboard and authentication settings are preserved when accepting defaults.
2929

3030
Agent configuration selects one Agent at a time and can then add another; configured choices are removed from the
@@ -57,6 +57,24 @@ hidden wizard prompts, your environment, or a secret manager, not in command-lin
5757
Windows support is `experimental`. Before using the file for a personal service, restrict its ACL as described in
5858
[Deploy the Server](../operate/deploy-server.md).
5959

60+
### Local Dashboard and optional authentication
61+
62+
When enabling Dashboard in a new local setup, the wizard offers optional authentication, disabled by default.
63+
Accepting the default generates no Server token: the browser opens directly, and HTTP API and MCP requests need no
64+
Authorization header. The minimal settings are:
65+
66+
```dotenv
67+
POWERCONTEXT_SERVER_HTTP_HOST=127.0.0.1
68+
POWERCONTEXT_SERVER_DASHBOARD_ENABLED=true
69+
POWERCONTEXT_SERVER_ACCESS_MODE=disabled
70+
```
71+
72+
To require authentication, select it when enabling Dashboard. The wizard generates a token and writes
73+
credentials for the selected Agents. For manual configuration, set `POWERCONTEXT_SERVER_ACCESS_MODE=enforced` and
74+
`POWERCONTEXT_SERVER_AUTH_TOKEN`. Dashboard, HTTP API, and MCP share this setting. Remote scenarios still enable authentication.
75+
76+
Existing authenticated configurations retain their token and access mode.
77+
6078
### Choose or change the Web / Server port
6179

6280
Dashboard, HTTP API, and MCP share one Server listener; there is no separate Dashboard port.
@@ -130,7 +148,7 @@ powercontext ready
130148
powercontext capabilities
131149
```
132150

133-
This supplies the client address and Server Token without loading model API keys into the client environment.
151+
This supplies the client address and, when authentication is enabled, the Server token. Local unauthenticated configurations need no token.
134152
Follow `.env.next-steps.md` to create Scopes and install plugins, then verify real memory using the [quickstart](quickstart.md).
135153

136154
For every variable, default, and precedence rule, see [Configuration](../operate/configuration.md).

‎docs/en/docs/get-started/install-and-run.md‎

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,26 +75,30 @@ Without environment variables or an environment file, the Server:
7575
`Ctrl-C` performs a clean shutdown. Restarting the command reopens the same database.
7676

7777
The Dashboard is an optional content viewer for personal use and demonstrations. It is disabled by default and needs
78-
no separate frontend installation or model configuration. To enable it, put these settings in a protected environment
79-
file and replace the token example with your own long random credential:
78+
no separate frontend installation or model configuration. To enable it locally without a token, save these settings
79+
in an environment file:
8080

8181
```dotenv
82+
POWERCONTEXT_SERVER_HTTP_HOST=127.0.0.1
8283
POWERCONTEXT_SERVER_DASHBOARD_ENABLED=true
83-
POWERCONTEXT_SERVER_ACCESS_MODE=enforced
84-
POWERCONTEXT_SERVER_AUTH_TOKEN=replace-with-your-random-token
84+
POWERCONTEXT_SERVER_ACCESS_MODE=disabled
8585
```
8686

87+
To require authentication, set `POWERCONTEXT_SERVER_ACCESS_MODE=enforced` and set `POWERCONTEXT_SERVER_AUTH_TOKEN` to
88+
your own long random credential. The [configuration wizard](configure-server-environment.md#local-dashboard-and-optional-authentication)
89+
also offers this choice when enabling Dashboard locally.
90+
8791
```bash
8892
chmod 600 /path/to/powercontext.env
8993
powercontext config validate --env-file /path/to/powercontext.env
9094
powercontext server run --env-file /path/to/powercontext.env
9195
```
9296

93-
Open `http://127.0.0.1:8000/dashboard/home` and enter the same token. Use the actual port if you change it.
94-
The token also protects the Server API and MCP, so connected Agents need it too. The CLI does not automatically load
95-
a directory's `.env` file.
97+
Open `http://127.0.0.1:8000/dashboard/home`, using the actual port if you change it. With authentication disabled, the
98+
page opens directly. When enabled, sign in with the Server token and configure connected Agents to use it for API
99+
and MCP requests. The CLI does not automatically load a directory's `.env` file.
96100

97-
The first sign-in selects the Server default Scope. Pages are empty until content is saved. Save a Memory through an
101+
The first visit selects the Server default Scope. Pages are empty until content is saved. Save a Memory through an
98102
Agent or public API, then refresh Memories in the same Scope. Experiences, skills, handoffs, and usage also come from
99103
saved records. The Dashboard does not capture sessions, run generation, or approve candidates. The Dashboard and Agent
100104
must use the same Server and Scope.
@@ -104,8 +108,9 @@ revision does not change the current profile. In **Handoff**, use **Export Markd
104108
detail page to download that exact revision, including its full text, omissions, and citations. If sign-in expires,
105109
sign in again to return to the selected detail, then repeat the download.
106110

107-
All token holders use one identity. Multi-user RBAC deployments should leave the Dashboard disabled and use the API,
108-
MCP, or host integrations. See [Deploy the Server](../operate/deploy-server.md) for network and credential configuration.
111+
When authentication is enabled, all token holders use one identity. Multi-user RBAC deployments should leave the
112+
Dashboard disabled and use the API, MCP, or host integrations. See [Deploy the Server](../operate/deploy-server.md)
113+
for network and credential configuration.
109114

110115
This minimal launch does not enable model-backed extraction or vector search. To generate and validate one explicit
111116
environment file for those capabilities, continue with the
@@ -170,7 +175,7 @@ tag-table constraints during Server startup to support Topic Memory tags. Stop t
170175
one upgraded instance first so the schema upgrade completes before other instances connect. Databases from before
171176
1.0.0 also need the [Artifact processing migration](../operate/artifact-processing-migration.md) if it has not already
172177
been completed. Upgrade the Server, clients, and Agent integrations together.
173-
The Dashboard must be explicitly enabled with static Bearer authentication; see
178+
The Dashboard must be explicitly enabled; static Bearer authentication is optional for local use. See
174179
[Deploy the Server](../operate/deploy-server.md). Remote plaintext HTTP connections require explicit client consent;
175180
see [Connect to a remote Server](../operate/connect-remote-server.md).
176181

‎docs/en/docs/get-started/quickstart.md‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ For a first local installation:
2929
1. **Storage**: SQLite works without another database dependency. To try embedded seekdb, select it and approve the background dependency installation.
3030
2. **Usage scenario**: choose “Only on this machine” when your Agent, browser, and Server share a machine. For a remote Server, first read [Connect to a remote Server](../operate/connect-remote-server.md).
3131
3. **Memory capabilities**: select full memory and enter Generation and Embedding API details. See [Configure models](configure-models.md) for protocols and dimensions.
32-
4. **Dashboard**: enable it to inspect Sources and memories. The wizard creates or reuses a Server token.
32+
4. **Dashboard**: enable it to inspect Sources and memories. Local authentication defaults to off; enable it if you want to require a token. See [optional authentication](configure-server-environment.md#local-dashboard-and-optional-authentication).
3333
5. **Background processing**: start with the recommended schedule for each Artifact. An inspection interval is not a completion deadline; model processing takes additional time.
3434
6. **Agent**: select Codex and plan a new isolated Scope. Select Claude Code next if needed, then choose “Finish Agent configuration”.
3535
7. Review and save.
@@ -38,11 +38,12 @@ The wizard writes:
3838

3939
| File | Purpose |
4040
| --- | --- |
41-
| `.env` | Server, client, Agent, database, and model settings, including credentials and the Server token |
41+
| `.env` | Server, client, Agent, database, and model settings, including any configured credentials |
4242
| `.env.next-steps.md` | Startup, Scope creation, plugin connection, and checks for your choices |
4343

44-
The final screen shows the Dashboard URL, a newly generated token, and the SSH command when selected. Later, look up
45-
`POWERCONTEXT_SERVER_AUTH_TOKEN` in `.env`. These files contain credentials; do not commit them.
44+
The final screen shows the Dashboard URL and the SSH command when selected. If authentication is enabled, it also
45+
shows a newly generated Server token once; later, look up `POWERCONTEXT_SERVER_AUTH_TOKEN` in `.env`.
46+
These files can contain credentials; do not commit them.
4647
If seekdb is still installing, the wizard waits with an activity indicator. Complete any reported dependency recovery
4748
before starting the Server. Saving files or installing dependencies does not start the Server.
4849

@@ -56,7 +57,8 @@ powercontext server run --env-file .env
5657
```
5758

5859
Keep the terminal running. Open the Dashboard URL printed by the wizard, using the port saved as
59-
`POWERCONTEXT_SERVER_HTTP_PORT` in `.env`. Sign in with the **Server token**, not a model API key.
60+
`POWERCONTEXT_SERVER_HTTP_PORT` in `.env`. With authentication disabled, the page opens directly. Otherwise, sign in
61+
with the **Server token**, not a model API key.
6062
An empty Dashboard is expected before you capture data. For operation after closing the terminal, stop the foreground
6163
Server and install a [persistent personal service](../operate/deploy-server.md#run-a-persistent-personal-server)
6264
with `powercontext service install --env-file .env` to reuse the same configuration.
@@ -101,11 +103,11 @@ codex
101103

102104
Confirm that the PowerContext Hook and MCP have both loaded in Codex. For a non-default address, follow the Codex
103105
connection instructions in `.env.next-steps.md`: the installed plugin's `.mcp.json` must use the same Server as the Hook,
104-
and read Authorization from `POWERCONTEXT_CODEX_AUTHORIZATION`. Installing the plugin does not start the Server.
106+
with credentials configured when authentication is enabled. Installing the plugin does not start the Server.
105107

106108
These commands use Codex CLI. A desktop app may not inherit terminal environment variables. Before testing in the
107-
desktop app, verify that both its Hook and MCP receive the same URL, token, and Scope. See
108-
[Codex](../integrations/codex.md) and [Claude Code](../integrations/claude-code.md) for host-specific behavior.
109+
desktop app, verify that both its Hook and MCP receive the same URL and Scope, and credentials when authentication
110+
is enabled. See [Codex](../integrations/codex.md) and [Claude Code](../integrations/claude-code.md) for host-specific behavior.
109111

110112
Full memory also needs a generation policy for this real Scope to use Profile. Follow the
111113
[Profile policy steps](configure-models.md#enable-a-profile-policy-for-the-scope) to read its current version and update it;

‎docs/en/docs/integrations/codex.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ This adds inference latency to each prompt and is not the normal interactive set
9999

100100
## Connect to an authenticated local Server
101101

102-
Local Server authentication is disabled by default. Enable it when needed; enabling Dashboard also requires
103-
authenticated access. A fresh local configuration wizard leaves Dashboard off unless you select it.
102+
Local Server authentication is disabled by default and can be enabled independently of Dashboard.
103+
A fresh local configuration wizard leaves Dashboard off unless you select it; selecting it does not require a token.
104104

105105
Load one token from your local secret manager, then start the Server with authentication enabled:
106106

‎docs/en/docs/operate/configuration.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Server settings use the `POWERCONTEXT_SERVER_` prefix.
4949
| `POWERCONTEXT_SERVER_WORKSPACE` | Server startup directory | Resolution root for local project Agent Skill folders |
5050
| `POWERCONTEXT_SERVER_MCP_ENABLED` | `true` | Enable Streamable HTTP MCP |
5151
| `POWERCONTEXT_SERVER_MCP_PATH` | `/mcp` | MCP path |
52-
| `POWERCONTEXT_SERVER_DASHBOARD_ENABLED` | `false` | Personal and demonstration Dashboard; requires static Bearer authentication and does not support injected authentication or authorization Providers |
52+
| `POWERCONTEXT_SERVER_DASHBOARD_ENABLED` | `false` | Personal and demonstration Dashboard; local `ACCESS_MODE=disabled` needs no token, while `enforced` requires a static Bearer token; injected authentication or authorization Providers are unsupported |
5353
| `POWERCONTEXT_SERVER_AUTH_ENABLED` | `false` | Legacy static bearer switch; `true` maps to `ACCESS_MODE=enforced` and requires `AUTH_TOKEN` |
5454
| `POWERCONTEXT_SERVER_AUTH_TOKEN` | unset | Legacy static bearer token; used as compatibility authentication and mapped to the built-in administrator when no Authentication Provider is injected |
5555
| `POWERCONTEXT_SERVER_ACCESS_MODE` | `disabled` | The only supported Access switch: `disabled` or `enforced` |

‎docs/en/docs/operate/deploy-server.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,9 @@ orchestrator can probe them. API, MCP, metrics, and `/openapi.json` require auth
164164
public, but requests made from the interactive reference require authentication.
165165

166166
Personal or demonstration deployments can additionally set `POWERCONTEXT_SERVER_DASHBOARD_ENABLED=true` to expose
167-
`/dashboard/home` on the same port. It requires the static Bearer configuration above; startup fails clearly without a
168-
token. Browser sign-in uses the Server token, not a model API key. Credentials are stored in an HttpOnly,
167+
`/dashboard/home` on the same port. With `ACCESS_MODE=enforced`, it requires the static Bearer configuration above;
168+
startup fails clearly without a token. Local deployments using `ACCESS_MODE=disabled` can open Dashboard without
169+
sign-in. When authentication is enabled, browser sign-in uses the Server token, not a model API key. Credentials are stored in an HttpOnly,
169170
SameSite=Strict Cookie restricted to `/dashboard`, for up to eight hours. HTTPS sets Secure. Reverse proxies must
170171
preserve the external scheme and host for the sign-in same-origin check.
171172

‎docs/en/docs/operate/troubleshoot.md‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,8 @@ See [Server authentication and permissions](configuration.md#server) for Princip
182182
## Local tracing examples and existing Server configuration
183183

184184
The local Phoenix and Langfuse tracing examples are written for an isolated test instance and default to loopback
185-
addresses. Whether the Dashboard is enabled depends on the installed version and effective configuration. In newer
186-
versions, a personal Dashboard requires `ACCESS_MODE=enforced` and a valid `AUTH_TOKEN`; if startup reports
187-
`DASHBOARD_ENABLED requires ACCESS_MODE=enforced and AUTH_TOKEN`, complete the authentication configuration or disable
188-
the Dashboard in the isolated local test instance.
185+
addresses. Dashboard follows the Server access mode: local access with `ACCESS_MODE=disabled` requires no token and
186+
leaves `AUTH_TOKEN` unset; `ACCESS_MODE=enforced` requires a valid static token.
189187

190188
When an existing Server already uses static Bearer authentication, keep its authentication configuration while adding
191189
tracing. If you also enable the Dashboard, use the same static Bearer configuration:

‎docs/en/docs/workflows/review-candidates.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ evidence against the current Candidate version and reviewer permissions; an unav
7171
Omitting `memory_citations` or setting it to null on revision retains them; the HTTP request
7272
can explicitly replace them, and `[]` clears them. Approved Experience revisions preserve these citations in their lineage.
7373

74-
Dashboard is an opt-in personal content viewer using static Bearer authentication. It displays approved Experiences and
74+
Dashboard is an opt-in personal content viewer sharing the Server access mode; enforced access uses a static Bearer token.
75+
It displays approved Experiences and
7576
Skills, with exact references linking to historical Memory entries. Dream creation, Run inspection, and Candidate review
7677
use the CLI, Client, or HTTP API. See [Install and run](../get-started/install-and-run.md) to enable personal access.
7778

0 commit comments

Comments
 (0)