ragatanga-mcp-sdk
Version:
SDK for integrating with the Ragatanga Management Control Plane (MCP) with Next.js 15, React 19, WebSocket and Arrow IPC support
157 lines (155 loc) • 3.5 kB
text/typescript
interface MCPOptions {
baseUrl?: string;
tenantId?: string;
apiKey?: string;
token?: string;
/**
* Default fetch options to apply to all requests
*/
defaultFetchOptions?: RequestInit;
/**
* Default timeout in ms (default: 10000)
*/
defaultTimeout?: number;
/**
* Transport type to use:
* - stdio: Standard input/output
* - sse: Server-Sent Events
* - websocket: WebSocket transport
* - arrow: Arrow IPC over WebSocket transport
*/
type?: 'stdio' | 'sse' | 'websocket' | 'arrow';
}
interface MCPResponse<T> {
data: T;
status: number;
headers: Headers;
/**
* Full response object for access to additional properties
*/
response: Response;
}
/**
* @deprecated Use MCPError class from '../errors' instead
*/
interface MCPError {
status: number;
message: string;
code?: string;
/**
* Original error that caused the failure
*/
cause?: unknown;
}
interface OntologyMetadata {
id: string;
name: string;
createdAt: string;
size?: number;
format?: string;
/**
* Last modified timestamp
*/
updatedAt?: string;
/**
* Total number of entities in the ontology
*/
entityCount?: number;
/**
* Owner of the ontology
*/
owner?: string;
}
interface OntologySummary {
id: string;
name: string;
createdAt: string;
/**
* Format of the ontology (owl, ttl, etc.)
*/
format?: string;
}
/**
* Type for cache configuration in fetch requests
*/
type MCPCacheConfig = {
/**
* Maximum age of cached data in seconds
*/
maxAge?: number;
/**
* Tag for the cached data, used for revalidation
*/
tag?: string | string[];
/**
* If true, will return stale data while revalidating in the background
*/
staleWhileRevalidate?: boolean;
};
/**
* Type for cache options
*/
type MCPCacheOptions = boolean | RequestCache | MCPCacheConfig;
/**
* Request parameters with Next.js App Router cache support
*/
interface MCPRequestParams {
/**
* Method for MCP request (used by MCP adapters)
*/
method?: string;
/**
* URL parameters to include in the request
*/
params?: Record<string, any>;
/**
* Request body
*/
body?: BodyInit | null;
/**
* Cache configuration for the request
*/
cache?: MCPCacheOptions;
/**
* Next.js revalidate option
*/
revalidate?: number | false;
/**
* Tags for the cached data
*/
tags?: string[];
}
/**
* Type for MCP Context specification
*/
interface MCPContextSpec {
id: string;
parameters: Record<string, any>;
}
/**
* Type for MCP Context request
*/
interface MCPContextRequest {
request_id: string;
current_query: string;
context_specs: MCPContextSpec[];
}
/**
* Type for MCP Context response
*/
interface MCPContextResponse {
responses: Array<{
id: string;
content: {
type: string;
value: string;
};
metadata: {
confidence: number;
source: string;
timestamp: string;
[]: any;
};
}>;
}
export type { MCPOptions as M, OntologySummary as O, MCPRequestParams as a, MCPResponse as b, OntologyMetadata as c, MCPCacheOptions as d, MCPError as e, MCPCacheConfig as f, MCPContextSpec as g, MCPContextRequest as h, MCPContextResponse as i };