mcp-native 0.0.1 → 0.0.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/README.md CHANGED
@@ -1,5 +1,111 @@
1
- # MCP Native
1
+ <div align="center">
2
2
 
3
- Native UI runtime for Model Context Protocol applications.
3
+ # mcp-native
4
4
 
5
- Early development.
5
+ ### One entry point for the MCP Native experimental runtime
6
+
7
+ [![npm](https://img.shields.io/npm/v/mcp-native)](https://www.npmjs.com/package/mcp-native)
8
+ [![downloads](https://img.shields.io/npm/dm/mcp-native)](https://www.npmjs.com/package/mcp-native)
9
+ [![license](https://img.shields.io/npm/l/mcp-native)](https://github.com/pablospaniard/mcp-native/blob/main/LICENSE)
10
+ [![CI](https://github.com/pablospaniard/mcp-native/actions/workflows/ci.yml/badge.svg)](https://github.com/pablospaniard/mcp-native/actions/workflows/ci.yml)
11
+
12
+ [GitHub](https://github.com/pablospaniard/mcp-native) · [Architecture](https://github.com/pablospaniard/mcp-native/blob/main/docs/RFC-0001-architecture.md) · [Contributing](https://github.com/pablospaniard/mcp-native/blob/main/CONTRIBUTING.md) · [Security](https://github.com/pablospaniard/mcp-native/blob/main/SECURITY.md)
13
+
14
+ </div>
15
+
16
+ > **Experimental:** MCP Native is a proof of concept, not a production-ready MCP or React Native runtime. APIs may change before `1.0.0`.
17
+
18
+ `mcp-native` is the convenience package for the complete public API. It re-exports the runtime contracts, declarative surface parser, trusted native render-plan builder, and policy-gated WebView compatibility primitives from the focused `@mcp-native/*` packages.
19
+
20
+ ## Install
21
+
22
+ ```bash
23
+ npm install mcp-native
24
+ ```
25
+
26
+ The package is ESM-only and includes TypeScript declarations.
27
+
28
+ ## End-to-end preview
29
+
30
+ ```ts
31
+ import {
32
+ McpNativeRuntime,
33
+ createNativeRenderPlan,
34
+ parseA2uiSurface,
35
+ type McpClient,
36
+ } from "mcp-native";
37
+
38
+ const client: McpClient = {
39
+ async listTools() {
40
+ return [];
41
+ },
42
+ async callTool(name, arguments_) {
43
+ return {
44
+ content: [{ type: "json", data: { name, arguments: arguments_ } }],
45
+ };
46
+ },
47
+ async readResource(uri) {
48
+ return { uri };
49
+ },
50
+ };
51
+
52
+ const runtime = new McpNativeRuntime(client);
53
+
54
+ const surface = parseA2uiSurface({
55
+ version: "0.1",
56
+ root: {
57
+ id: "welcome",
58
+ type: "container",
59
+ children: [
60
+ { id: "title", type: "text", text: "Hello from MCP" },
61
+ {
62
+ id: "continue",
63
+ type: "button",
64
+ label: "Continue",
65
+ action: { type: "tool", name: "continue_flow" },
66
+ },
67
+ ],
68
+ },
69
+ });
70
+
71
+ const plan = createNativeRenderPlan(surface);
72
+ const button = surface.root.type === "container" ? surface.root.children[1] : undefined;
73
+
74
+ if (button?.type === "button") {
75
+ await runtime.dispatch(button.action);
76
+ }
77
+ ```
78
+
79
+ The host maps the trusted names in `plan` to locally bundled native components. MCP Native never downloads and executes server-provided React Native JavaScript.
80
+
81
+ ## Included packages
82
+
83
+ | Package | What it provides |
84
+ | ------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------- |
85
+ | [`@mcp-native/core`](https://www.npmjs.com/package/@mcp-native/core) | MCP client contracts, runtime delegation, JSON types, and declared tool actions. |
86
+ | [`@mcp-native/a2ui`](https://www.npmjs.com/package/@mcp-native/a2ui) | Strict parsing for the initial declarative surface model. |
87
+ | [`@mcp-native/react-native`](https://www.npmjs.com/package/@mcp-native/react-native) | Serializable render plans with a fixed native component catalog. |
88
+ | [`@mcp-native/webview`](https://www.npmjs.com/package/@mcp-native/webview) | MIME validation and deny-by-default remote HTML policy. |
89
+
90
+ Install an individual package instead when you only need one layer.
91
+
92
+ ## What works today
93
+
94
+ - transport-independent MCP runtime contracts;
95
+ - strict validation for container, text, button, and text-input nodes;
96
+ - declared tool-action dispatch;
97
+ - trusted render plans for `View`, `Text`, `Button`, and `TextInput`;
98
+ - policy-gated inline and remote HTML document descriptions;
99
+ - ESM exports, TypeScript declarations, automated tests, and signed npm provenance.
100
+
101
+ The project does not yet include an official MCP SDK adapter, mounted React Native components, streaming UI updates, capability negotiation, or a runnable mobile demo. Follow the [roadmap](https://github.com/pablospaniard/mcp-native#roadmap) for progress.
102
+
103
+ ## Security model
104
+
105
+ Remote servers may provide declarative UI and actions, but the host owns component resolution, tool execution, permissions, and every sensitive capability. Unknown data fails closed at validation and policy boundaries.
106
+
107
+ Read the full [architecture](https://github.com/pablospaniard/mcp-native/blob/main/docs/RFC-0001-architecture.md) and [security policy](https://github.com/pablospaniard/mcp-native/blob/main/SECURITY.md) before using or extending the proof of concept.
108
+
109
+ ## License
110
+
111
+ [MIT](https://github.com/pablospaniard/mcp-native/blob/main/LICENSE)
@@ -0,0 +1,5 @@
1
+ export * from "@mcp-native/core";
2
+ export * from "@mcp-native/a2ui";
3
+ export * from "@mcp-native/react-native";
4
+ export * from "@mcp-native/webview";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ export * from "@mcp-native/core";
2
+ export * from "@mcp-native/a2ui";
3
+ export * from "@mcp-native/react-native";
4
+ export * from "@mcp-native/webview";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC"}
package/package.json CHANGED
@@ -1,9 +1,45 @@
1
1
  {
2
2
  "name": "mcp-native",
3
- "version": "0.0.1",
4
- "description": "Native UI runtime for Model Context Protocol applications",
5
- "main": "index.js",
6
- "scripts": {},
7
- "author": "Pavel Ivanov Kuvashev",
8
- "license": "MIT"
3
+ "version": "0.0.3",
4
+ "description": "Convenience package for the MCP Native runtime.",
5
+ "keywords": [
6
+ "a2ui",
7
+ "mcp",
8
+ "model-context-protocol",
9
+ "native-ui",
10
+ "react-native"
11
+ ],
12
+ "homepage": "https://github.com/pablospaniard/mcp-native#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/pablospaniard/mcp-native/issues"
15
+ },
16
+ "license": "MIT",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/pablospaniard/mcp-native.git",
20
+ "directory": "packages/mcp-native"
21
+ },
22
+ "files": [
23
+ "dist",
24
+ "README.md"
25
+ ],
26
+ "type": "module",
27
+ "sideEffects": false,
28
+ "main": "./dist/index.js",
29
+ "types": "./dist/index.d.ts",
30
+ "exports": {
31
+ ".": {
32
+ "types": "./dist/index.d.ts",
33
+ "import": "./dist/index.js"
34
+ }
35
+ },
36
+ "publishConfig": {
37
+ "access": "public"
38
+ },
39
+ "dependencies": {
40
+ "@mcp-native/a2ui": "^0.0.3",
41
+ "@mcp-native/core": "^0.0.3",
42
+ "@mcp-native/react-native": "^0.0.3",
43
+ "@mcp-native/webview": "^0.0.3"
44
+ }
9
45
  }
package/index.js DELETED
@@ -1 +0,0 @@
1
- module.exports = {};