openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
33 lines (32 loc) • 1.07 kB
JavaScript
//#region src/gateway/mcp-http.protocol.ts
/** Server identity advertised by the local MCP loopback initialize response. */
const MCP_LOOPBACK_SERVER_NAME = "openclaw";
/** Protocol-facing loopback server version, independent from the OpenClaw app version. */
const MCP_LOOPBACK_SERVER_VERSION = "0.1.0";
/** MCP protocol versions accepted by the loopback HTTP bridge, newest first for negotiation. */
const MCP_LOOPBACK_SUPPORTED_PROTOCOL_VERSIONS = ["2025-03-26", "2024-11-05"];
/**
* Builds a JSON-RPC success response, using null for notifications or malformed missing ids.
*/
function jsonRpcResult(e, t) {
return {
jsonrpc: "2.0",
id: e ?? null,
result: t
};
}
/**
* Builds a JSON-RPC error response with the same id normalization as success responses.
*/
function jsonRpcError(e, t, n) {
return {
jsonrpc: "2.0",
id: e ?? null,
error: {
code: t,
message: n
}
};
}
//#endregion
export { jsonRpcResult as a, jsonRpcError as i, MCP_LOOPBACK_SERVER_VERSION as n, MCP_LOOPBACK_SUPPORTED_PROTOCOL_VERSIONS as r, MCP_LOOPBACK_SERVER_NAME as t };