@mcp-native/mcp 0.0.0 → 0.1.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 CHANGED
@@ -1,5 +1,110 @@
1
- # @mcp-native/mcp bootstrap
1
+ <div align="center">
2
2
 
3
- This non-runtime `0.0.0` artifact reserves the package name so npm trusted publishing can be
4
- configured before the first real, provenance-attested release. Install the `latest` distribution
5
- tag for supported package versions.
3
+ # @mcp-native/mcp
4
+
5
+ ### A validated bridge from the official MCP TypeScript SDK to MCP Native
6
+
7
+ [GitHub](https://github.com/pablospaniard/mcp-native) · [Architecture](https://github.com/pablospaniard/mcp-native/blob/main/docs/RFC-0001-architecture.md) · [Protocol support](https://github.com/pablospaniard/mcp-native/blob/main/docs/protocol-support.md) · [Standards status](https://github.com/pablospaniard/mcp-native/blob/main/docs/standards-compatibility.md) · [Official SDK](https://github.com/modelcontextprotocol/typescript-sdk) · [Security](https://github.com/pablospaniard/mcp-native/blob/main/SECURITY.md)
8
+
9
+ </div>
10
+
11
+ > **Experimental:** this package is an early proof of concept. Its public API may change before `1.0.0`.
12
+
13
+ > **Compatibility:** SDK v2 is the correct implementation line for MCP `2026-07-28`. The initial tool/resource boundary preserves official fields and is covered through the SDK's current HTTP handler/fetch path, but the package does not yet claim complete MCP conformance.
14
+
15
+ `@mcp-native/mcp` adapts a connected [`Client`](https://github.com/modelcontextprotocol/typescript-sdk/blob/main/docs/client.md) from `@modelcontextprotocol/client` v2 to the transport-neutral `McpClient` interface in `@mcp-native/core`.
16
+
17
+ The adapter deliberately does not create a transport, manage credentials, or own the SDK client's lifecycle. The host chooses and connects the official client, then hands it to MCP Native.
18
+
19
+ ## Install
20
+
21
+ ```bash
22
+ npm install @mcp-native/mcp @mcp-native/core @modelcontextprotocol/client
23
+ ```
24
+
25
+ The package is ESM-only and includes TypeScript declarations.
26
+
27
+ ## Quick start
28
+
29
+ ```ts
30
+ import { Client } from "@modelcontextprotocol/client";
31
+ import { StdioClientTransport } from "@modelcontextprotocol/client/stdio";
32
+ import { McpNativeRuntime } from "@mcp-native/core";
33
+ import { createMcpNativeClientOptions, McpSdkClientAdapter } from "@mcp-native/mcp";
34
+
35
+ const client = new Client(
36
+ { name: "my-native-host", version: "1.0.0" },
37
+ createMcpNativeClientOptions("auto"),
38
+ );
39
+ const transport = new StdioClientTransport({
40
+ command: "node",
41
+ args: ["./dist/server.js"],
42
+ });
43
+
44
+ await client.connect(transport);
45
+
46
+ const runtime = new McpNativeRuntime(new McpSdkClientAdapter(client));
47
+
48
+ const { tools } = await runtime.listTools();
49
+ const result = await runtime.callTool(tools[0]!.name, {});
50
+ const resources = await runtime.readResource("ui://example");
51
+
52
+ await client.close();
53
+ ```
54
+
55
+ Use `createMcpSdkClientAdapter(client)` when a factory reads better than constructing the class directly.
56
+
57
+ The options helper deliberately offers only the current `2026-07-28` target and tested `2025-11-25` fallback. Use `"modern-only"` to pin the current revision without fallback or `"legacy-only"` for a server known to implement the tested legacy revision.
58
+
59
+ ## Mapping
60
+
61
+ | Official SDK operation | MCP Native result |
62
+ | -------------------------------------- | --------------------------------------------------------------------------- |
63
+ | `client.listTools()` | `McpListToolsResult` with definitions, `_meta`, pagination, and cache hints |
64
+ | `client.callTool({ name, arguments })` | `McpToolCallResult` with official content shapes and result `_meta` |
65
+ | `client.readResource({ uri })` | `McpReadResourceResult` preserving content, `_meta`, and cache hints |
66
+
67
+ SDK content blocks retain MCP's official discriminated shapes: text, image, audio, resource link, and embedded resource. Tool definitions preserve titles, icons, complete input/output schemas, annotations, and JSON-safe `_meta`. Resource reads preserve text and blob items as separate entries.
68
+
69
+ Install `@mcp-native/a2ui` to resolve an `application/a2ui+json` `resource_link` from an adapted tool result into a validated declarative surface.
70
+
71
+ ## Validation boundary
72
+
73
+ Although the official SDK validates protocol traffic, MCP Native validates values again before they cross into renderer-facing contracts. `McpSdkAdapterError` is thrown for:
74
+
75
+ - malformed result objects or collections;
76
+ - unknown content types and non-string names, URIs, MIME types, or bodies;
77
+ - malformed icons, annotations, schemas, cache hints, or result metadata;
78
+ - task execution declarations, because task-augmented calls are outside the current adapter boundary;
79
+ - `undefined`, functions, symbols, bigints, or non-finite numbers inside JSON data;
80
+ - class instances, circular objects, circular arrays, and sparse arrays;
81
+ - prototype-named JSON keys are preserved as ordinary own data properties without changing object prototypes;
82
+ - resource entries with neither body or with both `text` and `blob`.
83
+
84
+ This adapter never evaluates server-provided code and never resolves a server-provided component name.
85
+
86
+ ## Public API
87
+
88
+ | Export | Purpose |
89
+ | ---------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
90
+ | `McpSdkClientAdapter` | Implements the core `McpClient` boundary for a connected SDK client. |
91
+ | `createMcpSdkClientAdapter` | Factory returning an adapter for a connected SDK client. |
92
+ | `McpSdkAdapterError` | Specific validation error for results that cannot safely map. |
93
+ | `createMcpNativeClientOptions`, `McpNativeProtocolMode` | Exact official SDK options for automatic, modern-only, or legacy-only operation. |
94
+ | `MCP_NATIVE_PROTOCOL_REVISION`, `MCP_NATIVE_LEGACY_PROTOCOL_REVISION`, `MCP_NATIVE_SUPPORTED_PROTOCOL_REVISIONS` | The current target and deliberately tested revision list. |
95
+
96
+ ## Scope
97
+
98
+ - Official SDK client v2 integration only.
99
+ - Integration tests pin `2026-07-28` through the official SDK HTTP handler/fetch path and verify `auto` fallback to exactly `2025-11-25` through the linked in-memory transport.
100
+ - Seven applicable official client scenarios cover tool calls, request metadata and version retry, standard and custom HTTP headers, invalid header annotations, safe `$ref` handling, and JSON Schema 2020-12 preservation. See the [pinned coverage report](https://github.com/pablospaniard/mcp-native/blob/main/docs/mcp-conformance.md).
101
+ - The conformance gate accounts for every scored client requirement in the pinned official fixture, while shared-store tests verify that private cache entries stay principal-partitioned and public entries are reused only for the same server identity and request.
102
+ - Connection setup, transport selection, authentication, retries, and shutdown remain host responsibilities.
103
+ - Prompts, roots, subscriptions, sampling, elicitation, and task APIs are outside RFC-0001's initial client boundary.
104
+ - Generic JSON-safe `_meta` is preserved, including MCP Apps discovery and resource policy data, but Apps-specific validation and capability negotiation are not implemented yet.
105
+ - Extension discovery/settings and conformance coverage for operations outside the current boundary remain roadmap work.
106
+ - The adapter package remains independent of React Native, A2UI, and WebView packages.
107
+
108
+ ## License
109
+
110
+ [MIT](https://github.com/pablospaniard/mcp-native/blob/main/LICENSE)
@@ -0,0 +1 @@
1
+ {"version":"7.0.2","root":[146],"packageJsons":["../../../node_modules/@modelcontextprotocol/client/package.json","../../../node_modules/@modelcontextprotocol/core/package.json","../../../node_modules/eventsource/package.json","../../../node_modules/zod/package.json","../../../node_modules/zod/v4/classic/package.json","../../../node_modules/zod/v4/core/package.json","../../../node_modules/zod/v4/locales/package.json","../../../node_modules/zod/v4/package.json","../../core/package.json","../package.json"],"missingPackageJsons":["../../../node_modules/@modelcontextprotocol/client/dist/package.json","../../../node_modules/@modelcontextprotocol/core/dist/package.json","../../../node_modules/@modelcontextprotocol/core/internal/package.json","../../../node_modules/eventsource/dist/package.json"],"fileNames":["lib.es5.d.ts","lib.es2015.d.ts","lib.es2016.d.ts","lib.es2017.d.ts","lib.es2018.d.ts","lib.es2019.d.ts","lib.es2020.d.ts","lib.es2021.d.ts","lib.es2022.d.ts","lib.es2015.core.d.ts","lib.es2015.collection.d.ts","lib.es2015.generator.d.ts","lib.es2015.iterable.d.ts","lib.es2015.promise.d.ts","lib.es2015.proxy.d.ts","lib.es2015.reflect.d.ts","lib.es2015.symbol.d.ts","lib.es2015.symbol.wellknown.d.ts","lib.es2016.array.include.d.ts","lib.es2016.intl.d.ts","lib.es2017.arraybuffer.d.ts","lib.es2017.date.d.ts","lib.es2017.object.d.ts","lib.es2017.sharedmemory.d.ts","lib.es2017.string.d.ts","lib.es2017.intl.d.ts","lib.es2017.typedarrays.d.ts","lib.es2018.asyncgenerator.d.ts","lib.es2018.asynciterable.d.ts","lib.es2018.intl.d.ts","lib.es2018.promise.d.ts","lib.es2018.regexp.d.ts","lib.es2019.array.d.ts","lib.es2019.object.d.ts","lib.es2019.string.d.ts","lib.es2019.symbol.d.ts","lib.es2019.intl.d.ts","lib.es2020.bigint.d.ts","lib.es2020.date.d.ts","lib.es2020.promise.d.ts","lib.es2020.sharedmemory.d.ts","lib.es2020.string.d.ts","lib.es2020.symbol.wellknown.d.ts","lib.es2020.intl.d.ts","lib.es2020.number.d.ts","lib.es2021.promise.d.ts","lib.es2021.string.d.ts","lib.es2021.weakref.d.ts","lib.es2021.intl.d.ts","lib.es2022.array.d.ts","lib.es2022.error.d.ts","lib.es2022.intl.d.ts","lib.es2022.object.d.ts","lib.es2022.string.d.ts","lib.es2022.regexp.d.ts","lib.decorators.d.ts","lib.decorators.legacy.d.ts","../../../node_modules/zod/v4/core/json-schema.d.cts","../../../node_modules/zod/v4/core/standard-schema.d.cts","../../../node_modules/zod/v4/core/registries.d.cts","../../../node_modules/zod/v4/core/to-json-schema.d.cts","../../../node_modules/zod/v4/core/util.d.cts","../../../node_modules/zod/v4/core/versions.d.cts","../../../node_modules/zod/v4/core/schemas.d.cts","../../../node_modules/zod/v4/core/checks.d.cts","../../../node_modules/zod/v4/core/errors.d.cts","../../../node_modules/zod/v4/core/core.d.cts","../../../node_modules/zod/v4/core/parse.d.cts","../../../node_modules/zod/v4/core/regexes.d.cts","../../../node_modules/zod/v4/locales/ar.d.cts","../../../node_modules/zod/v4/locales/az.d.cts","../../../node_modules/zod/v4/locales/be.d.cts","../../../node_modules/zod/v4/locales/bg.d.cts","../../../node_modules/zod/v4/locales/ca.d.cts","../../../node_modules/zod/v4/locales/cs.d.cts","../../../node_modules/zod/v4/locales/da.d.cts","../../../node_modules/zod/v4/locales/de.d.cts","../../../node_modules/zod/v4/locales/el.d.cts","../../../node_modules/zod/v4/locales/en.d.cts","../../../node_modules/zod/v4/locales/eo.d.cts","../../../node_modules/zod/v4/locales/es.d.cts","../../../node_modules/zod/v4/locales/fa.d.cts","../../../node_modules/zod/v4/locales/fi.d.cts","../../../node_modules/zod/v4/locales/fr.d.cts","../../../node_modules/zod/v4/locales/fr-CA.d.cts","../../../node_modules/zod/v4/locales/he.d.cts","../../../node_modules/zod/v4/locales/hr.d.cts","../../../node_modules/zod/v4/locales/hu.d.cts","../../../node_modules/zod/v4/locales/hy.d.cts","../../../node_modules/zod/v4/locales/id.d.cts","../../../node_modules/zod/v4/locales/is.d.cts","../../../node_modules/zod/v4/locales/it.d.cts","../../../node_modules/zod/v4/locales/ja.d.cts","../../../node_modules/zod/v4/locales/ka.d.cts","../../../node_modules/zod/v4/locales/kh.d.cts","../../../node_modules/zod/v4/locales/km.d.cts","../../../node_modules/zod/v4/locales/ko.d.cts","../../../node_modules/zod/v4/locales/lt.d.cts","../../../node_modules/zod/v4/locales/mk.d.cts","../../../node_modules/zod/v4/locales/ms.d.cts","../../../node_modules/zod/v4/locales/nl.d.cts","../../../node_modules/zod/v4/locales/no.d.cts","../../../node_modules/zod/v4/locales/ota.d.cts","../../../node_modules/zod/v4/locales/ps.d.cts","../../../node_modules/zod/v4/locales/pl.d.cts","../../../node_modules/zod/v4/locales/pt.d.cts","../../../node_modules/zod/v4/locales/ro.d.cts","../../../node_modules/zod/v4/locales/ru.d.cts","../../../node_modules/zod/v4/locales/sl.d.cts","../../../node_modules/zod/v4/locales/sv.d.cts","../../../node_modules/zod/v4/locales/ta.d.cts","../../../node_modules/zod/v4/locales/th.d.cts","../../../node_modules/zod/v4/locales/tr.d.cts","../../../node_modules/zod/v4/locales/ua.d.cts","../../../node_modules/zod/v4/locales/uk.d.cts","../../../node_modules/zod/v4/locales/ur.d.cts","../../../node_modules/zod/v4/locales/uz.d.cts","../../../node_modules/zod/v4/locales/vi.d.cts","../../../node_modules/zod/v4/locales/zh-CN.d.cts","../../../node_modules/zod/v4/locales/zh-TW.d.cts","../../../node_modules/zod/v4/locales/yo.d.cts","../../../node_modules/zod/v4/locales/index.d.cts","../../../node_modules/zod/v4/core/doc.d.cts","../../../node_modules/zod/v4/core/api.d.cts","../../../node_modules/zod/v4/core/json-schema-processors.d.cts","../../../node_modules/zod/v4/core/json-schema-generator.d.cts","../../../node_modules/zod/v4/core/index.d.cts","../../../node_modules/zod/v4/classic/errors.d.cts","../../../node_modules/zod/v4/classic/parse.d.cts","../../../node_modules/zod/v4/classic/schemas.d.cts","../../../node_modules/zod/v4/classic/checks.d.cts","../../../node_modules/zod/v4/classic/compat.d.cts","../../../node_modules/zod/v4/classic/from-json-schema.d.cts","../../../node_modules/zod/v4/classic/iso.d.cts","../../../node_modules/zod/v4/classic/coerce.d.cts","../../../node_modules/zod/v4/classic/external.d.cts","../../../node_modules/zod/v4/classic/index.d.cts","../../../node_modules/zod/v4/index.d.cts","../../../node_modules/@modelcontextprotocol/core/dist/auth-BWdKR39I.d.mts","../../../node_modules/@modelcontextprotocol/core/dist/internal.d.mts","../../../node_modules/@modelcontextprotocol/client/dist/index-D4xIIEF6.d.mts","../../../node_modules/@modelcontextprotocol/client/dist/types-mS0yxCL0.d.mts","../../../node_modules/eventsource/dist/index.d.ts","../../../node_modules/@modelcontextprotocol/client/dist/index.d.mts","../../core/dist/index.d.ts","../src/index.ts"],"fileInfos":[{"version":"16934abaab7026ac114da441aabea1a0","affectsGlobalScope":true,"impliedNodeFormat":1},"d4306fb2e47f74835e8674ffac07d76f","e437c5c1302869326c3bb93da85bbbcf","e4324975a566567b21d350615f1fc6ac","333b1b9a2a9ac3b8497dba5c63b5ba50","6cffacd662b6eb5fa7a36aa2ea366bfa","b4c34f9c23304dbef2d23698637ed638","e5cb86a5fc491796ecd1d2dd348d208f","feb6c6fb19cdb246a5d8acb36a6901c7",{"version":"926204c28cd3d073865348473ae28d2e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"f25e42c801b2cb3cf2b39792006a9beb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6344b55f26a4e81d9608777dbfb877dd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3c0ed28e53d3695b363e256ec1c023fd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4c2761daba7f17141c25baa0821ac5da","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b87656acabd63e69379ff6ffcfe52fc7","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"597469522da047a5af5222cc6989f405","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1708ea4d34dc37fadadc63ca01127e80","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"55d97a8c6fbf34a30450a7b1e5f7a298","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0ee05eb59426d33e374226d8dcfa708b","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"e347c14030993906efcfbb88915b6a05","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b0231263857c9b6a03641acdc9280ceb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3b15c4a83b598cacb4067676e6f0abed","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b417d97b7934cef63b1889abec0bbfbf","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"09a6cf4032ebba60ce22a501e663f881","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2b056277dd138e8f5650fc04e20eaa8d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"e22cc07e3f3cc242ba52fa3f8ea1fc58","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2c45da767a1bfbb220848df1bc4029e4","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b44c3e0fbaf2130cdcf6ac38b120ffa1","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b612fb5cf8e5d964b92063a75207632a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"02705151a5e1551b9162a9ed8ab763f7","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"41025e398be9215d32e4337335da8f0b","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"52684c2b1f353a5538e4f275182a54cd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6dedb6a4f90d1df3a6fbe5693e44886c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ca3f36fe3562c07e0f0d71c2bebd3f6d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"409974d6129befbb8226ddd1c6558568","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4d9cfde2a1ae1b4925f1f9bc10848e5d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"7e1daecc66dd564144e3bb1a0266b5fd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a8e1d9bb35fd0637f2f9fd2b2a54f2ec","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4f168501772a6543182765bfd5f2fbfe","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a19c80aad1b2162103496f5ba293a732","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b69afa63cd5d059851c78adb2856ee09","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ae2fc5d954e9b0f5feee3d481b953c27","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1cfd3091a071d8b6feec15277643bafe","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1da2c1f258970fd3cc91184f69e91a9d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a0d87491913d843139e0c993650a3235","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4ef72aa378127e7b7abba915b0110b1e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3ec74c6a7d4463f0254db3a74cf75646","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"84c2bdfa470d075526cce6322d81b0b6","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0b3844c2b8c73e4e1ab91431411cad11","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4fc71cf4a15b8d99675a31df77f26e07","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d1b49564ddaeca3df5b6dbae925d2242","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6a25be566d60ccfc2d6e8b7bfdeefa83","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8a20e27646985dfd58c57ca6566553dd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"9969f02ad3cdcbf4f709405cda44167f","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"9c9be4792a7a4f42c15ae7360bf28779","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"f64453cbf9671f28158677fa5c43967a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"33f317af5428801f944a478d2c1e38e5","affectsGlobalScope":true,"impliedNodeFormat":1},"5f3c015bce4302b247acedb9ec20e302","a9fe29dcdd4288cacf574947747a4572","daada721cfdc43aa8e7c2e2d14d760de","c4d7f2ab9358166b1815281a9e767232","7703400f3e9d14c1e0670e37a530daf7","4158e698aebfc1ac453549ca68cf2301","15182d7d355f2cb580529a728a1c2149","8fb36d5345606a6ec0bcaae424f48c41","631ac96cecb09bd46857ff6ad032a8dc","ffd8c3d2e39447925561777d1ebcdc02","2b76267afeb2e83dff758e3fba2faa8a","c910e5cd97770188797f8ff632e19735","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","224881373d4d18c065b09acb9a85cc5f","a21f1b172546b6a64cc7ddea394b54ea","7096aabc39a3b833dbdb0dee5ef12fca","8bdf05c98551836db89f23d60d176f56","5b3f18777c97e7ed444a39661c4462ba","cd3b63580b271a0e93649c0d92a1b098","1cc59f020b9d62d875bdb28a6e2f745b","a06c5977df8ff3f289f16a7505c8d539","8dd06ad8dc54dd7826195cfa6bfdc744","f04158c558df8c51d46a1fb44c832c1c","d1ab6402ad42100de1cf3f5d15aa9d27","96b06af537c71de0a80e9ed880958afd","dec40354e62d8ca81f5996c1760bc6da","a9356de7c324c6f49c15587032b1f65f","c3c6b4257e011eff227a8970bed8b3c3","f06e385eca707a7f458b12579fac7033","36e44d66b242e6176176dc6d1ee825ea",{"version":"69930d0b6495700237df397f041faf23","impliedNodeFormat":99},{"version":"6ff86dd202b3ccfbb32f63c84814220b","impliedNodeFormat":99},{"version":"641d6bec26f68f2cc37241d68370d42f","impliedNodeFormat":99},{"version":"cecbf8f1c2d5688b5f3713f381fc31c2","impliedNodeFormat":99},{"version":"5668cf0192f00795267d9353c0ff2091","impliedNodeFormat":99},{"version":"2a16e7c752e73d66f3f28be3d4d77a84","impliedNodeFormat":99},{"version":"8a6b7c2bfa89e153bcc965e2c7a0b60f","impliedNodeFormat":99},{"version":"729a7b3283bfd4f70f94b6e7d0f8c012","signature":"2a5fab81e3a8fc6c52e1b41ea549d1c2","impliedNodeFormat":99}],"fileIdsList":[[138,140],[141,142,143],[138],[139],[127],[127,130],[62,122,125,127,128,129,130,131,132,133,134,135],[58,60,130],[136],[127,128],[59,127,129],[60,62,64,65,66,67],[62,64,66,67],[62,64,66],[59,62,64,65,67],[58,60,61,62,63,64,65,66,67,68,69,122,123,124,125,126],[58,60,61,64],[60,61,64],[64,67],[58,59,61,62,63,65,66,67],[58,59,60,64,127],[64,65,66,67],[137],[66],[70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121],[144,145]],"options":{"composite":true,"declaration":true,"declarationMap":true,"exactOptionalPropertyTypes":true,"module":199,"noFallthroughCasesInSwitch":true,"noUncheckedIndexedAccess":true,"noImplicitOverride":true,"outDir":"./","rootDir":"../src","skipLibCheck":true,"strict":true,"sourceMap":true,"target":9,"tsBuildInfoFile":"./.tsbuildinfo"},"referencedMap":[[141,1],[144,2],[139,3],[140,4],[131,5],[135,6],[132,6],[128,5],[136,7],[133,8],[137,9],[134,6],[129,10],[130,11],[124,12],[65,13],[67,14],[66,15],[127,16],[126,17],[125,18],[68,13],[60,19],[64,20],[61,21],[62,22],[138,23],[70,24],[71,24],[72,24],[73,24],[74,24],[75,24],[76,24],[77,24],[78,24],[79,24],[80,24],[81,24],[82,24],[83,24],[85,24],[84,24],[86,24],[87,24],[88,24],[89,24],[90,24],[122,25],[91,24],[92,24],[93,24],[94,24],[95,24],[96,24],[97,24],[98,24],[99,24],[100,24],[101,24],[102,24],[103,24],[105,24],[104,24],[106,24],[107,24],[108,24],[109,24],[110,24],[111,24],[112,24],[113,24],[114,24],[115,24],[116,24],[117,24],[118,24],[121,24],[119,24],[120,24],[146,26]],"latestChangedDtsFile":"./index.d.ts"}
@@ -0,0 +1,33 @@
1
+ import type { Client, ClientOptions } from "@modelcontextprotocol/client";
2
+ import type { JsonObject, McpClient, McpListToolsResult, McpReadResourceResult, McpToolCallResult } from "@mcp-native/core";
3
+ type OfficialMcpClient = Pick<Client, "callTool" | "listTools" | "readResource">;
4
+ /** The exact MCP core revision targeted by MCP Native's modern compatibility lane. */
5
+ export declare const MCP_NATIVE_PROTOCOL_REVISION: "2026-07-28";
6
+ /** The only pre-2026 revision covered by MCP Native's compatibility tests. */
7
+ export declare const MCP_NATIVE_LEGACY_PROTOCOL_REVISION: "2025-11-25";
8
+ /** Exact revisions MCP Native deliberately offers; no future revision is implied. */
9
+ export declare const MCP_NATIVE_SUPPORTED_PROTOCOL_REVISIONS: readonly ["2026-07-28", "2025-11-25"];
10
+ export type McpNativeProtocolMode = "auto" | "legacy-only" | "modern-only";
11
+ /**
12
+ * Creates official SDK client options matching MCP Native's documented
13
+ * protocol policy. The host still owns client construction and connection.
14
+ */
15
+ export declare function createMcpNativeClientOptions(mode?: McpNativeProtocolMode): ClientOptions;
16
+ /** Thrown when an SDK result cannot be represented by MCP Native's JSON-safe contracts. */
17
+ export declare class McpSdkAdapterError extends Error {
18
+ constructor(message: string, options?: ErrorOptions);
19
+ }
20
+ /**
21
+ * Adapts a connected official MCP TypeScript SDK client to the transport-neutral
22
+ * boundary consumed by `@mcp-native/core`.
23
+ */
24
+ export declare class McpSdkClientAdapter implements McpClient {
25
+ #private;
26
+ constructor(client: OfficialMcpClient);
27
+ listTools(): Promise<McpListToolsResult>;
28
+ callTool(name: string, arguments_: JsonObject): Promise<McpToolCallResult>;
29
+ readResource(uri: string): Promise<McpReadResourceResult>;
30
+ }
31
+ export declare function createMcpSdkClientAdapter(client: OfficialMcpClient): McpSdkClientAdapter;
32
+ export {};
33
+ //# sourceMappingURL=index.d.ts.map
@@ -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 @@
1
+ import { parseJsonObject as parseCoreJsonObject, parseJsonValue as parseCoreJsonValue, } from "@mcp-native/core";
2
+ /** The exact MCP core revision targeted by MCP Native's modern compatibility lane. */
3
+ export const MCP_NATIVE_PROTOCOL_REVISION = "2026-07-28";
4
+ /** The only pre-2026 revision covered by MCP Native's compatibility tests. */
5
+ export const MCP_NATIVE_LEGACY_PROTOCOL_REVISION = "2025-11-25";
6
+ /** Exact revisions MCP Native deliberately offers; no future revision is implied. */
7
+ export const MCP_NATIVE_SUPPORTED_PROTOCOL_REVISIONS = Object.freeze([
8
+ MCP_NATIVE_PROTOCOL_REVISION,
9
+ MCP_NATIVE_LEGACY_PROTOCOL_REVISION,
10
+ ]);
11
+ /**
12
+ * Creates official SDK client options matching MCP Native's documented
13
+ * protocol policy. The host still owns client construction and connection.
14
+ */
15
+ export function createMcpNativeClientOptions(mode = "auto") {
16
+ switch (mode) {
17
+ case "auto":
18
+ return {
19
+ supportedProtocolVersions: [...MCP_NATIVE_SUPPORTED_PROTOCOL_REVISIONS],
20
+ versionNegotiation: { mode: "auto" },
21
+ };
22
+ case "modern-only":
23
+ return {
24
+ supportedProtocolVersions: [MCP_NATIVE_PROTOCOL_REVISION],
25
+ versionNegotiation: { mode: { pin: MCP_NATIVE_PROTOCOL_REVISION } },
26
+ };
27
+ case "legacy-only":
28
+ return {
29
+ supportedProtocolVersions: [MCP_NATIVE_LEGACY_PROTOCOL_REVISION],
30
+ versionNegotiation: { mode: "legacy" },
31
+ };
32
+ default:
33
+ throw new TypeError(`Unsupported MCP Native protocol mode: ${String(mode)}`);
34
+ }
35
+ }
36
+ /** Thrown when an SDK result cannot be represented by MCP Native's JSON-safe contracts. */
37
+ export class McpSdkAdapterError extends Error {
38
+ constructor(message, options) {
39
+ super(message, options);
40
+ this.name = "McpSdkAdapterError";
41
+ }
42
+ }
43
+ /**
44
+ * Adapts a connected official MCP TypeScript SDK client to the transport-neutral
45
+ * boundary consumed by `@mcp-native/core`.
46
+ */
47
+ export class McpSdkClientAdapter {
48
+ #client;
49
+ constructor(client) {
50
+ this.#client = client;
51
+ }
52
+ async listTools() {
53
+ const result = expectObject(await this.#client.listTools(), "tools result");
54
+ return {
55
+ tools: expectArray(result.tools, "tools result.tools").map((value, index) => mapTool(value, `tools result.tools[${index}]`)),
56
+ ...mapPagination(result, "tools result"),
57
+ ...mapCacheHints(result, "tools result"),
58
+ ...mapResultMeta(result, "tools result"),
59
+ };
60
+ }
61
+ async callTool(name, arguments_) {
62
+ const result = expectObject(await this.#client.callTool({ name, arguments: arguments_ }), "tool result");
63
+ const isError = optionalBoolean(result.isError, "tool result.isError");
64
+ const structuredContent = result.structuredContent === undefined
65
+ ? undefined
66
+ : expectJsonValue(result.structuredContent, "tool result.structuredContent");
67
+ return {
68
+ content: expectArray(result.content, "tool result.content").map((block, index) => mapContent(block, `tool result.content[${index}]`)),
69
+ ...(isError === undefined ? {} : { isError }),
70
+ ...(structuredContent === undefined ? {} : { structuredContent }),
71
+ ...mapResultMeta(result, "tool result"),
72
+ };
73
+ }
74
+ async readResource(uri) {
75
+ const result = expectObject(await this.#client.readResource({ uri }), "resource result");
76
+ return {
77
+ contents: expectArray(result.contents, "resource result.contents").map((resource, index) => mapResource(resource, `resource result.contents[${index}]`)),
78
+ ...mapCacheHints(result, "resource result"),
79
+ ...mapResultMeta(result, "resource result"),
80
+ };
81
+ }
82
+ }
83
+ export function createMcpSdkClientAdapter(client) {
84
+ return new McpSdkClientAdapter(client);
85
+ }
86
+ function mapContent(value, path) {
87
+ const block = expectObject(value, path);
88
+ const type = expectString(block.type, `${path}.type`);
89
+ const annotations = mapOptionalAnnotations(block.annotations, `${path}.annotations`);
90
+ const meta = optionalMetaObject(block["_meta"], `${path}._meta`);
91
+ const common = {
92
+ ...(annotations === undefined ? {} : { annotations }),
93
+ ...(meta === undefined ? {} : { _meta: meta }),
94
+ };
95
+ switch (type) {
96
+ case "text":
97
+ return { type, text: expectString(block.text, `${path}.text`), ...common };
98
+ case "image":
99
+ case "audio":
100
+ return {
101
+ type,
102
+ data: expectString(block.data, `${path}.data`),
103
+ mimeType: expectString(block.mimeType, `${path}.mimeType`),
104
+ ...common,
105
+ };
106
+ case "resource_link": {
107
+ const icons = mapOptionalIcons(block.icons, `${path}.icons`);
108
+ const title = optionalString(block.title, `${path}.title`);
109
+ const description = optionalString(block.description, `${path}.description`);
110
+ const mimeType = optionalString(block.mimeType, `${path}.mimeType`);
111
+ const size = optionalNonNegativeInteger(block.size, `${path}.size`);
112
+ return {
113
+ type,
114
+ ...(icons === undefined ? {} : { icons }),
115
+ name: expectString(block.name, `${path}.name`),
116
+ ...(title === undefined ? {} : { title }),
117
+ uri: expectString(block.uri, `${path}.uri`),
118
+ ...(description === undefined ? {} : { description }),
119
+ ...(mimeType === undefined ? {} : { mimeType }),
120
+ ...(size === undefined ? {} : { size }),
121
+ ...common,
122
+ };
123
+ }
124
+ case "resource":
125
+ return {
126
+ type,
127
+ resource: mapResource(block.resource, `${path}.resource`),
128
+ ...common,
129
+ };
130
+ default:
131
+ throw new McpSdkAdapterError(`Unsupported MCP content type ${JSON.stringify(type)} at ${path}`);
132
+ }
133
+ }
134
+ function mapResource(value, path) {
135
+ const resource = expectObject(value, path);
136
+ const mimeType = optionalString(resource.mimeType, `${path}.mimeType`);
137
+ const text = optionalString(resource.text, `${path}.text`);
138
+ const blob = optionalString(resource.blob, `${path}.blob`);
139
+ const meta = optionalMetaObject(resource["_meta"], `${path}._meta`);
140
+ if ((text === undefined) === (blob === undefined)) {
141
+ throw new McpSdkAdapterError(`Expected exactly one of text or blob at ${path}`);
142
+ }
143
+ const common = {
144
+ uri: expectString(resource.uri, `${path}.uri`),
145
+ ...(mimeType === undefined ? {} : { mimeType }),
146
+ ...(meta === undefined ? {} : { _meta: meta }),
147
+ };
148
+ return text === undefined ? { ...common, blob: blob } : { ...common, text };
149
+ }
150
+ function mapTool(value, path) {
151
+ const tool = expectObject(value, path);
152
+ if (tool.execution !== undefined) {
153
+ throw new McpSdkAdapterError(`Unsupported tool execution settings at ${path}.execution; task execution is outside the MCP Native boundary`);
154
+ }
155
+ const icons = mapOptionalIcons(tool.icons, `${path}.icons`);
156
+ const title = optionalString(tool.title, `${path}.title`);
157
+ const description = optionalString(tool.description, `${path}.description`);
158
+ const inputSchema = expectJsonObject(tool.inputSchema, `${path}.inputSchema`);
159
+ const outputSchema = optionalJsonObject(tool.outputSchema, `${path}.outputSchema`);
160
+ const annotations = mapOptionalToolAnnotations(tool.annotations, `${path}.annotations`);
161
+ const meta = optionalMetaObject(tool["_meta"], `${path}._meta`);
162
+ if (inputSchema.type !== "object") {
163
+ throw new McpSdkAdapterError(`Expected the string "object" at ${path}.inputSchema.type`);
164
+ }
165
+ return {
166
+ ...(icons === undefined ? {} : { icons }),
167
+ name: expectString(tool.name, `${path}.name`),
168
+ ...(title === undefined ? {} : { title }),
169
+ ...(description === undefined ? {} : { description }),
170
+ inputSchema,
171
+ ...(outputSchema === undefined ? {} : { outputSchema }),
172
+ ...(annotations === undefined ? {} : { annotations }),
173
+ ...(meta === undefined ? {} : { _meta: meta }),
174
+ };
175
+ }
176
+ function mapOptionalAnnotations(value, path) {
177
+ if (value === undefined) {
178
+ return undefined;
179
+ }
180
+ const annotations = expectObject(value, path);
181
+ const audience = mapOptionalAudience(annotations.audience, `${path}.audience`);
182
+ const priority = optionalBoundedNumber(annotations.priority, `${path}.priority`, 0, 1);
183
+ const lastModified = optionalString(annotations.lastModified, `${path}.lastModified`);
184
+ return {
185
+ ...(audience === undefined ? {} : { audience }),
186
+ ...(priority === undefined ? {} : { priority }),
187
+ ...(lastModified === undefined ? {} : { lastModified }),
188
+ };
189
+ }
190
+ function mapOptionalAudience(value, path) {
191
+ if (value === undefined) {
192
+ return undefined;
193
+ }
194
+ return expectArray(value, path).map((role, index) => {
195
+ if (role !== "assistant" && role !== "user") {
196
+ throw new McpSdkAdapterError(`Expected "assistant" or "user" at ${path}[${index}]`);
197
+ }
198
+ return role;
199
+ });
200
+ }
201
+ function mapOptionalIcons(value, path) {
202
+ if (value === undefined) {
203
+ return undefined;
204
+ }
205
+ return expectArray(value, path).map((iconValue, index) => {
206
+ const iconPath = `${path}[${index}]`;
207
+ const icon = expectObject(iconValue, iconPath);
208
+ const mimeType = optionalString(icon.mimeType, `${iconPath}.mimeType`);
209
+ const sizes = optionalStringArray(icon.sizes, `${iconPath}.sizes`);
210
+ const theme = optionalTheme(icon.theme, `${iconPath}.theme`);
211
+ return {
212
+ src: expectString(icon.src, `${iconPath}.src`),
213
+ ...(mimeType === undefined ? {} : { mimeType }),
214
+ ...(sizes === undefined ? {} : { sizes }),
215
+ ...(theme === undefined ? {} : { theme }),
216
+ };
217
+ });
218
+ }
219
+ function mapOptionalToolAnnotations(value, path) {
220
+ if (value === undefined) {
221
+ return undefined;
222
+ }
223
+ const annotations = expectObject(value, path);
224
+ const title = optionalString(annotations.title, `${path}.title`);
225
+ const readOnlyHint = optionalBoolean(annotations.readOnlyHint, `${path}.readOnlyHint`);
226
+ const destructiveHint = optionalBoolean(annotations.destructiveHint, `${path}.destructiveHint`);
227
+ const idempotentHint = optionalBoolean(annotations.idempotentHint, `${path}.idempotentHint`);
228
+ const openWorldHint = optionalBoolean(annotations.openWorldHint, `${path}.openWorldHint`);
229
+ return {
230
+ ...(title === undefined ? {} : { title }),
231
+ ...(readOnlyHint === undefined ? {} : { readOnlyHint }),
232
+ ...(destructiveHint === undefined ? {} : { destructiveHint }),
233
+ ...(idempotentHint === undefined ? {} : { idempotentHint }),
234
+ ...(openWorldHint === undefined ? {} : { openWorldHint }),
235
+ };
236
+ }
237
+ function mapPagination(value, path) {
238
+ const nextCursor = optionalString(value.nextCursor, `${path}.nextCursor`);
239
+ return nextCursor === undefined ? {} : { nextCursor };
240
+ }
241
+ function mapCacheHints(value, path) {
242
+ const ttlMs = optionalNonNegativeInteger(value.ttlMs, `${path}.ttlMs`);
243
+ const cacheScope = optionalCacheScope(value.cacheScope, `${path}.cacheScope`);
244
+ return {
245
+ ...(ttlMs === undefined ? {} : { ttlMs }),
246
+ ...(cacheScope === undefined ? {} : { cacheScope }),
247
+ };
248
+ }
249
+ function mapResultMeta(value, path) {
250
+ const meta = optionalMetaObject(value["_meta"], `${path}._meta`);
251
+ return meta === undefined ? {} : { _meta: meta };
252
+ }
253
+ function expectObject(value, path) {
254
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
255
+ throw new McpSdkAdapterError(`Expected an object at ${path}`);
256
+ }
257
+ const prototype = Object.getPrototypeOf(value);
258
+ if (prototype !== Object.prototype && prototype !== null) {
259
+ throw new McpSdkAdapterError(`Expected a plain object at ${path}`);
260
+ }
261
+ return value;
262
+ }
263
+ function expectArray(value, path) {
264
+ if (!Array.isArray(value)) {
265
+ throw new McpSdkAdapterError(`Expected an array at ${path}`);
266
+ }
267
+ return value;
268
+ }
269
+ function expectString(value, path) {
270
+ if (typeof value !== "string") {
271
+ throw new McpSdkAdapterError(`Expected a string at ${path}`);
272
+ }
273
+ return value;
274
+ }
275
+ function optionalString(value, path) {
276
+ return value === undefined ? undefined : expectString(value, path);
277
+ }
278
+ function optionalBoolean(value, path) {
279
+ if (value === undefined) {
280
+ return undefined;
281
+ }
282
+ if (typeof value !== "boolean") {
283
+ throw new McpSdkAdapterError(`Expected a boolean at ${path}`);
284
+ }
285
+ return value;
286
+ }
287
+ function optionalStringArray(value, path) {
288
+ if (value === undefined) {
289
+ return undefined;
290
+ }
291
+ return expectArray(value, path).map((item, index) => expectString(item, `${path}[${index}]`));
292
+ }
293
+ function optionalTheme(value, path) {
294
+ if (value === undefined) {
295
+ return undefined;
296
+ }
297
+ if (value !== "dark" && value !== "light") {
298
+ throw new McpSdkAdapterError(`Expected "dark" or "light" at ${path}`);
299
+ }
300
+ return value;
301
+ }
302
+ function optionalCacheScope(value, path) {
303
+ if (value === undefined) {
304
+ return undefined;
305
+ }
306
+ if (value !== "private" && value !== "public") {
307
+ throw new McpSdkAdapterError(`Expected "private" or "public" at ${path}`);
308
+ }
309
+ return value;
310
+ }
311
+ function optionalNonNegativeInteger(value, path) {
312
+ if (value === undefined) {
313
+ return undefined;
314
+ }
315
+ if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0) {
316
+ throw new McpSdkAdapterError(`Expected a non-negative safe integer at ${path}`);
317
+ }
318
+ return value;
319
+ }
320
+ function optionalBoundedNumber(value, path, minimum, maximum) {
321
+ if (value === undefined) {
322
+ return undefined;
323
+ }
324
+ if (typeof value !== "number" || !Number.isFinite(value) || value < minimum || value > maximum) {
325
+ throw new McpSdkAdapterError(`Expected a number from ${minimum} to ${maximum} at ${path}`);
326
+ }
327
+ return value;
328
+ }
329
+ function expectJsonObject(value, path) {
330
+ try {
331
+ return parseCoreJsonObject(value, path);
332
+ }
333
+ catch (error) {
334
+ const message = error instanceof Error ? error.message : `Invalid JSON object at ${path}`;
335
+ throw new McpSdkAdapterError(message, { cause: error });
336
+ }
337
+ }
338
+ function optionalJsonObject(value, path) {
339
+ return value === undefined ? undefined : expectJsonObject(value, path);
340
+ }
341
+ function optionalMetaObject(value, path) {
342
+ if (value === undefined) {
343
+ return undefined;
344
+ }
345
+ const meta = expectJsonObject(value, path);
346
+ for (const key of Object.keys(meta)) {
347
+ if (!isValidMetaKey(key)) {
348
+ throw new McpSdkAdapterError(`Invalid MCP metadata key ${JSON.stringify(key)} at ${path}`);
349
+ }
350
+ }
351
+ return meta;
352
+ }
353
+ function isValidMetaKey(key) {
354
+ const slash = key.indexOf("/");
355
+ if (slash !== key.lastIndexOf("/")) {
356
+ return false;
357
+ }
358
+ const prefix = slash === -1 ? undefined : key.slice(0, slash);
359
+ const name = slash === -1 ? key : key.slice(slash + 1);
360
+ const namePattern = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
361
+ if (!namePattern.test(name)) {
362
+ return false;
363
+ }
364
+ if (prefix === undefined) {
365
+ return true;
366
+ }
367
+ const labelPattern = /^[A-Za-z](?:[A-Za-z0-9-]*[A-Za-z0-9])?$/;
368
+ return prefix.length > 0 && prefix.split(".").every((label) => labelPattern.test(label));
369
+ }
370
+ function expectJsonValue(value, path) {
371
+ try {
372
+ return parseCoreJsonValue(value, path);
373
+ }
374
+ catch (error) {
375
+ const message = error instanceof Error ? error.message : `Invalid JSON value at ${path}`;
376
+ throw new McpSdkAdapterError(message, { cause: error });
377
+ }
378
+ }
379
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,IAAI,mBAAmB,EACtC,cAAc,IAAI,kBAAkB,GACrC,MAAM,kBAAkB,CAAC;AAmB1B,sFAAsF;AACtF,MAAM,CAAC,MAAM,4BAA4B,GAAG,YAAqB,CAAC;AAElE,8EAA8E;AAC9E,MAAM,CAAC,MAAM,mCAAmC,GAAG,YAAqB,CAAC;AAEzE,qFAAqF;AACrF,MAAM,CAAC,MAAM,uCAAuC,GAAG,MAAM,CAAC,MAAM,CAAC;IACnE,4BAA4B;IAC5B,mCAAmC;CAC3B,CAAC,CAAC;AAIZ;;;GAGG;AACH,MAAM,UAAU,4BAA4B,CAAC,IAAI,GAA0B,MAAM;IAC/E,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,MAAM;YACT,OAAO;gBACL,yBAAyB,EAAE,CAAC,GAAG,uCAAuC,CAAC;gBACvE,kBAAkB,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;aACrC,CAAC;QACJ,KAAK,aAAa;YAChB,OAAO;gBACL,yBAAyB,EAAE,CAAC,4BAA4B,CAAC;gBACzD,kBAAkB,EAAE,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,4BAA4B,EAAE,EAAE;aACpE,CAAC;QACJ,KAAK,aAAa;YAChB,OAAO;gBACL,yBAAyB,EAAE,CAAC,mCAAmC,CAAC;gBAChE,kBAAkB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;aACvC,CAAC;QACJ;YACE,MAAM,IAAI,SAAS,CAAC,yCAAy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AC;IACD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,YAAY,GAAG,yCAAyC,CAAC;IAC/D,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;AAC3F,CAAC;AAED,SAAS,eAAe,CAAC,KAAc,EAAE,IAAY;IACnD,IAAI,CAAC;QACH,OAAO,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACzC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,yBAAyB,IAAI,EAAE,CAAC;QACzF,MAAM,IAAI,kBAAkB,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IAC1D,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,19 +1,47 @@
1
1
  {
2
2
  "name": "@mcp-native/mcp",
3
- "version": "0.0.0",
4
- "description": "Bootstrap artifact used to establish npm trusted publishing for @mcp-native/mcp.",
3
+ "version": "0.1.0",
4
+ "description": "Official MCP TypeScript SDK adapter for MCP Native.",
5
+ "keywords": [
6
+ "adapter",
7
+ "mcp",
8
+ "model-context-protocol",
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
18
  "url": "git+https://github.com/pablospaniard/mcp-native.git",
9
19
  "directory": "packages/mcp"
10
20
  },
11
- "homepage": "https://github.com/pablospaniard/mcp-native/tree/main/packages/mcp#readme",
12
- "bugs": {
13
- "url": "https://github.com/pablospaniard/mcp-native/issues"
21
+ "files": [
22
+ "dist",
23
+ "README.md"
24
+ ],
25
+ "type": "module",
26
+ "sideEffects": false,
27
+ "main": "./dist/index.js",
28
+ "types": "./dist/index.d.ts",
29
+ "exports": {
30
+ ".": {
31
+ "types": "./dist/index.d.ts",
32
+ "import": "./dist/index.js"
33
+ }
14
34
  },
15
35
  "publishConfig": {
16
- "access": "public",
17
- "tag": "bootstrap"
36
+ "access": "public"
37
+ },
38
+ "dependencies": {
39
+ "@mcp-native/core": "^0.1.0"
40
+ },
41
+ "devDependencies": {
42
+ "@modelcontextprotocol/client": "2.0.0"
43
+ },
44
+ "peerDependencies": {
45
+ "@modelcontextprotocol/client": "^2.0.0"
18
46
  }
19
47
  }