@adeu/mcp-server
Version:
[](https://github.com/dealfluence/adeu) [](https://modelcontextprotocol.io/) [.
*/
export declare const SUPPORTED_PROTOCOL_VERSIONS: readonly ["2026-07-28", "2025-11-25", "2024-11-05"];
export declare const MODERN_PROTOCOL_VERSION = "2026-07-28";
export declare const META_PROTOCOL_VERSION = "io.modelcontextprotocol/protocolVersion";
export declare const META_CLIENT_CAPABILITIES = "io.modelcontextprotocol/clientCapabilities";
export declare const META_CLIENT_INFO = "io.modelcontextprotocol/clientInfo";
export declare const META_LOG_LEVEL = "io.modelcontextprotocol/logLevel";
export declare const META_SERVER_INFO = "io.modelcontextprotocol/serverInfo";
/**
* Spec 2026-07-28 §Error Codes.
* -32020 is HTTP-only (stdio has no headers) and is never emitted here.
* -32021 is reserved for missing client capabilities required by the server.
*/
export declare const MCP_ERROR_CODES: {
readonly INVALID_PARAMS: -32602;
readonly HEADER_MISMATCH: -32020;
readonly MISSING_REQUIRED_CLIENT_CAPABILITY: -32021;
readonly UNSUPPORTED_PROTOCOL_VERSION: -32022;
readonly LEGACY_RESOURCE_NOT_FOUND: -32002;
};
export declare const LOG_LEVELS: readonly ["debug", "info", "notice", "warning", "error", "critical", "alert", "emergency"];
export declare const DEFAULT_TTL_MS = 3600000;
export type CacheScope = "public" | "private";
export declare const CACHE_POLICY: Record<string, {
ttlMs: number;
cacheScope: CacheScope;
}>;
/**
* Mirrors @modelcontextprotocol/ext-apps EXTENSION_ID + RESOURCE_MIME_TYPE.
* Kept as a literal constant to avoid extra transport dependencies in the adapter.
*/
export declare const UI_EXTENSION_CAPABILITY: {
readonly "io.modelcontextprotocol/ui": {
readonly mimeTypes: readonly ["text/html;profile=mcp-app"];
};
};
/**
* Inspects live server capabilities safely using internal server instance or falls back to defaults.
*/
export declare function readServerCapabilities(server: unknown): Record<string, unknown>;
export type AdapterDecision = {
action: "pass";
} | {
action: "respond";
message: Record<string, unknown>;
};
export interface ProtocolAdapterOptions {
/** Returns the live server capabilities; defaults to a static tools+resources set. */
getCapabilities?: () => Record<string, unknown>;
}
/**
* Locale-independent: localeCompare varies by ICU locale, which would make the
* order non-deterministic across machines and defeat SEP-2243 caching.
*/
export declare function sortToolsDeterministically<T extends {
name?: string;
}>(tools: T[]): T[];
/**
* Removes `$schema` dialect declarations from a JSON Schema, recursively.
*
* The MCP SDK converts Zod schemas with a hardcoded `target: 'draft-7'`
* (`mapMiniTarget` in sdk/server/zod-json-schema-compat.js defaults to
* `'draft-7'` whenever no target is passed, and mcp.js never passes one), so
* Zod v4 stamps `$schema: "http://json-schema.org/draft-07/schema#"` onto every
* published tool schema. Claude Desktop validates tool schemas with an Ajv
* instance built for 2020-12 only and rejects the tool outright:
*
* Tool 'read_docx' has an invalid outputSchema: JSON Schema declares an
* unsupported dialect ... supports JSON Schema 2020-12 only
*
* Dropping the declaration (rather than rewriting it to the 2020-12 URI) is
* both spec-legal and lossless here: `$schema` is optional in the MCP tool
* schema contract, clients that omit it default to 2020-12, and the schemas we
* emit use no keyword whose meaning differs between the two drafts (no tuple
* `items`/`additionalItems`, no `definitions`, no `$ref`). It also restores
* byte-parity with the Python engine, which publishes plain dicts with no
* `$schema` at all. A wire-level test asserts that draft-07-only constructs
* stay absent, so this stays true.
*
* Returns a copy; the input is never mutated.
*/
export declare function stripJsonSchemaDialect<T>(schema: T): T;
/** Fallback when the originating request was not observed (adapter attached mid-flight). */
export declare function inferCachePolicy(result: any): {
ttlMs: number;
cacheScope: CacheScope;
} | undefined;
export declare class ProtocolAdapter {
private serverName;
private serverVersion;
private options;
readonly pendingMethods: Map<string | number, string>;
constructor(serverName: string, serverVersion: string, options?: ProtocolAdapterOptions);
get pendingRequestCount(): number;
private errorResponse;
/**
* Transforms an outgoing JSON-RPC result or error response to ensure 2026-07-28 spec compliance.
*/
transformOutgoingMessage(msg: any): any;
/**
* Validates an incoming JSON-RPC request message according to 2026-07-28 spec rules.
* Returns AdapterDecision indicating whether to pass or respond.
*/
validateIncomingRequest(msg: any): AdapterDecision;
buildDiscoverResponse(id: string | number): Record<string, unknown>;
}
/**
* Attaches the ProtocolAdapter to a Transport and McpServer instance.
* MUST be called AFTER server.connect(transport).
*/
export declare function attachProtocolAdapter(server: McpServer, transport: Transport, serverName: string, serverVersion: string): ProtocolAdapter;
//# sourceMappingURL=protocol-adapter.d.ts.map