mcp-page-bridge-protocol 0.1.4 → 0.1.6

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.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * browser-side client (extension). Keep this dependency-free so it can be
4
4
  * bundled into a service worker / content script as well as Node.
5
5
  */
6
- export declare const MCP_PAGE_BRIDGE_VERSION = "0.1.4";
6
+ export declare const MCP_PAGE_BRIDGE_VERSION = "0.1.6";
7
7
  /** WebSocket subprotocol negotiated between the browser client and the bridge. */
8
8
  export declare const WS_SUBPROTOCOL = "mcp";
9
9
  /** Default port the bridge listens on for browser WebSocket connections. */
@@ -30,6 +30,26 @@ export interface ProviderMeta {
30
30
  /** Bridge -> extension private JSON-RPC methods used by the local dashboard. */
31
31
  export declare const MCP_PAGE_BRIDGE_DASHBOARD_ACTIVATE_TAB: "mcpPageBridge/activateTab";
32
32
  export declare const MCP_PAGE_BRIDGE_DASHBOARD_CLOSE_TAB: "mcpPageBridge/closeTab";
33
+ /**
34
+ * Header the local dashboard sends on state-changing HTTP requests. Cross-origin
35
+ * pages cannot set custom headers without a CORS preflight, so this (combined
36
+ * with Origin/Host validation on the bridge) keeps the JSON API local-only.
37
+ */
38
+ export declare const DASHBOARD_HEADER: "x-mcp-page-bridge-dashboard";
39
+ export declare const DASHBOARD_HEADER_VALUE: "1";
40
+ /** Header carrying the shared token on HTTP API requests when a token is set. */
41
+ export declare const TOKEN_HEADER: "x-mcp-page-bridge-token";
42
+ /** Stable service identifier returned by `GET /api/providers` so clients can be sure the port hosts a real bridge (not a foreign HTTP server). */
43
+ export declare const SERVICE_ID: "mcp-page-bridge";
44
+ /**
45
+ * Names of the built-in page tools the extension registers on an enabled tab.
46
+ * Single source of truth so the dashboard can classify them without drifting.
47
+ * Must stay in sync with the tools registered in
48
+ * packages/extension/src/builtins.ts.
49
+ */
50
+ export declare const BUILTIN_TOOL_NAMES: readonly ["eval", "dom_query", "get_page_info", "click", "set_value", "scroll", "wait_for", "get_html", "get_selected_element", "get_selected_elements", "get_computed_style", "highlight_element", "show_selected_marker", "hide_selected_marker", "clear_selected_elements", "remove_selected_element", "update_selected_element", "apply_css", "list_css_patches", "remove_css_patch", "clear_css_patches", "export_css_patches", "export_design_changes", "accessibility_audit", "responsive_summary", "debug_summary", "console_logs", "capture_design_baseline", "compare_design_baseline", "clear_design_baseline", "screenshot", "navigate", "reload"];
51
+ /** Names of the opt-in "browser" provider tools (service-worker hosted, all-tabs). */
52
+ export declare const BROWSER_TOOL_NAMES: readonly ["list_tabs", "open_tab", "activate_tab", "navigate_tab", "close_tab"];
33
53
  /** Direction of an internal channel message relative to the bridge. */
34
54
  export type ChannelDir = "up" | "down";
35
55
  /**
@@ -81,5 +101,11 @@ export interface ControlPayload {
81
101
  name?: string;
82
102
  group?: string;
83
103
  visible?: boolean;
104
+ /**
105
+ * On "activate": whether the opt-in design/selection built-in toolset should
106
+ * be registered. Off by default to keep the built-in tool catalog (and the
107
+ * agent's token cost) small.
108
+ */
109
+ designTools?: boolean;
84
110
  }
85
111
  export declare const MCP_PAGE_BRIDGE_MARK: "__mcpPageBridge";
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * browser-side client (extension). Keep this dependency-free so it can be
4
4
  * bundled into a service worker / content script as well as Node.
