Reasoning Engine MCP Server
Overview
The Reasoning Engine MCP Server exposes tools for multi-step analytical reasoning, including correlation analysis, temporal pattern detection, and domain-specific validation. In the current source, env.includeReasoningEngine reads MASTRA_INCLUDE_REASONING_ENGINE=true; when enabled, the Reasoning Engine artifact loader attaches this MCP server.
Server Metadata
| Property | Value |
|---|---|
| Factory | createReasoningEngineMcpServer() |
| Source | src/mastra/mcp-servers/reasoning-engine-server.ts |
| Version | 1.0.0 |
| Tool Count | 8 |
| Gate | MASTRA_INCLUDE_REASONING_ENGINE=true through env.includeReasoningEngine |
| Tool Registry | src/mastra/tools/reasoning-engine/index.ts |
Factory Implementation
// src/mastra/mcp-servers/reasoning-engine-server.ts
import { MCPServer } from '@mastra/mcp';
import { reasoningEngineTools } from '../tools/reasoning-engine/index.ts';
export const createReasoningEngineMcpServer = () =>
new MCPServer({
name: 'Reasoning Engine MCP Server',
version: '1.0.0',
description: 'Exposes the reasoning-engine tools such as the correlation tool.',
tools: reasoningEngineTools,
});
Tool Registry
All 8 tools are exported from src/mastra/tools/reasoning-engine/index.ts:
| Tool ID | Description |
|---|---|
reasoning-engine-orchestrator | Top-level orchestrator that coordinates multi-step reasoning workflows |
reasoning-engine-normalize-checkin-dataset | Normalize and clean check-in datasets for analysis |
reasoning-engine-multi-factor-correlation | Perform multi-factor correlation analysis across data dimensions |
reasoning-engine-temporal-analysis | Analyze temporal patterns and trends in time-series data |
reasoning-engine-pattern-recognition | Detect recurring patterns and anomalies in structured data |
reasoning-engine-domain-retrieval | Retrieve domain-specific context and reference data |
reasoning-engine-explanation | Generate human-readable explanations of analytical findings |
reasoning-engine-validation | Validate reasoning outputs against domain rules and constraints |
Implementation Notes
Loader Behavior
src/mastra/config/env.ts exposes includeReasoningEngine, which reads
MASTRA_INCLUDE_REASONING_ENGINE directly and returns true only for true.
When enabled, src/mastra/artifacts/reasoning-engine.loader.ts returns the
server:
const mcpServers = {
'reasoning-engine': createReasoningEngineMcpServer(),
};
Orchestrator Pattern
The reasoning-engine-orchestrator tool acts as a meta-tool that coordinates the other 7 tools in a multi-step reasoning pipeline. A typical orchestration flow:
The orchestrator determines which steps are needed based on the input data and reasoning request, then executes them in the appropriate order.
Target Gating
The audited MASTRA_TARGET schema supports k12, tap, sdac, handbook,
and all. It does not include a separate reasoning-engine target in that
enum. Reasoning Engine availability is controlled by
MASTRA_INCLUDE_REASONING_ENGINE=true.
Database Dependencies
The Reasoning Engine tools use the REASONING schema in Azure SQL for:
- Persisting reasoning session state
- Storing step outputs in
data_WorkflowStepOutputs - Recording task, step, and error logs when SQL logging is enabled
Domain retrieval does not cache to the reasoning schema in the committed implementation. It uses Perplexity-backed retrieval when configured and a local/stub fallback otherwise.
Code Locations
- Server factory:
src/mastra/mcp-servers/reasoning-engine-server.ts - Tool registry:
src/mastra/tools/reasoning-engine/index.ts - Individual tools:
src/mastra/tools/reasoning-engine/** - Tests:
tests/shared/unit/mcp-servers/mcp-servers.test.ts(Reasoning Engine MCP Server describe block)