@andpipes/mcp-adapter 0.0.0 → 0.0.1

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/index.cjs CHANGED
@@ -48,6 +48,7 @@ __export(index_exports, {
48
48
  jsonRpcError: () => jsonRpcError,
49
49
  jsonRpcResult: () => jsonRpcResult,
50
50
  packageName: () => packageName,
51
+ parseAndpipeConfirmationEvidence: () => parseAndpipeConfirmationEvidence,
51
52
  parseCallToolParams: () => parseCallToolParams,
52
53
  parseJsonRpcRequest: () => parseJsonRpcRequest,
53
54
  splitAndpipeCallArguments: () => splitAndpipeCallArguments,
@@ -209,6 +210,16 @@ var CONFIRMATION_INPUT_SCHEMA = {
209
210
  properties: {
210
211
  confirmation: {
211
212
  oneOf: [
213
+ {
214
+ type: "object",
215
+ additionalProperties: false,
216
+ required: ["version", "kind", "confirmationId"],
217
+ properties: {
218
+ version: { const: 1 },
219
+ kind: { const: "review_reference" },
220
+ confirmationId: { type: "string", format: "uuid" }
221
+ }
222
+ },
212
223
  {
213
224
  type: "object",
214
225
  additionalProperties: false,
@@ -239,9 +250,12 @@ function exactKeys(value, expected) {
239
250
  const canonical = [...expected].sort();
240
251
  return actual.length === canonical.length && actual.every((key, index) => key === canonical[index]);
241
252
  }
242
- function parseConfirmationArgument(raw) {
253
+ function parseAndpipeConfirmationEvidence(raw) {
243
254
  const value = record(raw);
244
255
  if (!value) return null;
256
+ if (exactKeys(value, ["version", "kind", "confirmationId"]) && value.version === 1 && value.kind === "review_reference" && typeof value.confirmationId === "string" && /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value.confirmationId)) {
257
+ return { version: 1, kind: "review_reference", confirmationId: value.confirmationId };
258
+ }
245
259
  if (exactKeys(value, ["confirmationId", "signature"]) && typeof value.confirmationId === "string" && typeof value.signature === "string") {
246
260
  return { confirmationId: value.confirmationId, signature: value.signature };
247
261
  }
@@ -261,7 +275,7 @@ function splitAndpipeCallArguments(input) {
261
275
  "params.arguments._andpipe must contain only a valid confirmation"
262
276
  );
263
277
  }
264
- const confirmation = parseConfirmationArgument(envelope.confirmation);
278
+ const confirmation = parseAndpipeConfirmationEvidence(envelope.confirmation);
265
279
  if (!confirmation) {
266
280
  throw new McpProtocolError(
267
281
  JSON_RPC_INVALID_PARAMS,
@@ -345,6 +359,7 @@ var packageName = "@andpipes/mcp-adapter";
345
359
  jsonRpcError,
346
360
  jsonRpcResult,
347
361
  packageName,
362
+ parseAndpipeConfirmationEvidence,
348
363
  parseCallToolParams,
349
364
  parseJsonRpcRequest,
350
365
  splitAndpipeCallArguments,
package/dist/index.d.cts CHANGED
@@ -152,15 +152,27 @@ interface CallToolResult {
152
152
  declare const ANDPIPE_CALL_ENVELOPE_ARGUMENT: "_andpipe";
153
153
  declare const ANDPIPE_CONFIRMATION_META_KEY: "andpipe.dev/confirmation";
154
154
  declare const ANDPIPE_CONFIRMATION_INPUT_PATH: "_andpipe.confirmation";
155
- interface AndpipeConfirmationEvidence {
155
+ interface AndpipeSignedConfirmationEvidence {
156
+ version?: never;
157
+ kind?: never;
156
158
  confirmationId: string;
157
159
  signature?: string;
158
160
  decision?: "rejected";
159
161
  }
162
+ /** Non-secret pointer. It is never proof of approval; the server must read the saved human decision. */
163
+ interface AndpipeReviewReference {
164
+ version: 1;
165
+ kind: "review_reference";
166
+ confirmationId: string;
167
+ signature?: never;
168
+ decision?: never;
169
+ }
170
+ type AndpipeConfirmationEvidence = AndpipeSignedConfirmationEvidence | AndpipeReviewReference;
160
171
  interface SplitAndpipeCallArgumentsResult {
161
172
  arguments: Record<string, unknown>;
162
173
  confirmation: AndpipeConfirmationEvidence | null;
163
174
  }
175
+ declare function parseAndpipeConfirmationEvidence(raw: unknown): AndpipeConfirmationEvidence | null;
164
176
  /**
165
177
  * Gemini 等が tool arguments として返す `_andpipe.confirmation` を business arguments から分離する。
166
178
  * 予約 field が存在するのに exact shape でない場合は、無視せず JSON-RPC invalid params へ倒す。
@@ -181,4 +193,4 @@ declare function parseCallToolParams(params: unknown): CallToolParams;
181
193
 
182
194
  declare const packageName: "@andpipes/mcp-adapter";
183
195
 
184
- export { ANDPIPE_CALL_ENVELOPE_ARGUMENT, ANDPIPE_CONFIRMATION_INPUT_PATH, ANDPIPE_CONFIRMATION_META_KEY, AP_JSON_RPC_AUTH, AP_JSON_RPC_DOMAIN, AP_JSON_RPC_POLICY, AP_JSON_RPC_SERVER, type AndpipeConfirmationEvidence, type CallToolParams, type CallToolResult, GEMINI_COMPATIBILITY_PROFILES, GEMINI_ENTERPRISE_CLIENT_MARKER, GEMINI_ENTERPRISE_OAUTH_REDIRECT_URI, GEMINI_EXTENSION_GITHUB_TOPIC, GEMINI_EXTENSION_MANIFEST, GEMINI_MCP_SERVER_NAME, GEMINI_SURFACES, type GeminiCompatibilityProfile, type GeminiSurface, type InitializeResult, JSON_RPC_INTERNAL_ERROR, JSON_RPC_INVALID_PARAMS, JSON_RPC_INVALID_REQUEST, JSON_RPC_METHOD_NOT_FOUND, JSON_RPC_PARSE_ERROR, type JsonRpcError, type JsonRpcErrorObject, type JsonRpcId, JsonRpcParseError, type JsonRpcRequest, type JsonRpcResponse, type JsonRpcSuccess, type ListToolsResult, MCP_PROTOCOL_VERSION, type McpErrorShape, McpProtocolError, type McpTextContent, type McpToolAnnotations, type McpToolDescriptor, type SplitAndpipeCallArgumentsResult, apCodeToJsonRpc, geminiCompatibilityProfile, isJsonRpcNotification, jsonRpcError, jsonRpcResult, packageName, parseCallToolParams, parseJsonRpcRequest, splitAndpipeCallArguments, withAndpipeConfirmationInputSchema };
196
+ export { ANDPIPE_CALL_ENVELOPE_ARGUMENT, ANDPIPE_CONFIRMATION_INPUT_PATH, ANDPIPE_CONFIRMATION_META_KEY, AP_JSON_RPC_AUTH, AP_JSON_RPC_DOMAIN, AP_JSON_RPC_POLICY, AP_JSON_RPC_SERVER, type AndpipeConfirmationEvidence, type AndpipeReviewReference, type AndpipeSignedConfirmationEvidence, type CallToolParams, type CallToolResult, GEMINI_COMPATIBILITY_PROFILES, GEMINI_ENTERPRISE_CLIENT_MARKER, GEMINI_ENTERPRISE_OAUTH_REDIRECT_URI, GEMINI_EXTENSION_GITHUB_TOPIC, GEMINI_EXTENSION_MANIFEST, GEMINI_MCP_SERVER_NAME, GEMINI_SURFACES, type GeminiCompatibilityProfile, type GeminiSurface, type InitializeResult, JSON_RPC_INTERNAL_ERROR, JSON_RPC_INVALID_PARAMS, JSON_RPC_INVALID_REQUEST, JSON_RPC_METHOD_NOT_FOUND, JSON_RPC_PARSE_ERROR, type JsonRpcError, type JsonRpcErrorObject, type JsonRpcId, JsonRpcParseError, type JsonRpcRequest, type JsonRpcResponse, type JsonRpcSuccess, type ListToolsResult, MCP_PROTOCOL_VERSION, type McpErrorShape, McpProtocolError, type McpTextContent, type McpToolAnnotations, type McpToolDescriptor, type SplitAndpipeCallArgumentsResult, apCodeToJsonRpc, geminiCompatibilityProfile, isJsonRpcNotification, jsonRpcError, jsonRpcResult, packageName, parseAndpipeConfirmationEvidence, parseCallToolParams, parseJsonRpcRequest, splitAndpipeCallArguments, withAndpipeConfirmationInputSchema };
package/dist/index.d.ts CHANGED
@@ -152,15 +152,27 @@ interface CallToolResult {
152
152
  declare const ANDPIPE_CALL_ENVELOPE_ARGUMENT: "_andpipe";
153
153
  declare const ANDPIPE_CONFIRMATION_META_KEY: "andpipe.dev/confirmation";
154
154
  declare const ANDPIPE_CONFIRMATION_INPUT_PATH: "_andpipe.confirmation";
155
- interface AndpipeConfirmationEvidence {
155
+ interface AndpipeSignedConfirmationEvidence {
156
+ version?: never;
157
+ kind?: never;
156
158
  confirmationId: string;
157
159
  signature?: string;
158
160
  decision?: "rejected";
159
161
  }
162
+ /** Non-secret pointer. It is never proof of approval; the server must read the saved human decision. */
163
+ interface AndpipeReviewReference {
164
+ version: 1;
165
+ kind: "review_reference";
166
+ confirmationId: string;
167
+ signature?: never;
168
+ decision?: never;
169
+ }
170
+ type AndpipeConfirmationEvidence = AndpipeSignedConfirmationEvidence | AndpipeReviewReference;
160
171
  interface SplitAndpipeCallArgumentsResult {
161
172
  arguments: Record<string, unknown>;
162
173
  confirmation: AndpipeConfirmationEvidence | null;
163
174
  }
175
+ declare function parseAndpipeConfirmationEvidence(raw: unknown): AndpipeConfirmationEvidence | null;
164
176
  /**
165
177
  * Gemini 等が tool arguments として返す `_andpipe.confirmation` を business arguments から分離する。
166
178
  * 予約 field が存在するのに exact shape でない場合は、無視せず JSON-RPC invalid params へ倒す。
@@ -181,4 +193,4 @@ declare function parseCallToolParams(params: unknown): CallToolParams;
181
193
 
182
194
  declare const packageName: "@andpipes/mcp-adapter";
183
195
 
184
- export { ANDPIPE_CALL_ENVELOPE_ARGUMENT, ANDPIPE_CONFIRMATION_INPUT_PATH, ANDPIPE_CONFIRMATION_META_KEY, AP_JSON_RPC_AUTH, AP_JSON_RPC_DOMAIN, AP_JSON_RPC_POLICY, AP_JSON_RPC_SERVER, type AndpipeConfirmationEvidence, type CallToolParams, type CallToolResult, GEMINI_COMPATIBILITY_PROFILES, GEMINI_ENTERPRISE_CLIENT_MARKER, GEMINI_ENTERPRISE_OAUTH_REDIRECT_URI, GEMINI_EXTENSION_GITHUB_TOPIC, GEMINI_EXTENSION_MANIFEST, GEMINI_MCP_SERVER_NAME, GEMINI_SURFACES, type GeminiCompatibilityProfile, type GeminiSurface, type InitializeResult, JSON_RPC_INTERNAL_ERROR, JSON_RPC_INVALID_PARAMS, JSON_RPC_INVALID_REQUEST, JSON_RPC_METHOD_NOT_FOUND, JSON_RPC_PARSE_ERROR, type JsonRpcError, type JsonRpcErrorObject, type JsonRpcId, JsonRpcParseError, type JsonRpcRequest, type JsonRpcResponse, type JsonRpcSuccess, type ListToolsResult, MCP_PROTOCOL_VERSION, type McpErrorShape, McpProtocolError, type McpTextContent, type McpToolAnnotations, type McpToolDescriptor, type SplitAndpipeCallArgumentsResult, apCodeToJsonRpc, geminiCompatibilityProfile, isJsonRpcNotification, jsonRpcError, jsonRpcResult, packageName, parseCallToolParams, parseJsonRpcRequest, splitAndpipeCallArguments, withAndpipeConfirmationInputSchema };
196
+ export { ANDPIPE_CALL_ENVELOPE_ARGUMENT, ANDPIPE_CONFIRMATION_INPUT_PATH, ANDPIPE_CONFIRMATION_META_KEY, AP_JSON_RPC_AUTH, AP_JSON_RPC_DOMAIN, AP_JSON_RPC_POLICY, AP_JSON_RPC_SERVER, type AndpipeConfirmationEvidence, type AndpipeReviewReference, type AndpipeSignedConfirmationEvidence, type CallToolParams, type CallToolResult, GEMINI_COMPATIBILITY_PROFILES, GEMINI_ENTERPRISE_CLIENT_MARKER, GEMINI_ENTERPRISE_OAUTH_REDIRECT_URI, GEMINI_EXTENSION_GITHUB_TOPIC, GEMINI_EXTENSION_MANIFEST, GEMINI_MCP_SERVER_NAME, GEMINI_SURFACES, type GeminiCompatibilityProfile, type GeminiSurface, type InitializeResult, JSON_RPC_INTERNAL_ERROR, JSON_RPC_INVALID_PARAMS, JSON_RPC_INVALID_REQUEST, JSON_RPC_METHOD_NOT_FOUND, JSON_RPC_PARSE_ERROR, type JsonRpcError, type JsonRpcErrorObject, type JsonRpcId, JsonRpcParseError, type JsonRpcRequest, type JsonRpcResponse, type JsonRpcSuccess, type ListToolsResult, MCP_PROTOCOL_VERSION, type McpErrorShape, McpProtocolError, type McpTextContent, type McpToolAnnotations, type McpToolDescriptor, type SplitAndpipeCallArgumentsResult, apCodeToJsonRpc, geminiCompatibilityProfile, isJsonRpcNotification, jsonRpcError, jsonRpcResult, packageName, parseAndpipeConfirmationEvidence, parseCallToolParams, parseJsonRpcRequest, splitAndpipeCallArguments, withAndpipeConfirmationInputSchema };
package/dist/index.js CHANGED
@@ -152,6 +152,16 @@ var CONFIRMATION_INPUT_SCHEMA = {
152
152
  properties: {
153
153
  confirmation: {
154
154
  oneOf: [
155
+ {
156
+ type: "object",
157
+ additionalProperties: false,
158
+ required: ["version", "kind", "confirmationId"],
159
+ properties: {
160
+ version: { const: 1 },
161
+ kind: { const: "review_reference" },
162
+ confirmationId: { type: "string", format: "uuid" }
163
+ }
164
+ },
155
165
  {
156
166
  type: "object",
157
167
  additionalProperties: false,
@@ -182,9 +192,12 @@ function exactKeys(value, expected) {
182
192
  const canonical = [...expected].sort();
183
193
  return actual.length === canonical.length && actual.every((key, index) => key === canonical[index]);
184
194
  }
185
- function parseConfirmationArgument(raw) {
195
+ function parseAndpipeConfirmationEvidence(raw) {
186
196
  const value = record(raw);
187
197
  if (!value) return null;
198
+ if (exactKeys(value, ["version", "kind", "confirmationId"]) && value.version === 1 && value.kind === "review_reference" && typeof value.confirmationId === "string" && /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value.confirmationId)) {
199
+ return { version: 1, kind: "review_reference", confirmationId: value.confirmationId };
200
+ }
188
201
  if (exactKeys(value, ["confirmationId", "signature"]) && typeof value.confirmationId === "string" && typeof value.signature === "string") {
189
202
  return { confirmationId: value.confirmationId, signature: value.signature };
190
203
  }
@@ -204,7 +217,7 @@ function splitAndpipeCallArguments(input) {
204
217
  "params.arguments._andpipe must contain only a valid confirmation"
205
218
  );
206
219
  }
207
- const confirmation = parseConfirmationArgument(envelope.confirmation);
220
+ const confirmation = parseAndpipeConfirmationEvidence(envelope.confirmation);
208
221
  if (!confirmation) {
209
222
  throw new McpProtocolError(
210
223
  JSON_RPC_INVALID_PARAMS,
@@ -287,6 +300,7 @@ export {
287
300
  jsonRpcError,
288
301
  jsonRpcResult,
289
302
  packageName,
303
+ parseAndpipeConfirmationEvidence,
290
304
  parseCallToolParams,
291
305
  parseJsonRpcRequest,
292
306
  splitAndpipeCallArguments,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andpipes/mcp-adapter",
3
- "version": "0.0.0",
3
+ "version": "0.0.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",