mcp-native 0.0.2 → 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 +109 -1
- package/package.json +17 -6
package/README.md
CHANGED
|
@@ -1,3 +1,111 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
1
3
|
# mcp-native
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
### One entry point for the MCP Native experimental runtime
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/mcp-native)
|
|
8
|
+
[](https://www.npmjs.com/package/mcp-native)
|
|
9
|
+
[](https://github.com/pablospaniard/mcp-native/blob/main/LICENSE)
|
|
10
|
+
[](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)
|
package/package.json
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-native",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
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
|
+
},
|
|
5
16
|
"license": "MIT",
|
|
6
17
|
"repository": {
|
|
7
18
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/pablospaniard/mcp-native.git",
|
|
19
|
+
"url": "git+https://github.com/pablospaniard/mcp-native.git",
|
|
9
20
|
"directory": "packages/mcp-native"
|
|
10
21
|
},
|
|
11
22
|
"files": [
|
|
@@ -26,9 +37,9 @@
|
|
|
26
37
|
"access": "public"
|
|
27
38
|
},
|
|
28
39
|
"dependencies": {
|
|
29
|
-
"@mcp-native/a2ui": "^0.0.
|
|
30
|
-
"@mcp-native/core": "^0.0.
|
|
31
|
-
"@mcp-native/react-native": "^0.0.
|
|
32
|
-
"@mcp-native/webview": "^0.0.
|
|
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"
|
|
33
44
|
}
|
|
34
45
|
}
|