mcp_llm library
Main library for integrating Large Language Models with MCP
Classes
-
AdvancedLlmTask<
T> - Task definition
- AdvancedTaskScheduler
- Advanced task scheduler
- ApiKeyValidator
- API Key based token validator
- AuthConfig
- Configuration for OAuth authentication
- AuthContextManager
- Authentication context manager
- AuthResult
- Authentication result
- BasePromptPlugin
- Base implementation of a prompt plugin
- BaseToolPlugin
- Base implementation of a tool plugin
- BatchConfig
- Batch request configuration for JSON-RPC 2.0 optimization
- BatchRequest
- Individual request in a batch
- BatchRequestManager
- JSON-RPC 2.0 Batch Processing Manager for 2025-03-26 MCP optimization
- BatchResponse
- Batch response containing multiple results
- CapabilityEvent
- Capability event (2025-03-26)
- CapabilityUpdateRequest
- Capability update request (2025-03-26)
- CapabilityUpdateResponse
- Capability update response (2025-03-26)
- ChatHistory
- Manages the history of messages for a chat session
- ChatSession
- Manages a chat session with an LLM, including history and context
- ClaudeProvider
- Implementation of LLM interface for Claude API
- ClaudeProviderFactory
- Factory for creating Claude providers
- ConfidenceResultAggregator
- Aggregator that selects the response with highest confidence
- Conversation
- Manages a conversation with optional topics and multi-session support
- CoreLlmPluginFactory
- Factory to create all core LLM feature plugins
- CustomLlmProvider
- Base class for implementing custom LLM providers
- CustomLlmProviderFactory
- Base factory for custom LLM providers
- DefaultServiceBalancer
- Default implementation of ServiceBalancer
- DefaultServiceRouter
- Default implementation of ServiceRouter
- DefaultTokenizer
- DeferredToolManager
- Orchestration layer for deferred tool loading Uses internal registry for data management Automatically created when useDeferredLoading=true in LlmClient
- Document
- Represents a document with content and optional metadata
- DocumentCollection
- Represents a collection of documents
- DocumentStore
- Store for documents with vector search capabilities
- DynamicFileResourcePlugin
- Dynamic file resource plugin that can generate file content on demand
- DynamicPromptPlugin
- Dynamic prompt plugin generated by LLM
- DynamicResourcePlugin
- Dynamic resource plugin generated by LLM
- DynamicToolPlugin
- Dynamic tool plugin generated by LLM
- Embedding
- Represents a document's embedding vector
- EmbeddingPlugin
- Interface for embedding plugins that provide embedding functionality
- EmbeddingUtils
- Utilities for working with embeddings
- EnhancedErrorHandler
- Enhanced Error Handler for 2025-03-26 MCP specification
- ErrorCircuitBreaker
- Circuit breaker for error handling
- ErrorHandler
- Error handler for MCPLlm
- ErrorHandlingConfig
- Error handling configuration
-
GenericServicePool<
T> - Implementation of service pool for resource pooling of clients or servers
- HealthCheckConfig
- Health check configuration (using models from core/models.dart)
- HealthCheckResult
- Health check result (2025-03-26)
- HealthReport
- Health report (2025-03-26)
- IPluginManager
- Manager interface for plugins
- Level
- Levels to control logging output. Logging can be enabled to include all levels above certain Level. Levels are ordered using an integer value Level.value. The predefined Level constants below are sorted as follows (in descending order): Level.SHOUT, Level.SEVERE, Level.WARNING, Level.INFO, Level.CONFIG, Level.FINE, Level.FINER, Level.FINEST, and Level.ALL.
- LifecycleEvent
- Lifecycle event (2025-03-26)
- LifecycleRequest
- Lifecycle operation request
- LifecycleResponse
- Lifecycle response (2025-03-26)
- LlmCallToolResult
- Tool call result
- LlmClient
- Client for interacting with LLM providers
- LlmClientAdapter
- Adapter that converts MCP client instances to LLM compatible format with OAuth 2.1 support
- LlmClientFactory
- Implementation of service factory for LLM clients
- LlmCompletionPlugin
- Plugin for basic LLM text completion
- LlmConfiguration
- LLM configuration with enhanced retry capabilities
- LLmContent
- Base class for all MCP content types
- LlmContext
- Manages the execution context for LLM requests
- LlmEmbeddingPlugin
- Plugin for generating embeddings
- LlmGetPromptResult
- Get prompt result
- LlmImageContent
- Image content representation
- LlmInterface
- Interface for LLM providers
- LlmMessage
- Represents a chat message in a conversation
- LlmPlugin
- Base interface for all MCPLlm plugins
- LlmPrompt
- Prompt definition
- LlmPromptArgument
- Prompt argument definition
- LlmProvider
- Abstract base class for LLM providers
- LlmProviderFactory
- Factory interface for creating LLM providers
- LlmRagPlugin
- Plugin for Retrieval Augmented Generation (RAG)
- LlmReadResourceResult
- Resource read result
- LlmRegistry
- Registry that dynamically registers and manages LLM providers
- LlmRequest
- Represents a request to an LLM
- LlmResource
- Resource definition
- LlmResourceContent
- Resource content representation
- LlmResponse
- LLM response for completions
- LlmResponseChunk
- LLM response chunk for streaming
- LlmRetrievalPlugin
- Plugin for document retrieval
- LlmServer
- Server for providing LLM capabilities Enhanced with plugin-based tool management
- LlmServerFactory
- Implementation of service factory for LLM servers
- LlmStreamingPlugin
- Plugin for streaming LLM text completion
-
LlmTask<
T> - Represents a scheduled task with priority
- LlmTextContent
- Text content representation
- LlmTool
- Tool definition
- LlmToolCall
- Tool call request
- LlmToolCallContent
- Tool call result content
- LlmToolMetadata
- Lightweight tool metadata (name + description only) Used for token-efficient LLM context in deferred loading mode
- LlmToolResultContent
- Tool result content
- Logger
- Use a Logger to log debug messages.
- LogRecord
- A log entry representation used to propagate information from Logger to individual handlers.
- McpAuthAdapter
- MCP Authentication Adapter for 2025-03-26 OAuth 2.1 integration
- McpCapability
- MCP capability definition (2025-03-26)
- McpCapabilityManager
- MCP Capability Manager for 2025-03-26 capabilities/update methods
- McpClientManager
- Manages multiple MCP clients for a single LLM client with OAuth 2.1 support (2025-03-26)
- McpHealthMonitor
- MCP Health Monitor for 2025-03-26 health/check methods
- McpLlm
- Main class for MCPLlm functionality
- McpServerManager
- Manages multiple MCP servers
- MemoryStorage
- In-memory implementation of StorageManager for testing and simple use cases
- MergeResultAggregator
- Aggregator that merges results
- MultiLlmClientManager
- Manager for multiple LLM clients that implements the ServiceManager interface
- MultiLlmServerManager
- Manager for multiple LLM servers that implements the ServiceManager interface
- OpenAiProvider
- Implementation of LLM interface for OpenAI API
- OpenAiProviderFactory
- Factory for creating OpenAI providers
- OptimizedMemoryVectorStore
- High-performance in-memory vector store with persistence
- ParallelExecutor
- Class that manages parallel operations for multiple LLMs
- PerformanceMonitor
- Performance monitoring system for LLM and MCP usage
- PersistentStorage
- File-based persistent storage implementation
- PineconeVectorStore
- Pinecone vector store implementation
- PineconeVectorStoreFactory
- Factory for creating Pinecone vector stores
- PluginManager
- Manages plugins for the MCPLlm system
- PostprocessorPlugin
- Interface for postprocessor plugins that transform LLM outputs
- PreprocessorPlugin
- Interface for preprocessor plugins that transform inputs
- PromptPlugin
- Interface for prompt plugins that provide prompt templates
- ProviderOptions
- Configuration options for LLM providers
- ProviderPlugin
- Interface for provider plugins that implement new LLM providers
- RealPineconeVectorStore
- Pinecone vector store implementation
- RealQdrantVectorStore
- Qdrant vector store implementation
- RealWeaviateVectorStore
- Weaviate vector store implementation
- ResourcePlugin
- Interface for resource plugins that provide resources
- ResultAggregator
- Interface for aggregating multiple LLM responses
- RetrievalCache
- Cache to store retrieval results to improve performance
- RetrievalManager
- Enhanced Retrieval manager with improved RAG capabilities
- RetryableLlmProvider
- Interface for LLM providers with retry capabilities
- RetryStrategy
- Retry strategy
- SampleEchoToolPlugin
- A simple example tool plugin implementation
- ScoredDoc
- Helper class for document scoring
- ScoredDocument
- Scored document result
- ScoredEmbedding
- Scored embedding result
- ServerInfo
- Server info (2025-03-26)
- ServerLifecycleManager
- Server Lifecycle Manager for 2025-03-26 MCP specification
- SimpleResultAggregator
- Simple result aggregator
- StorageManager
- Abstract interface for storage management
- StoryStarterPromptPlugin
- Example prompt plugin for generating creative story starters
- TaskScheduler
- Task scheduler with priority queue and concurrency control
- TogetherProvider
- Implementation of LLM interface for Together AI API
- TogetherProviderFactory
- Factory for creating Together AI providers
- TokenCounter
- Tokenizer
- TokenValidator
- Token validator interface
- ToolPlugin
- Interface for tool plugins that provide tool functionality
- ValidationResult
- Simple validation result for tool call validation
- VectorDocument
- Vector document for internal use
- VectorSearchResult
- Vector search result for internal use
- VectorStore
- Base interface for vector stores
- VectorStoreConfig
- Configuration options for vector stores
- VectorStoreFactory
- Factory for creating vector stores
- VectorStoreRegistry
- Registry for vector store implementations
- VectorStoreStats
- Vector store statistics
- WeaviateVectorStore
- Weaviate vector store implementation
Enums
- CapabilityEventType
- Capability event type (2025-03-26)
- CircuitState
- Circuit breaker state
- ErrorHandlingStrategy
- Error handling strategy
- ErrorSeverity
- Error severity levels
- ErrorType
- Error types for MCPLlm
- HealthStatus
- Health status enum (2025-03-26)
- LifecycleTransitionReason
- Lifecycle transition reason (2025-03-26)
- LlmCapability
- LLM capabilities enum
- LlmContentType
- Content type enum
- McpCapabilityType
- MCP capability type (2025-03-26)
- McpErrorCategory
- MCP error category (2025-03-26)
- PriorityStrategy
- Task priority calculation strategy
- SelectionStrategy
- ServerLifecycleState
- Server lifecycle state (2025-03-26)
- TaskStatus
- Task status
Extensions
- AuthResultExtensions on AuthResult
- LlmServerAdvancedExtensions on LlmServer
- Extensions for advanced server operations
- LlmServerHelperExtensions on LlmServer
- Additional helper methods General extensions for LlmServer
- LlmServerPluginExtensions on LlmServer
- Extension methods for LlmServer Provides convenience methods for registering core LLM functionality as plugins
- LoggerExtensions on Logger
- RetryCapabilities on LlmInterface
- Extension to add retry capabilities to LLM providers
Constants
- defaultLevel → const Level
- The default Level.
Properties
- hierarchicalLoggingEnabled ↔ bool
-
Whether to allow fine-grain logging and configuration of loggers in a
hierarchy.
getter/setter pair
- recordStackTraceAtLevel ↔ Level
-
Automatically record stack traces for any message of this level or above.
getter/setter pair
Exceptions / Errors
- AuthenticationError
- Authentication errors (API keys, tokens)
- McpEnhancedError
- MCP enhanced error (2025-03-26)
- McpEnhancedErrorExt
- Enhanced MCP error extension with additional fields
- McpLlmError
- Base class for MCPLlm errors
- NetworkError
- Network-related errors (API calls, connectivity)
- PermissionError
- Permission errors (access denied)
- ProviderError
- Provider-specific errors
- ResourceNotFoundError
- Resource not found errors
- TaskCancelledException
- Exception thrown when a task is cancelled
- TimeoutError
- Timeout errors
- ValidationError
- Validation errors (invalid inputs)