Skip to content

Commit 0079099

Browse files
authored
feat(mcp): expose current context page resource (#335)
1 parent 3101755 commit 0079099

25 files changed

Lines changed: 465 additions & 168 deletions

File tree

examples/analytics-dashboard-react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"start": "next start"
1010
},
1111
"dependencies": {
12-
"@askable-ui/react": "^0.13.1",
12+
"@askable-ui/react": "^0.14.0",
1313
"@hookform/resolvers": "^3.9.1",
1414
"@radix-ui/react-accordion": "1.2.12",
1515
"@radix-ui/react-alert-dialog": "1.1.15",

examples/react-native-expo/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"typecheck": "tsc --noEmit"
1212
},
1313
"dependencies": {
14-
"@askable-ui/core": "^0.13.1",
15-
"@askable-ui/react-native": "^0.13.1",
14+
"@askable-ui/core": "^0.14.0",
15+
"@askable-ui/react-native": "^0.14.0",
1616
"@react-navigation/native": "^7.2.5",
1717
"@react-navigation/native-stack": "^7.16.0",
1818
"expo": "^55.0.26",

package-lock.json

Lines changed: 17 additions & 58 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "askable",
3-
"version": "0.13.1",
3+
"version": "0.14.0",
44
"private": true,
55
"workspaces": [
66
"packages/*"

packages/context/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@askable-ui/context",
3-
"version": "0.13.1",
3+
"version": "0.14.0",
44
"description": "Open Context packet types and schema for AI-native interfaces",
55
"type": "module",
66
"main": "./dist/index.js",

packages/core/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@askable-ui/core",
3-
"version": "0.13.1",
3+
"version": "0.14.0",
44
"description": "Framework-agnostic context tracker for LLM-aware UIs",
55
"type": "module",
66
"main": "./dist/index.js",
@@ -38,7 +38,7 @@
3838
"homepage": "https://askable-ui.com",
3939
"license": "MIT",
4040
"dependencies": {
41-
"@askable-ui/context": "^0.13.1"
41+
"@askable-ui/context": "^0.14.0"
4242
},
4343
"devDependencies": {
4444
"jsdom": "^29.1.1",

packages/create-askable-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@askable-ui/create-app",
3-
"version": "0.13.1",
3+
"version": "0.14.0",
44
"description": "Scaffold a React + Vite + CopilotKit + askable-ui starter app",
55
"type": "module",
66
"bin": {

packages/create-askable-app/src/scaffold.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import fs from 'node:fs';
22
import path from 'node:path';
33
import { fileURLToPath } from 'node:url';
44

5-
const ASKABLE_VERSION = '0.12.0';
5+
const ASKABLE_VERSION = '0.14.0';
66
const COPILOTKIT_VERSION = '1.59.2';
77

88
const __filename = fileURLToPath(import.meta.url);

packages/mcp/README.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ Hosted Web MCP is the server-side path. For local browser workflows, a page
145145
cannot expose MCP directly to Claude or ChatGPT by itself. It needs a trusted
146146
browser extension or local companion process. `createAskableMcpPageBridge()`
147147
adds the page-side handoff: the page listens for approved bridge requests and
148-
returns the current packet or prompt-ready text through `window.postMessage()`.
149-
The extension or companion can then expose that data through its own local MCP
150-
server.
148+
returns the current packet, prompt-ready text, or a resource-shaped
149+
`askable://current` payload through `window.postMessage()`. The extension or
150+
companion can then expose that data through its own local MCP server.
151151

152152
```ts
153153
import { createAskableMcpContextProvider, createAskableMcpPageBridge } from '@askable-ui/mcp';
@@ -181,6 +181,29 @@ window.postMessage({
181181
```
182182

183183
Use `type: 'format_context_for_prompt'` when the bridge needs prompt-ready text
184-
instead of the structured packet. Keep user consent and installation trust in
184+
instead of the structured packet.
185+
186+
Use `type: 'read_current_resource'` when the extension or companion wants a
187+
resource-shaped response that can map directly to MCP `resources/read` output:
188+
189+
```ts
190+
window.postMessage({
191+
protocol: 'askable.mcp.page_bridge',
192+
version: '0.1',
193+
channel: 'askable:mcp',
194+
type: 'read_current_resource',
195+
requestId: crypto.randomUUID(),
196+
options: {
197+
sources: ['accounts'],
198+
resource: {
199+
uri: 'askable://current',
200+
format: 'packet',
201+
},
202+
},
203+
}, window.location.origin);
204+
```
205+
206+
Set `resource.format` to `prompt` to receive `text/plain` prompt context at a
207+
URI such as `askable://current.txt`. Keep user consent and installation trust in
185208
the extension or companion, and enable the page bridge only when the app wants
186209
to participate in local browser MCP workflows.

packages/mcp/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@askable-ui/mcp",
3-
"version": "0.13.1",
3+
"version": "0.14.0",
44
"description": "MCP bridge for exposing Context packets to agents",
55
"type": "module",
66
"main": "./dist/index.js",
@@ -36,8 +36,8 @@
3636
"homepage": "https://askable-ui.com",
3737
"license": "MIT",
3838
"dependencies": {
39-
"@askable-ui/context": "^0.13.1",
40-
"@askable-ui/core": "^0.13.1",
39+
"@askable-ui/context": "^0.14.0",
40+
"@askable-ui/core": "^0.14.0",
4141
"@modelcontextprotocol/sdk": "^1.29.0",
4242
"zod": "^4.4.3"
4343
},

0 commit comments

Comments
 (0)