@sanctuary-framework/mcp-server 0.5.1 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -38,6 +38,8 @@ interface SanctuaryConfig {
38
38
  host: string;
39
39
  /** Bearer token for dashboard auth. If "auto", one is generated at startup. */
40
40
  auth_token?: string;
41
+ /** Auto-open dashboard in default browser on startup. Default: true for localhost. */
42
+ auto_open?: boolean;
41
43
  /** TLS cert/key paths for HTTPS dashboard. */
42
44
  tls?: {
43
45
  cert_path: string;
@@ -1986,6 +1988,8 @@ interface DashboardConfig {
1986
1988
  cert_path: string;
1987
1989
  key_path: string;
1988
1990
  };
1991
+ /** Auto-open the dashboard in the default browser on startup. Default: true for localhost. */
1992
+ auto_open?: boolean;
1989
1993
  }
1990
1994
  declare class DashboardApprovalChannel implements ApprovalChannel {
1991
1995
  private config;
@@ -1996,8 +2000,11 @@ declare class DashboardApprovalChannel implements ApprovalChannel {
1996
2000
  private baseline;
1997
2001
  private auditLog;
1998
2002
  private dashboardHTML;
2003
+ private loginHTML;
1999
2004
  private authToken;
2000
2005
  private useTLS;
2006
+ /** Session TTL: longer for localhost, shorter for remote */
2007
+ private sessionTTLMs;
2001
2008
  /** SEC-012: Short-lived session store. Sessions replace URL query tokens. */
2002
2009
  private sessions;
2003
2010
  private sessionCleanupTimer;
@@ -2037,6 +2044,15 @@ declare class DashboardApprovalChannel implements ApprovalChannel {
2037
2044
  * Returns true if auth passes, false if blocked (response already sent).
2038
2045
  */
2039
2046
  private checkAuth;
2047
+ /**
2048
+ * Check if a request is authenticated WITHOUT sending a response.
2049
+ * Used to decide between login page vs dashboard for GET /.
2050
+ */
2051
+ private isAuthenticated;
2052
+ /**
2053
+ * Parse a specific cookie value from the request.
2054
+ */
2055
+ private parseCookie;
2040
2056
  /**
2041
2057
  * Create a short-lived session by exchanging the long-lived auth token
2042
2058
  * (provided in the Authorization header) for a session ID.
@@ -2074,6 +2090,7 @@ declare class DashboardApprovalChannel implements ApprovalChannel {
2074
2090
  * normal checkAuth flow.
2075
2091
  */
2076
2092
  private handleSessionExchange;
2093
+ private serveLoginPage;
2077
2094
  private serveDashboard;
2078
2095
  private handleSSE;
2079
2096
  private handleStatus;
@@ -2120,6 +2137,21 @@ declare class DashboardApprovalChannel implements ApprovalChannel {
2120
2137
  * Broadcast current protection status to connected dashboards.
2121
2138
  */
2122
2139
  broadcastProtectionStatus(data: Record<string, unknown>): void;
2140
+ /**
2141
+ * Open a URL in the system's default browser.
2142
+ * Cross-platform: macOS (open), Linux (xdg-open), Windows (start).
2143
+ * Fails silently — dashboard still works via terminal URL.
2144
+ */
2145
+ private openInBrowser;
2146
+ /**
2147
+ * Create a pre-authenticated URL for the dashboard.
2148
+ * Used by the sanctuary_dashboard_open tool and at startup.
2149
+ */
2150
+ createSessionUrl(): string;
2151
+ /**
2152
+ * Get the base URL for the dashboard.
2153
+ */
2154
+ getBaseUrl(): string;
2123
2155
  /** Get the number of pending requests */
2124
2156
  get pendingCount(): number;
2125
2157
  /** Get the number of connected SSE clients */
package/dist/index.d.ts CHANGED
@@ -38,6 +38,8 @@ interface SanctuaryConfig {
38
38
  host: string;
39
39
  /** Bearer token for dashboard auth. If "auto", one is generated at startup. */
40
40
  auth_token?: string;
41
+ /** Auto-open dashboard in default browser on startup. Default: true for localhost. */
42
+ auto_open?: boolean;
41
43
  /** TLS cert/key paths for HTTPS dashboard. */
42
44
  tls?: {
43
45
  cert_path: string;
@@ -1986,6 +1988,8 @@ interface DashboardConfig {
1986
1988
  cert_path: string;
1987
1989
  key_path: string;
1988
1990
  };
1991
+ /** Auto-open the dashboard in the default browser on startup. Default: true for localhost. */
1992
+ auto_open?: boolean;
1989
1993
  }
1990
1994
  declare class DashboardApprovalChannel implements ApprovalChannel {
1991
1995
  private config;
@@ -1996,8 +2000,11 @@ declare class DashboardApprovalChannel implements ApprovalChannel {
1996
2000
  private baseline;
1997
2001
  private auditLog;
1998
2002
  private dashboardHTML;
2003
+ private loginHTML;
1999
2004
  private authToken;
2000
2005
  private useTLS;
2006
+ /** Session TTL: longer for localhost, shorter for remote */
2007
+ private sessionTTLMs;
2001
2008
  /** SEC-012: Short-lived session store. Sessions replace URL query tokens. */
2002
2009
  private sessions;
2003
2010
  private sessionCleanupTimer;
@@ -2037,6 +2044,15 @@ declare class DashboardApprovalChannel implements ApprovalChannel {
2037
2044
  * Returns true if auth passes, false if blocked (response already sent).
2038
2045
  */
2039
2046
  private checkAuth;
2047
+ /**
2048
+ * Check if a request is authenticated WITHOUT sending a response.
2049
+ * Used to decide between login page vs dashboard for GET /.
2050
+ */
2051
+ private isAuthenticated;
2052
+ /**
2053
+ * Parse a specific cookie value from the request.
2054
+ */
2055
+ private parseCookie;
2040
2056
  /**
2041
2057
  * Create a short-lived session by exchanging the long-lived auth token
2042
2058
  * (provided in the Authorization header) for a session ID.
@@ -2074,6 +2090,7 @@ declare class DashboardApprovalChannel implements ApprovalChannel {
2074
2090
  * normal checkAuth flow.
2075
2091
  */
2076
2092
  private handleSessionExchange;
2093
+ private serveLoginPage;
2077
2094
  private serveDashboard;
2078
2095
  private handleSSE;
2079
2096
  private handleStatus;
@@ -2120,6 +2137,21 @@ declare class DashboardApprovalChannel implements ApprovalChannel {
2120
2137
  * Broadcast current protection status to connected dashboards.
2121
2138
  */
2122
2139
  broadcastProtectionStatus(data: Record<string, unknown>): void;
2140
+ /**
2141
+ * Open a URL in the system's default browser.
2142
+ * Cross-platform: macOS (open), Linux (xdg-open), Windows (start).
2143
+ * Fails silently — dashboard still works via terminal URL.
2144
+ */
2145
+ private openInBrowser;
2146
+ /**
2147
+ * Create a pre-authenticated URL for the dashboard.
2148
+ * Used by the sanctuary_dashboard_open tool and at startup.
2149
+ */
2150
+ createSessionUrl(): string;
2151
+ /**
2152
+ * Get the base URL for the dashboard.
2153
+ */
2154
+ getBaseUrl(): string;
2123
2155
  /** Get the number of pending requests */
2124
2156
  get pendingCount(): number;
2125
2157
  /** Get the number of connected SSE clients */