@mcp-native/core 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 +88 -1
- package/package.json +12 -2
package/README.md
CHANGED
|
@@ -1,3 +1,90 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
1
3
|
# @mcp-native/core
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
### Transport-neutral MCP runtime contracts and safe action routing
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@mcp-native/core)
|
|
8
|
+
[](https://www.npmjs.com/package/@mcp-native/core)
|
|
9
|
+
[](https://github.com/pablospaniard/mcp-native/blob/main/LICENSE)
|
|
10
|
+
|
|
11
|
+
[GitHub](https://github.com/pablospaniard/mcp-native) · [Architecture](https://github.com/pablospaniard/mcp-native/blob/main/docs/RFC-0001-architecture.md) · [Security](https://github.com/pablospaniard/mcp-native/blob/main/SECURITY.md)
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
> **Experimental:** this package is an early proof of concept. Its public API may change before `1.0.0`.
|
|
16
|
+
|
|
17
|
+
`@mcp-native/core` is the protocol- and renderer-independent foundation of MCP Native. It defines the small MCP client boundary consumed by the runtime and routes declared actions without depending on A2UI, React Native, WebViews, or a specific MCP SDK transport.
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install @mcp-native/core
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The package is ESM-only and includes TypeScript declarations.
|
|
26
|
+
|
|
27
|
+
## Quick start
|
|
28
|
+
|
|
29
|
+
Adapt any MCP client to the `McpClient` interface, then use `McpNativeRuntime` to coordinate operations:
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { McpNativeRuntime, type McpClient } from "@mcp-native/core";
|
|
33
|
+
|
|
34
|
+
const client: McpClient = {
|
|
35
|
+
async listTools() {
|
|
36
|
+
return [
|
|
37
|
+
{
|
|
38
|
+
name: "save_profile",
|
|
39
|
+
description: "Save profile details",
|
|
40
|
+
inputSchema: { type: "object" },
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
},
|
|
44
|
+
async callTool(name, arguments_) {
|
|
45
|
+
return {
|
|
46
|
+
content: [{ type: "json", data: { name, arguments: arguments_ } }],
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
async readResource(uri) {
|
|
50
|
+
return { uri, mimeType: "text/plain", text: "Hello from MCP" };
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const runtime = new McpNativeRuntime(client);
|
|
55
|
+
|
|
56
|
+
await runtime.dispatch({
|
|
57
|
+
type: "tool",
|
|
58
|
+
name: "save_profile",
|
|
59
|
+
arguments: { displayName: "Ada" },
|
|
60
|
+
});
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Public API
|
|
64
|
+
|
|
65
|
+
| Export | Purpose |
|
|
66
|
+
| --------------------------------------------- | ------------------------------------------------------------------------------------------- |
|
|
67
|
+
| `McpNativeRuntime` | Delegates tool listing, tool calls, resource reads, and declared actions to an `McpClient`. |
|
|
68
|
+
| `McpClient` | Minimal interface implemented by an SDK- or transport-specific adapter. |
|
|
69
|
+
| `McpTool`, `McpResource`, `McpToolCallResult` | Transport-neutral MCP data contracts used by the runtime. |
|
|
70
|
+
| `ToolAction`, `McpNativeAction` | Declarative actions that can be dispatched through the runtime. |
|
|
71
|
+
| `JsonPrimitive`, `JsonValue`, `JsonObject` | JSON-safe value types for untrusted protocol data. |
|
|
72
|
+
|
|
73
|
+
## Design boundaries
|
|
74
|
+
|
|
75
|
+
- No React Native dependency.
|
|
76
|
+
- No A2UI or WebView dependency.
|
|
77
|
+
- No transport or official MCP SDK dependency yet.
|
|
78
|
+
- No remote code loading or execution.
|
|
79
|
+
- Host applications remain responsible for authentication, permissions, transport security, and user approval.
|
|
80
|
+
|
|
81
|
+
## Related packages
|
|
82
|
+
|
|
83
|
+
- [`@mcp-native/a2ui`](https://www.npmjs.com/package/@mcp-native/a2ui) validates declarative surfaces and actions.
|
|
84
|
+
- [`@mcp-native/react-native`](https://www.npmjs.com/package/@mcp-native/react-native) converts validated surfaces into trusted native render plans.
|
|
85
|
+
- [`@mcp-native/webview`](https://www.npmjs.com/package/@mcp-native/webview) defines the HTML compatibility policy boundary.
|
|
86
|
+
- [`mcp-native`](https://www.npmjs.com/package/mcp-native) re-exports the complete public API.
|
|
87
|
+
|
|
88
|
+
## License
|
|
89
|
+
|
|
90
|
+
[MIT](https://github.com/pablospaniard/mcp-native/blob/main/LICENSE)
|
package/package.json
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcp-native/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Protocol-independent runtime primitives for MCP Native.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"mcp",
|
|
7
|
+
"model-context-protocol",
|
|
8
|
+
"runtime",
|
|
9
|
+
"typescript"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://github.com/pablospaniard/mcp-native#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/pablospaniard/mcp-native/issues"
|
|
14
|
+
},
|
|
5
15
|
"license": "MIT",
|
|
6
16
|
"repository": {
|
|
7
17
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/pablospaniard/mcp-native.git",
|
|
18
|
+
"url": "git+https://github.com/pablospaniard/mcp-native.git",
|
|
9
19
|
"directory": "packages/core"
|
|
10
20
|
},
|
|
11
21
|
"files": [
|