@juspay/neurolink
Version:
Universal AI Development Platform with external MCP server integration, multi-provider support, and professional CLI. Connect to 65+ MCP servers for filesystem, GitHub, database operations, and more. Build, test, and deploy AI applications with 9 major pr
145 lines (144 loc) • 4.26 kB
TypeScript
/**
* NeuroLink MCP Server Factory
* Factory-First Architecture: MCP servers create tools for internal orchestration
* Compatible with Lighthouse MCP patterns for seamless migration
*/
import { z } from 'zod';
/**
* MCP Server Categories for organization and discovery
*/
export type MCPServerCategory = 'ai-providers' | 'frameworks' | 'development' | 'business' | 'content' | 'data' | 'integrations' | 'automation' | 'analysis' | 'custom';
/**
* Tool execution context - Rich context passed to every tool execution
* Based on Lighthouse patterns with NeuroLink enhancements
*/
export interface NeuroLinkExecutionContext {
sessionId: string;
userId?: string;
aiProvider?: string;
modelId?: string;
temperature?: number;
maxTokens?: number;
organizationId?: string;
projectId?: string;
environmentType?: 'development' | 'staging' | 'production';
frameworkType?: 'react' | 'vue' | 'svelte' | 'next' | 'nuxt' | 'sveltekit';
toolChain?: string[];
parentToolId?: string;
permissions?: string[];
securityLevel?: 'public' | 'private' | 'organization';
[key: string]: any;
}
/**
* Tool execution result - Standardized result format
*/
export interface ToolResult {
success: boolean;
data?: any;
error?: string;
usage?: {
tokens?: number;
cost?: number;
provider?: string;
model?: string;
executionTime?: number;
};
metadata?: {
toolName?: string;
serverId?: string;
serverTitle?: string;
sessionId?: string;
timestamp?: number;
executionTime?: number;
};
}
/**
* MCP Tool Interface - Lighthouse compatible with NeuroLink enhancements
*/
export interface NeuroLinkMCPTool {
name: string;
description: string;
execute: (params: unknown, context: NeuroLinkExecutionContext) => Promise<ToolResult>;
inputSchema?: z.ZodSchema;
outputSchema?: z.ZodSchema;
isImplemented?: boolean;
category?: string;
permissions?: string[];
version?: string;
metadata?: Record<string, any>;
}
/**
* MCP Server Interface - 99% Lighthouse compatible
* Minimal required fields for easy adoption
*/
export interface NeuroLinkMCPServer {
id: string;
title: string;
description?: string;
version?: string;
category?: MCPServerCategory;
visibility?: 'public' | 'private' | 'organization';
tools: Record<string, NeuroLinkMCPTool>;
registerTool: (tool: NeuroLinkMCPTool) => NeuroLinkMCPServer;
metadata?: Record<string, any>;
dependencies?: string[];
capabilities?: string[];
}
/**
* MCP Server Configuration for creation
*/
export interface MCPServerConfig {
id: string;
title: string;
description?: string;
version?: string;
category?: MCPServerCategory;
visibility?: 'public' | 'private' | 'organization';
metadata?: Record<string, any>;
dependencies?: string[];
capabilities?: string[];
}
/**
* Create MCP Server Factory Function
*
* Core factory function for creating Lighthouse-compatible MCP servers.
* Follows Factory-First architecture where tools are internal implementation.
*
* @param config Server configuration with minimal required fields
* @returns Fully configured MCP server ready for tool registration
*
* @example
* ```typescript
* const aiCoreServer = createMCPServer({
* id: 'neurolink-ai-core',
* title: 'NeuroLink AI Core',
* description: 'Core AI provider tools',
* category: 'ai-providers'
* });
*
* aiCoreServer.registerTool({
* name: 'generate-text',
* description: 'Generate text using AI providers',
* execute: async (params, context) => {
* // Tool implementation
* return { success: true, data: result };
* }
* });
* ```
*/
export declare function createMCPServer(config: MCPServerConfig): NeuroLinkMCPServer;
/**
* Utility function to validate tool interface
*/
export declare function validateTool(tool: NeuroLinkMCPTool): boolean;
/**
* Utility function to get server info
*/
export declare function getServerInfo(server: NeuroLinkMCPServer): {
id: string;
title: string;
description?: string;
category?: MCPServerCategory;
toolCount: number;
capabilities: string[];
};