mcp protocol-compliant sql query execution with connection pooling
Executes SQL queries against Apache Doris through a standardized MCP protocol interface, leveraging a connection pooling layer (DorisConnectionManager) that maintains persistent database connections with health monitoring and token-bound configuration. Queries flow through a QueryExecutor component that handles result serialization and error propagation back to MCP clients via stdio or HTTP transports.
Unique: Implements a layered query execution pipeline with DorisConnectionManager handling connection lifecycle, health monitoring, and token-bound configuration at the database layer, while QueryExecutor abstracts SQL execution and result serialization — this separation enables connection reuse across multiple MCP tool invocations without per-query overhead
vs alternatives: Differs from direct JDBC/ODBC clients by providing MCP protocol standardization, enabling seamless integration with AI assistants and LLM frameworks without custom client code; connection pooling and health monitoring reduce latency vs. creating new connections per query
database schema and metadata extraction with caching
Extracts and caches database schema information (tables, columns, data types, constraints) through a SchemaExtractor component that queries Doris system catalogs and materializes results for fast retrieval by AI agents. Metadata is exposed as MCP resources, enabling LLMs to understand data structure without executing discovery queries repeatedly.
Unique: Implements a two-tier metadata system: SchemaExtractor queries Doris catalogs and caches results in DorisResourcesManager, which exposes schema as MCP resources that can be injected into LLM prompts without additional database calls — this enables schema-aware reasoning without per-request metadata overhead
vs alternatives: Provides cached, MCP-native schema access vs. alternatives that require LLMs to execute DESCRIBE/SHOW commands repeatedly; integrates with MCP resource system for standardized schema sharing across tools
health check and connection pool monitoring
Monitors connection pool health through DorisConnectionManager, which periodically tests connections and removes stale or failed connections. Health check results are exposed as MCP resources and can trigger alerts. Connection pool statistics (size, utilization, wait time) are tracked and available for monitoring dashboards.
Unique: Implements periodic health checks at the DorisConnectionManager level, where failed connections are removed and replaced transparently — health status is exposed as MCP resources, enabling monitoring without external tools
vs alternatives: Provides MCP-native health monitoring vs. external health check tools; automatic connection recovery reduces manual intervention and improves availability
sql security validation and data masking
Validates incoming SQL queries against a security policy engine (DorisSecurityManager) that checks for dangerous operations (DROP, TRUNCATE, unauthorized schema access) and applies data masking rules before query execution. Masking policies are defined per column and enforced at the result serialization layer, preventing sensitive data exposure to LLM agents.
Unique: Implements a two-stage security model: DorisSecurityManager validates query syntax and operations against a blocklist/allowlist before execution, while a separate masking layer applies column-level redaction rules during result serialization — this separation allows queries to execute safely while preventing sensitive data leakage to LLM agents
vs alternatives: Provides MCP-native security enforcement vs. relying on database-level permissions alone; masking at the application layer enables fine-grained control over what LLM agents see without modifying database views or roles
token-based authentication with multi-provider support
Manages authentication to Doris through a TokenManager component that supports multiple credential types (username/password, API tokens, JWT) and binds tokens to connection pool entries. Tokens are refreshed automatically based on TTL, and authentication state is tracked per connection, enabling secure multi-agent access without credential sharing.
Unique: Implements token-bound connection pooling where each connection in DorisConnectionManager is associated with a specific token and TTL, enabling automatic refresh without invalidating other connections — TokenManager tracks token state separately from connections, allowing credential rotation without pool drain
vs alternatives: Provides token-bound connection pooling vs. shared credentials, enabling per-agent audit trails and credential rotation without connection pool reset; automatic TTL-based refresh reduces manual credential management overhead
multi-transport protocol support (stdio, http, adbc)
Supports three transport mechanisms for different deployment scenarios: stdio for direct process-to-process MCP integration, HTTP for REST-based access, and ADBC for Arrow-based data interchange. Transport selection is configured at startup, with each mode using dedicated initialization paths (initialize_for_stdio_mode, start_http, ADBC integration) that abstract protocol differences from the core query execution layer.
Unique: Implements a transport abstraction layer where DorisServer (MCP protocol layer) is decoupled from transport implementation via stdio_server(), start_http(), and ADBC integration modules — each transport has its own initialization path but shares the same underlying query execution and security layers, enabling single codebase deployment across multiple integration patterns
vs alternatives: Provides unified security and query execution across multiple transports vs. separate implementations for each protocol; transport abstraction allows switching deployment modes without code changes
query analysis and performance metrics collection
Collects query execution metrics (latency, rows processed, memory usage) through AnalysisTools component and exposes them as MCP resources. Metrics are aggregated per query and per user, enabling performance monitoring and optimization recommendations. Integration with Doris query profiling provides detailed execution plan analysis.
Unique: Integrates query metrics collection at the QueryExecutor level, capturing execution statistics before result serialization, and exposes metrics as MCP resources via DorisResourcesManager — this enables LLM agents to reason about query cost and performance without additional API calls
vs alternatives: Provides MCP-native performance metrics vs. requiring separate monitoring tools; metrics are available to LLM agents for cost-aware query optimization without external integrations
dynamic tool registration and prompt template injection
Registers SQL query tools and analysis functions dynamically through DorisToolsManager, which exposes them as MCP tools with schema-based function signatures. Prompt templates are managed by DorisPromptsManager and injected into LLM context, providing domain-specific guidance for query generation and data exploration.
Unique: Implements a two-layer tool system: DorisToolsManager registers tools with MCP-compatible schemas, while DorisPromptsManager maintains prompt templates that are injected into LLM context — this separation enables tools to be discovered and invoked by agents while prompts guide reasoning without tool schema pollution
vs alternatives: Provides MCP-native tool registration vs. custom tool discovery mechanisms; prompt injection enables domain-specific guidance without modifying LLM system prompts
+3 more capabilities