@runsnative/mcp-server 0.3.0 → 0.5.0
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/README.md +7 -1
- package/dist/components-inline.js +15478 -0
- package/dist/dev-host.js +68 -0
- package/dist/iframe-runtime.js +103 -0
- package/dist/index.js +2 -103
- package/dist/inferrer/nav-error.js +31 -0
- package/dist/inferrer/page-fetcher.js +6 -26
- package/dist/server.js +131 -0
- package/dist/surface/assets.js +89 -0
- package/dist/surface/gathering-card.js +162 -0
- package/dist/surface/iframe-runtime-entry.js +8 -0
- package/dist/surface/package-surface.js +59 -0
- package/dist/tokens/tokens-arctic-frost.css +1320 -0
- package/dist/tokens/tokens-botanical-garden.css +1320 -0
- package/dist/tokens/tokens-bridgesai.css +1269 -0
- package/dist/tokens/tokens-clay-studio.css +1320 -0
- package/dist/tokens/tokens-daisy-acid.css +1320 -0
- package/dist/tokens/tokens-daisy-aqua.css +1320 -0
- package/dist/tokens/tokens-daisy-autumn.css +1320 -0
- package/dist/tokens/tokens-daisy-black.css +1321 -0
- package/dist/tokens/tokens-daisy-bumblebee.css +1320 -0
- package/dist/tokens/tokens-daisy-business.css +1320 -0
- package/dist/tokens/tokens-daisy-cmyk.css +1321 -0
- package/dist/tokens/tokens-daisy-coffee.css +1320 -0
- package/dist/tokens/tokens-daisy-corporate.css +1320 -0
- package/dist/tokens/tokens-daisy-cupcake.css +1320 -0
- package/dist/tokens/tokens-daisy-cyberpunk.css +1320 -0
- package/dist/tokens/tokens-daisy-dark.css +1320 -0
- package/dist/tokens/tokens-daisy-dim.css +1320 -0
- package/dist/tokens/tokens-daisy-dracula.css +1320 -0
- package/dist/tokens/tokens-daisy-emerald.css +1320 -0
- package/dist/tokens/tokens-daisy-fantasy.css +1320 -0
- package/dist/tokens/tokens-daisy-forest.css +1320 -0
- package/dist/tokens/tokens-daisy-garden.css +1320 -0
- package/dist/tokens/tokens-daisy-halloween.css +1320 -0
- package/dist/tokens/tokens-daisy-lemonade.css +1320 -0
- package/dist/tokens/tokens-daisy-light.css +1320 -0
- package/dist/tokens/tokens-daisy-lofi.css +1321 -0
- package/dist/tokens/tokens-daisy-luxury.css +1320 -0
- package/dist/tokens/tokens-daisy-night.css +1320 -0
- package/dist/tokens/tokens-daisy-nord.css +1320 -0
- package/dist/tokens/tokens-daisy-pastel.css +1320 -0
- package/dist/tokens/tokens-daisy-retro.css +1320 -0
- package/dist/tokens/tokens-daisy-sunset.css +1320 -0
- package/dist/tokens/tokens-daisy-synthwave.css +1320 -0
- package/dist/tokens/tokens-daisy-valentine.css +1320 -0
- package/dist/tokens/tokens-daisy-winter.css +1320 -0
- package/dist/tokens/tokens-daisy-wireframe.css +1321 -0
- package/dist/tokens/tokens-daisyui-base.css +1269 -0
- package/dist/tokens/tokens-desert-rose.css +1320 -0
- package/dist/tokens/tokens-dotorg-site.css +1269 -0
- package/dist/tokens/tokens-forest-canopy.css +1320 -0
- package/dist/tokens/tokens-golden-hour.css +1320 -0
- package/dist/tokens/tokens-harlow-pets.css +1320 -0
- package/dist/tokens/tokens-kehribar.css +1320 -0
- package/dist/tokens/tokens-midnight-galaxy.css +1320 -0
- package/dist/tokens/tokens-modern-minimalist.css +1270 -0
- package/dist/tokens/tokens-ocean-depths.css +1320 -0
- package/dist/tokens/tokens-showcase-base.css +1269 -0
- package/dist/tokens/tokens-smoke-bold.css +1269 -0
- package/dist/tokens/tokens-smoke-friendly.css +1269 -0
- package/dist/tokens/tokens-smoke-minimal.css +1281 -0
- package/dist/tokens/tokens-smoke-premium.css +1280 -0
- package/dist/tokens/tokens-smoke-professional.css +1269 -0
- package/dist/tokens/tokens-smoke-retail.css +1321 -0
- package/dist/tokens/tokens-smoke-startup.css +1269 -0
- package/dist/tokens/tokens-solvlys.css +1320 -0
- package/dist/tokens/tokens-sunset-boulevard.css +1320 -0
- package/dist/tokens/tokens-tech-innovation.css +1320 -0
- package/dist/tokens/tokens-theme-atrium.css +1320 -0
- package/dist/tokens/tokens-theme-catalyst.css +1320 -0
- package/dist/tokens/tokens-theme-circuit.css +1320 -0
- package/dist/tokens/tokens-theme-dispatch.css +1320 -0
- package/dist/tokens/tokens-theme-dither.css +1320 -0
- package/dist/tokens/tokens-theme-ember.css +1320 -0
- package/dist/tokens/tokens-theme-fanfare.css +1320 -0
- package/dist/tokens/tokens-theme-ferro.css +1321 -0
- package/dist/tokens/tokens-theme-folio.css +1320 -0
- package/dist/tokens/tokens-theme-hamara.css +1270 -0
- package/dist/tokens/tokens-theme-komorebi.css +1321 -0
- package/dist/tokens/tokens-theme-kyo.css +1269 -0
- package/dist/tokens/tokens-theme-lattice.css +1320 -0
- package/dist/tokens/tokens-theme-ma.css +1321 -0
- package/dist/tokens/tokens-theme-marquee.css +1320 -0
- package/dist/tokens/tokens-theme-meridian.css +1320 -0
- package/dist/tokens/tokens-theme-nimbus.css +1320 -0
- package/dist/tokens/tokens-theme-plasma.css +1320 -0
- package/dist/tokens/tokens-theme-plinth.css +1320 -0
- package/dist/tokens/tokens-theme-quartz.css +1320 -0
- package/dist/tokens/tokens-theme-sus.css +1320 -0
- package/dist/tokens/tokens-theme-trellis.css +1269 -0
- package/dist/tokens/tokens-theme-vesper.css +1320 -0
- package/dist/tokens/tokens-theme-wabi.css +1320 -0
- package/dist/tools/apply-inferred-theme.js +89 -0
- package/dist/tools/render-gathering.js +88 -0
- package/package.json +5 -2
- package/dist/tools/surface-preview.js +0 -36
package/dist/dev-host.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Dev/verification entry: serves the runsnative MCP server over streamable
|
|
4
|
+
* HTTP so MCP Apps hosts that only speak HTTP (e.g. the ext-apps basic-host
|
|
5
|
+
* reference implementation, claude.ai custom connectors via a tunnel) can
|
|
6
|
+
* connect. The stdio entry (index.ts) remains the production path for local
|
|
7
|
+
* clients; registration is shared via createRunsnativeServer(), so the two
|
|
8
|
+
* transports cannot drift.
|
|
9
|
+
*
|
|
10
|
+
* Sessions: streamable HTTP transports are stateful — one per session, created
|
|
11
|
+
* on each initialize POST and routed by the Mcp-Session-Id header afterwards.
|
|
12
|
+
*
|
|
13
|
+
* node dist/dev-host.js # listens on :3021/mcp
|
|
14
|
+
* MCP_HTTP_PORT=4000 node dist/dev-host.js
|
|
15
|
+
*/
|
|
16
|
+
import { createServer } from 'node:http';
|
|
17
|
+
import { randomUUID } from 'node:crypto';
|
|
18
|
+
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
19
|
+
import { createRunsnativeServer } from './server.js';
|
|
20
|
+
const PORT = parseInt((process.env['MCP_HTTP_PORT'] ?? '3021').trim(), 10);
|
|
21
|
+
const transports = new Map();
|
|
22
|
+
const httpServer = createServer(async (req, res) => {
|
|
23
|
+
// Permissive CORS: this is a local dev harness, not a deployed surface.
|
|
24
|
+
res.setHeader('Access-Control-Allow-Origin', '*');
|
|
25
|
+
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, DELETE, OPTIONS');
|
|
26
|
+
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Accept, Mcp-Session-Id, Last-Event-ID, Mcp-Protocol-Version');
|
|
27
|
+
res.setHeader('Access-Control-Expose-Headers', 'Mcp-Session-Id');
|
|
28
|
+
if (req.method === 'OPTIONS') {
|
|
29
|
+
res.writeHead(204);
|
|
30
|
+
res.end();
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (!req.url?.startsWith('/mcp')) {
|
|
34
|
+
res.writeHead(404, { 'Content-Type': 'text/plain' });
|
|
35
|
+
res.end('MCP endpoint is /mcp');
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
const sessionId = req.headers['mcp-session-id'];
|
|
40
|
+
let transport = sessionId ? transports.get(sessionId) : undefined;
|
|
41
|
+
if (!transport) {
|
|
42
|
+
// New session — only an initialize POST may open one.
|
|
43
|
+
transport = new StreamableHTTPServerTransport({
|
|
44
|
+
sessionIdGenerator: () => randomUUID(),
|
|
45
|
+
onsessioninitialized: (id) => {
|
|
46
|
+
transports.set(id, transport);
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
transport.onclose = () => {
|
|
50
|
+
if (transport.sessionId)
|
|
51
|
+
transports.delete(transport.sessionId);
|
|
52
|
+
};
|
|
53
|
+
const server = await createRunsnativeServer();
|
|
54
|
+
await server.connect(transport);
|
|
55
|
+
}
|
|
56
|
+
await transport.handleRequest(req, res);
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
console.error('[dev-host] request error:', err);
|
|
60
|
+
if (!res.headersSent) {
|
|
61
|
+
res.writeHead(500, { 'Content-Type': 'application/json' });
|
|
62
|
+
res.end(JSON.stringify({ jsonrpc: '2.0', error: { code: -32603, message: 'Internal error' }, id: null }));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
httpServer.listen(PORT, () => {
|
|
67
|
+
console.log(`runsnative MCP server (streamable HTTP, dev) at http://localhost:${PORT}/mcp`);
|
|
68
|
+
});
|