@mcp-native/core 0.0.1 → 0.0.2
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 +1 -3
- package/dist/index.d.ts +53 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/package.json +24 -8
- package/index.js +0 -1
package/README.md
CHANGED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export type JsonPrimitive = boolean | null | number | string;
|
|
2
|
+
export type JsonValue = JsonPrimitive | JsonObject | readonly JsonValue[];
|
|
3
|
+
export interface JsonObject {
|
|
4
|
+
readonly [key: string]: JsonValue;
|
|
5
|
+
}
|
|
6
|
+
export interface McpTool {
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly description?: string;
|
|
9
|
+
readonly inputSchema: JsonObject;
|
|
10
|
+
}
|
|
11
|
+
export interface McpContent {
|
|
12
|
+
readonly type: string;
|
|
13
|
+
readonly data: JsonObject;
|
|
14
|
+
}
|
|
15
|
+
export interface McpToolCallResult {
|
|
16
|
+
readonly content: readonly McpContent[];
|
|
17
|
+
readonly isError?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface McpResource {
|
|
20
|
+
readonly uri: string;
|
|
21
|
+
readonly mimeType?: string;
|
|
22
|
+
readonly text?: string;
|
|
23
|
+
readonly blob?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The small client boundary consumed by the runtime. SDK-specific clients can
|
|
27
|
+
* implement this interface without coupling the core package to a transport.
|
|
28
|
+
*/
|
|
29
|
+
export interface McpClient {
|
|
30
|
+
listTools(): Promise<readonly McpTool[]>;
|
|
31
|
+
callTool(name: string, arguments_: JsonObject): Promise<McpToolCallResult>;
|
|
32
|
+
readResource(uri: string): Promise<McpResource>;
|
|
33
|
+
}
|
|
34
|
+
export interface ToolAction {
|
|
35
|
+
readonly type: "tool";
|
|
36
|
+
readonly name: string;
|
|
37
|
+
readonly arguments?: JsonObject;
|
|
38
|
+
}
|
|
39
|
+
export type McpNativeAction = ToolAction;
|
|
40
|
+
/**
|
|
41
|
+
* Coordinates MCP operations without knowing about A2UI, React Native, or any
|
|
42
|
+
* other renderer. It deliberately routes declared actions instead of loading
|
|
43
|
+
* executable code from a server.
|
|
44
|
+
*/
|
|
45
|
+
export declare class McpNativeRuntime {
|
|
46
|
+
#private;
|
|
47
|
+
constructor(client: McpClient);
|
|
48
|
+
listTools(): Promise<readonly McpTool[]>;
|
|
49
|
+
callTool(name: string, arguments_?: JsonObject): Promise<McpToolCallResult>;
|
|
50
|
+
readResource(uri: string): Promise<McpResource>;
|
|
51
|
+
dispatch(action: McpNativeAction): Promise<McpToolCallResult>;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;AAE7D,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,UAAU,GAAG,SAAS,SAAS,EAAE,CAAC;AAE1E,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC;AAED,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,WAAW,EAAE,UAAU,CAAC;CAClC;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,CAAC;IACxC,QAAQ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A2UI, React Native, or any
|
|
3
|
+
* other renderer. It deliberately routes declared actions instead of loading
|
|
4
|
+
* executable code from a server.
|
|
5
|
+
*/
|
|
6
|
+
export class McpNativeRuntime {
|
|
7
|
+
#client;
|
|
8
|
+
constructor(client) {
|
|
9
|
+
this.#client = client;
|
|
10
|
+
}
|
|
11
|
+
listTools() {
|
|
12
|
+
return this.#client.listTools();
|
|
13
|
+
}
|
|
14
|
+
callTool(name, arguments_ = {}) {
|
|
15
|
+
return this.#client.callTool(name, arguments_);
|
|
16
|
+
}
|
|
17
|
+
readResource(uri) {
|
|
18
|
+
return this.#client.readResource(uri);
|
|
19
|
+
}
|
|
20
|
+
dispatch(action) {
|
|
21
|
+
return this.callTool(action.name, action.arguments ?? {});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAiDA;;;;GAIG;AACH,MAAM,OAAO,gBAAgB;IAClB,OAAO,CAAY;IAE5B,YAAY,MAAiB;QAC3B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;IAClC,CAAC;IAED,QAAQ,CAAC,IAAY,EAAE,UAAU,GAAe,EAAE;QAChD,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACjD,CAAC;IAED,YAAY,CAAC,GAAW;QACtB,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IACxC,CAAC;IAED,QAAQ,CAAC,MAAuB;QAC9B,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;IAC5D,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcp-native/core",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"scripts": {
|
|
6
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
7
|
-
},
|
|
8
|
-
"keywords": [],
|
|
9
|
-
"author": "",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "Protocol-independent runtime primitives for MCP Native.",
|
|
10
5
|
"license": "MIT",
|
|
11
|
-
"
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/pablospaniard/mcp-native.git",
|
|
9
|
+
"directory": "packages/core"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"README.md"
|
|
14
|
+
],
|
|
15
|
+
"type": "module",
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"main": "./dist/index.js",
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"import": "./dist/index.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
}
|
|
12
28
|
}
|
package/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = {};
|