@wrongstack/mcp 1.0.3 → 1.0.5
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/dist/constants.d.ts +29 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +26 -10
- package/dist/server.d.ts +11 -7
- package/package.json +2 -2
package/dist/constants.d.ts
CHANGED
|
@@ -6,9 +6,36 @@
|
|
|
6
6
|
* - Reconnect parameters can be overridden via config in the future
|
|
7
7
|
* - No scattered magic values across multiple files
|
|
8
8
|
*/
|
|
9
|
+
/**
|
|
10
|
+
* Protocol revisions this package actually implements, newest first.
|
|
11
|
+
*
|
|
12
|
+
* Deliberately conservative: a revision belongs here only once its wire
|
|
13
|
+
* requirements are met, because the version we send in `initialize` is a
|
|
14
|
+
* promise about what the peer may then use. WrongStack speaks the 2024-11-05
|
|
15
|
+
* shape — tools, resources, prompts, sampling — and does not implement the
|
|
16
|
+
* additions of later revisions (elicitation, structured tool output, resource
|
|
17
|
+
* links), so listing one of those would advertise capabilities that are not
|
|
18
|
+
* there.
|
|
19
|
+
*
|
|
20
|
+
* Adding a revision: implement its additions, then put it at the FRONT.
|
|
21
|
+
* `PROTOCOL_VERSION` follows automatically, and the negotiation below starts
|
|
22
|
+
* accepting a peer that asks for it.
|
|
23
|
+
*/
|
|
24
|
+
export declare const SUPPORTED_PROTOCOL_VERSIONS: readonly string[];
|
|
25
|
+
/**
|
|
26
|
+
* Pick the version to answer an `initialize` with.
|
|
27
|
+
*
|
|
28
|
+
* The spec's rule: echo what the peer asked for when it is supported,
|
|
29
|
+
* otherwise reply with our own latest and let the peer decide whether it can
|
|
30
|
+
* continue. Before this existed the server ignored the request entirely and
|
|
31
|
+
* always answered `2024-11-05`, so a peer that asked for a newer revision was
|
|
32
|
+
* told it had been granted nothing of the sort — silently, with no way to see
|
|
33
|
+
* the mismatch.
|
|
34
|
+
*/
|
|
35
|
+
export declare function negotiateProtocolVersion(requested: unknown): string;
|
|
9
36
|
export declare const MCP_CONSTANTS: Readonly<{
|
|
10
|
-
/** MCP protocol version advertised during handshake. */
|
|
11
|
-
readonly PROTOCOL_VERSION:
|
|
37
|
+
/** MCP protocol version advertised during handshake: the newest we implement. */
|
|
38
|
+
readonly PROTOCOL_VERSION: string;
|
|
12
39
|
/** Identity announced to MCP servers during `initialize`. */
|
|
13
40
|
readonly CLIENT_INFO: Readonly<{
|
|
14
41
|
name: "wrongstack";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { authorizationHeaderForToken, authorizationServerMetadataUrls, canonicalMcpResource, createMcpAuthorizationRequest, discoverMcpAuthorization, exchangeMcpAuthorizationCode, type MCPAccessToken, type MCPAuthorizationChallenge, type MCPAuthorizationContext, type MCPAuthorizationDiscoveryOptions, type MCPAuthorizationDiscoveryResult, type MCPAuthorizationJsonFetcher, type MCPAuthorizationProvider, type MCPAuthorizationRequestOptions, type MCPAuthorizationServerMetadata, type MCPAuthorizationSession, type MCPProtectedResourceMetadata, type MCPTokenExchangeOptions, type MCPTokenRefreshOptions, type MCPTokenSet, parseAuthorizationServerMetadata, parseMcpAuthorizationCallback, parseMcpBearerChallenge, parseProtectedResourceMetadata, protectedResourceMetadataUrls, refreshMcpAccessToken, validateMcpAuthorizationServerMetadata, } from './authorization.js';
|
|
2
2
|
export { type MCPAuthorizationCompleteInput, MCPAuthorizationManager, type MCPAuthorizationManagerOptions, type MCPAuthorizationStartInput, type MCPAuthorizationStartResult, type MCPAuthorizationStatus, } from './authorization-manager.js';
|
|
3
3
|
export { MCPClient, type MCPClientOptions, type MCPListChangedListener, type MCPPageOptions, type MCPRequestOptions, type Transport, } from './client.js';
|
|
4
|
-
export { MCP_CONSTANTS } from './constants.js';
|
|
4
|
+
export { MCP_CONSTANTS, negotiateProtocolVersion, SUPPORTED_PROTOCOL_VERSIONS, } from './constants.js';
|
|
5
5
|
export { DEFAULT_MCP_INSERTION_MAX_BYTES, DEFAULT_MCP_RESOURCE_SCHEMES, type MCPContentProvenance, type MCPInsertionPolicy, type MCPPromptInsertion, type MCPResourceInsertion, preparePromptInsertion, prepareResourceInsertion, } from './content-selection.js';
|
|
6
6
|
export type { ConnectionState, JsonRpcResponse, MCPTool, ToolCallResult, } from './contracts.js';
|
|
7
7
|
export { addMcp, disableMcp, discoverMcp, enableMcp, listMcp, MCP_ENV_MASK, type McpManageDeps, type McpOpResult, type McpServerInfo, type McpServerInput, removeMcp, restartMcp, updateMcp, } from './manage.js';
|
package/dist/index.js
CHANGED
|
@@ -875,9 +875,16 @@ function parseEmptyResult(value) {
|
|
|
875
875
|
}
|
|
876
876
|
|
|
877
877
|
// src/constants.ts
|
|
878
|
+
var SUPPORTED_PROTOCOL_VERSIONS = Object.freeze(["2024-11-05"]);
|
|
879
|
+
function negotiateProtocolVersion(requested) {
|
|
880
|
+
if (typeof requested === "string" && SUPPORTED_PROTOCOL_VERSIONS.includes(requested)) {
|
|
881
|
+
return requested;
|
|
882
|
+
}
|
|
883
|
+
return MCP_CONSTANTS.PROTOCOL_VERSION;
|
|
884
|
+
}
|
|
878
885
|
var MCP_CONSTANTS = Object.freeze({
|
|
879
|
-
/** MCP protocol version advertised during handshake. */
|
|
880
|
-
PROTOCOL_VERSION:
|
|
886
|
+
/** MCP protocol version advertised during handshake: the newest we implement. */
|
|
887
|
+
PROTOCOL_VERSION: SUPPORTED_PROTOCOL_VERSIONS[0],
|
|
881
888
|
/** Identity announced to MCP servers during `initialize`. */
|
|
882
889
|
CLIENT_INFO: Object.freeze({
|
|
883
890
|
name: "wrongstack",
|
|
@@ -2464,6 +2471,7 @@ var MCPClient = class _MCPClient {
|
|
|
2464
2471
|
this.disconnectListeners.delete(listener);
|
|
2465
2472
|
}
|
|
2466
2473
|
async connect() {
|
|
2474
|
+
if (this.state === "connected" || this.state === "connecting") return;
|
|
2467
2475
|
this.state = "connecting";
|
|
2468
2476
|
this._serverMetadata = void 0;
|
|
2469
2477
|
try {
|
|
@@ -5029,7 +5037,9 @@ var MCPServer = class {
|
|
|
5029
5037
|
switch (method) {
|
|
5030
5038
|
case "initialize":
|
|
5031
5039
|
return {
|
|
5032
|
-
protocolVersion:
|
|
5040
|
+
protocolVersion: negotiateProtocolVersion(
|
|
5041
|
+
params?.protocolVersion
|
|
5042
|
+
),
|
|
5033
5043
|
capabilities: {
|
|
5034
5044
|
tools: { listChanged: false },
|
|
5035
5045
|
...this.resources.length > 0 ? { resources: { subscribe: false, listChanged: false } } : {},
|
|
@@ -5118,13 +5128,17 @@ var MCPServer = class {
|
|
|
5118
5128
|
* tools are written against the schema they declared.
|
|
5119
5129
|
*
|
|
5120
5130
|
* SCOPE: `validateAgainstSchema` is the shared validator that also gates the
|
|
5121
|
-
* agent's own tool executor. It checks `type`, `enum`,
|
|
5122
|
-
*
|
|
5123
|
-
* `
|
|
5124
|
-
*
|
|
5125
|
-
*
|
|
5126
|
-
*
|
|
5127
|
-
*
|
|
5131
|
+
* agent's own tool executor. It checks `type`, `enum`, `required`, recurses
|
|
5132
|
+
* through `properties`/`items`, enforces numeric bounds
|
|
5133
|
+
* (`minimum`/`maximum`), rejects unknown keys on strict-closed objects
|
|
5134
|
+
* (`additionalProperties: false`), validates the `additionalProperties`
|
|
5135
|
+
* subschema form against unknown-key values, applies `patternProperties`
|
|
5136
|
+
* to matching keys, enforces string lengths (`minLength`/`maxLength`) and
|
|
5137
|
+
* `pattern`, array lengths (`minItems`/`maxItems`/`uniqueItems`), and the
|
|
5138
|
+
* combinators `allOf`/`anyOf`/`oneOf` (all landed 2026-09-11). Still
|
|
5139
|
+
* advisory per the 2026-09-11 usage survey: `const` and `$ref` — declared
|
|
5140
|
+
* only in the techstack rulebook, which validates with its own
|
|
5141
|
+
* `validateRulebook`, not this validator.
|
|
5128
5142
|
*
|
|
5129
5143
|
* Unknown tool names are left alone — the host owns that error, and
|
|
5130
5144
|
* answering "no such tool" here would fork the message for no benefit.
|
|
@@ -5807,6 +5821,7 @@ export {
|
|
|
5807
5821
|
MCP_OPERATION_LIMITS,
|
|
5808
5822
|
SSEReader,
|
|
5809
5823
|
SSETransport,
|
|
5824
|
+
SUPPORTED_PROTOCOL_VERSIONS,
|
|
5810
5825
|
StreamableHTTPTransport,
|
|
5811
5826
|
addMcp,
|
|
5812
5827
|
authorizationHeaderForToken,
|
|
@@ -5821,6 +5836,7 @@ export {
|
|
|
5821
5836
|
exchangeMcpAuthorizationCode,
|
|
5822
5837
|
listMcp,
|
|
5823
5838
|
manifestConfigHash,
|
|
5839
|
+
negotiateProtocolVersion,
|
|
5824
5840
|
parseAuthorizationServerMetadata,
|
|
5825
5841
|
parseGetPromptResult,
|
|
5826
5842
|
parseListPromptsResult,
|
package/dist/server.d.ts
CHANGED
|
@@ -93,13 +93,17 @@ export declare class MCPServer {
|
|
|
93
93
|
* tools are written against the schema they declared.
|
|
94
94
|
*
|
|
95
95
|
* SCOPE: `validateAgainstSchema` is the shared validator that also gates the
|
|
96
|
-
* agent's own tool executor. It checks `type`, `enum`,
|
|
97
|
-
*
|
|
98
|
-
* `
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
96
|
+
* agent's own tool executor. It checks `type`, `enum`, `required`, recurses
|
|
97
|
+
* through `properties`/`items`, enforces numeric bounds
|
|
98
|
+
* (`minimum`/`maximum`), rejects unknown keys on strict-closed objects
|
|
99
|
+
* (`additionalProperties: false`), validates the `additionalProperties`
|
|
100
|
+
* subschema form against unknown-key values, applies `patternProperties`
|
|
101
|
+
* to matching keys, enforces string lengths (`minLength`/`maxLength`) and
|
|
102
|
+
* `pattern`, array lengths (`minItems`/`maxItems`/`uniqueItems`), and the
|
|
103
|
+
* combinators `allOf`/`anyOf`/`oneOf` (all landed 2026-09-11). Still
|
|
104
|
+
* advisory per the 2026-09-11 usage survey: `const` and `$ref` — declared
|
|
105
|
+
* only in the techstack rulebook, which validates with its own
|
|
106
|
+
* `validateRulebook`, not this validator.
|
|
103
107
|
*
|
|
104
108
|
* Unknown tool names are left alone — the host owns that error, and
|
|
105
109
|
* answering "no such tool" here would fork the message for no benefit.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wrongstack/mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "WrongStack Model Context Protocol client and registry: stdio, SSE, and streamable HTTP transports.",
|
|
6
6
|
"repository": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"!dist/**/*.map"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@wrongstack/core": "1.0.
|
|
29
|
+
"@wrongstack/core": "1.0.5",
|
|
30
30
|
"undici": "^8.10.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|