5
5
  */
6
- export const MCP_PAGE_BRIDGE_VERSION = "0.1.4";
6
+ export const MCP_PAGE_BRIDGE_VERSION = "0.1.6";
7
7
  /** WebSocket subprotocol negotiated between the browser client and the bridge. */
8
8
  export const WS_SUBPROTOCOL = "mcp";
9
9
  /** Default port the bridge listens on for browser WebSocket connections. */
@@ -34,4 +34,64 @@ export function namespaceName(label, name) {
34
34
  /** Bridge -> extension private JSON-RPC methods used by the local dashboard. */
35
35
  export const MCP_PAGE_BRIDGE_DASHBOARD_ACTIVATE_TAB = "mcpPageBridge/activateTab";
36
36
  export const MCP_PAGE_BRIDGE_DASHBOARD_CLOSE_TAB = "mcpPageBridge/closeTab";
37
+ /**
38
+ * Header the local dashboard sends on state-changing HTTP requests. Cross-origin
39
+ * pages cannot set custom headers without a CORS preflight, so this (combined
40
+ * with Origin/Host validation on the bridge) keeps the JSON API local-only.
41
+ */
42
+ export const DASHBOARD_HEADER = "x-mcp-page-bridge-dashboard";
43
+ export const DASHBOARD_HEADER_VALUE = "1";
44
+ /** Header carrying the shared token on HTTP API requests when a token is set. */
45
+ export const TOKEN_HEADER = "x-mcp-page-bridge-token";
46
+ /** Stable service identifier returned by `GET /api/providers` so clients can be sure the port hosts a real bridge (not a foreign HTTP server). */
47
+ export const SERVICE_ID = "mcp-page-bridge";
48
+ /**
49
+ * Names of the built-in page tools the extension registers on an enabled tab.
50
+ * Single source of truth so the dashboard can classify them without drifting.
51
+ * Must stay in sync with the tools registered in
52
+ * packages/extension/src/builtins.ts.
53
+ */
54
+ export const BUILTIN_TOOL_NAMES = [
55
+ // Page inspection / interaction
56
+ "eval",
57
+ "dom_query",
58
+ "get_page_info",
59
+ "click",
60
+ "set_value",
61
+ "scroll",
62
+ "wait_for",
63
+ "get_html",
64
+ // Element selection
65
+ "get_selected_element",
66
+ "get_selected_elements",
67
+ "get_computed_style",
68
+ "highlight_element",
69
+ "show_selected_marker",
70
+ "hide_selected_marker",
71
+ "clear_selected_elements",
72
+ "remove_selected_element",
73
+ "update_selected_element",
74
+ // CSS patching
75
+ "apply_css",
76
+ "list_css_patches",
77
+ "remove_css_patch",
78
+ "clear_css_patches",
79
+ "export_css_patches",
80
+ "export_design_changes",
81
+ // Audits / diagnostics
82
+ "accessibility_audit",
83
+ "responsive_summary",
84
+ "debug_summary",
85
+ "console_logs",
86
+ // Design baseline
87
+ "capture_design_baseline",
88
+ "compare_design_baseline",
89
+ "clear_design_baseline",
90
+ // Service-worker delegated
91
+ "screenshot",
92
+ "navigate",
93
+ "reload",
94
+ ];
95
+ /** Names of the opt-in "browser" provider tools (service-worker hosted, all-tabs). */
96
+ export const BROWSER_TOOL_NAMES = ["list_tabs", "open_tab", "activate_tab", "navigate_tab", "close_tab"];
37
97
  export const MCP_PAGE_BRIDGE_MARK = "__mcpPageBridge";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-page-bridge-protocol",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "type": "module",
5
5
  "description": "Shared constants/helpers for the mcp-page-bridge bridge and browser client",
6
6
  "license": "MIT",