pub const DEFAULT_MCP_ENDPOINT: &str = "/mcp";
pub const DEFAULT_MCP_PROTOCOL_VERSION: &str = "2025-03-26";
pub const MCP_SESSION_ID_HEADER: &str = "mcp-session-id";
pub const DEFAULT_MCP_MAX_SESSIONS: usize = 1024;
pub const DEFAULT_MCP_MAX_BODY_SIZE: usize = 1024 * 1024;
pub const DEFAULT_MCP_SESSION_TTL_MS: u64 = 1_800_000;
pub(crate) const MCP_SESSION_SHARD_COUNT: usize = 16;
pub(crate) const MCP_SESSION_ID_LEN: usize = MCP_SESSION_PREFIX.len() + 32;
pub(crate) const MCP_HEX_DECODE_LUT: [u8; 256] = {
let mut lut: [u8; 256] = [0xFF; 256];
let mut b: usize = b'0' as usize;
while b <= b'9' as usize {
lut[b] = (b - b'0' as usize) as u8;
b += 1;
}
let mut c: usize = b'a' as usize;
while c <= b'f' as usize {
lut[c] = (c - b'a' as usize + 10) as u8;
c += 1;
}
lut
};
pub(crate) const MCP_DEC_DIGITS_LUT: &[u8; 200] = b"00010203040506070809101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899";
pub(crate) const MCP_WIRE_ENVELOPE_PREFIX: &[u8] = br#"{"jsonrpc":"2.0","id":"#;
pub(crate) const MCP_WIRE_RESULT_SEP: &[u8] = br#","result":"#;
pub(crate) const MCP_WIRE_PING_SUFFIX: &[u8] = br#","result":{}}"#;
pub(crate) const MCP_WIRE_ERROR_CODE_SEP: &[u8] = br#","error":{"code":"#;
pub(crate) const MCP_WIRE_ERROR_MSG_SEP: &[u8] = br#","message":"#;
pub(crate) const MCP_WIRE_ERROR_SUFFIX: &[u8] = b"}}";
pub(crate) const MCP_WIRE_INIT_PROTO: &[u8] = br#"{"protocolVersion":"#;
pub(crate) const MCP_WIRE_INIT_CAPS_NAME: &[u8] = br#","capabilities":{"tools":{"listChanged":false},"resources":{"subscribe":false,"listChanged":false},"prompts":{"listChanged":false}},"serverInfo":{"name":"#;
pub(crate) const MCP_WIRE_INIT_VERSION: &[u8] = br#","version":"#;
pub(crate) const MCP_WIRE_INIT_SUFFIX: &[u8] = b"}}}";
pub(crate) const MCP_JSON_NULL: &[u8] = b"null";
pub(crate) const KEY_JSONRPC: &str = "jsonrpc";
pub(crate) const KEY_METHOD: &str = "method";
pub(crate) const KEY_PARAMS: &str = "params";
pub(crate) const KEY_ID: &str = "id";
pub(crate) const EXPECTING_MCP_FIELD: &str = "a JSON-RPC 2.0 field name";
pub(crate) const EXPECTING_MCP_ID: &str = "a JSON-RPC 2.0 correlation id";
pub(crate) const EXPECTING_MCP_REQUEST: &str = "a JSON-RPC 2.0 request object";
pub(crate) const EXPECTING_MCP_PARAMS: &str = "an MCP params JSON value";
pub(crate) const MCP_SESSION_PREFIX: &str = "mcp-sess-";
pub(crate) const MCP_HEX_DIGITS: &[u8; 16] = b"0123456789abcdef";
pub(crate) const SPLITMIX_GAMMA: u64 = 0x9E37_79B9_7F4A_7C15;
pub(crate) const SPLITMIX_MUL1: u64 = 0xBF58_476D_1CE4_E5B9;
pub(crate) const SPLITMIX_MUL2: u64 = 0x94D0_49BB_1331_11EB;
pub(crate) const MCP_JSONRPC_VERSION: &str = "2.0";
pub(crate) const DEFAULT_MCP_SERVER_NAME: &str = "hyperlane-mcp";
pub(crate) const DEFAULT_MCP_SERVER_VERSION: &str = "1.0.0";
pub(crate) const MCP_ERR_PARSE: i64 = -32700;
pub(crate) const MCP_ERR_INVALID_REQUEST: i64 = -32600;
pub(crate) const MCP_ERR_METHOD_NOT_FOUND: i64 = -32601;
pub(crate) const MCP_ERR_INVALID_PARAMS: i64 = -32602;
pub(crate) const MCP_ERR_INTERNAL: i64 = -32603;
pub(crate) const METHOD_INITIALIZE: &str = "initialize";
pub(crate) const METHOD_NOTIF_INITIALIZED: &str = "notifications/initialized";
pub(crate) const METHOD_PING: &str = "ping";
pub(crate) const METHOD_TOOLS_LIST: &str = "tools/list";
pub(crate) const METHOD_TOOLS_CALL: &str = "tools/call";
pub(crate) const METHOD_RESOURCES_LIST: &str = "resources/list";
pub(crate) const METHOD_RESOURCES_READ: &str = "resources/read";
pub(crate) const METHOD_PROMPTS_LIST: &str = "prompts/list";
pub(crate) const METHOD_PROMPTS_GET: &str = "prompts/get";
pub(crate) const MSG_MCP_PARSE_ERROR: &str = "Parse error";
pub(crate) const MSG_MCP_INVALID_REQUEST: &str = "Invalid Request";
pub(crate) const MSG_MCP_METHOD_NOT_FOUND: &str = "Method not found";
pub(crate) const MSG_MCP_INVALID_PARAMS: &str = "Invalid params";
pub(crate) const MSG_MCP_SESSION_LIMIT: &str = "MCP session limit reached";
pub(crate) const MSG_MCP_UNKNOWN_TOOL: &str = "Unknown MCP tool";
pub(crate) const MSG_MCP_UNKNOWN_RESOURCE: &str = "Unknown MCP resource";
pub(crate) const MSG_MCP_UNKNOWN_PROMPT: &str = "Unknown MCP prompt";
pub(crate) const KEY_TYPE: &str = "type";
pub(crate) const KEY_TEXT: &str = "text";
pub(crate) const KEY_NAME: &str = "name";
pub(crate) const KEY_ARGUMENTS: &str = "arguments";
pub(crate) const KEY_URI: &str = "uri";
pub(crate) const ASCII_ZERO: u8 = b'0';
pub(crate) const ASCII_MINUS: u8 = b'-';
pub(crate) const ASCII_QUOTE: u8 = b'"';
pub(crate) const ASCII_BACKSLASH: u8 = b'\\';
pub(crate) const ASCII_RBRACE: u8 = b'}';