bc-webclient-mcp
Version:
Model Context Protocol (MCP) server for Microsoft Dynamics 365 Business Central via WebUI protocol. Enables AI assistants to interact with BC through the web client protocol, supporting Card, List, and Document pages with full line item support and server
46 lines • 1.3 kB
TypeScript
/**
* MCP Error Mapping
*
* Maps BCError subclasses to JSON-RPC 2.0 error codes.
*
* Standard JSON-RPC 2.0 error codes:
* -32700: Parse error
* -32600: Invalid Request
* -32601: Method not found
* -32602: Invalid params
* -32603: Internal error
*
* Custom error codes (MCP extensions):
* -32000: Timeout
* -32001: Authentication error
* -32002: Authorization/Permission denied
* -32003: Network error
* -32040: Business logic error
* -32041: Validation error (non-input)
* -32042: Protocol error
* -32043: Connection error
* -32044: Not found (page, record, field, action)
* -32045: Conflict/Precondition failed
* -32046: Read-only/Action disabled
*/
/**
* MCP Error structure for JSON-RPC 2.0 responses
*/
export interface MCPErrorResponse {
code: number;
message: string;
data?: {
errorType: string;
errorCode: string;
context?: Record<string, unknown>;
stack?: string;
};
}
/**
* Maps a BCError to an MCP error response with appropriate JSON-RPC error code.
*
* @param error - The error to map (can be BCError, Error, or unknown)
* @returns MCP error response with code, message, and optional data
*/
export declare function toMCPError(error: unknown): MCPErrorResponse;
//# sourceMappingURL=mcp-error-mapping.d.ts.map