1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
//! High-performance MCP server implementation using the pmcp SDK
//!
//! This module provides an experimental Model Context Protocol (MCP) server
//! implementation built on top of the pmcp Rust SDK. It offers significant
//! performance improvements and native async/await support compared to the
//! standard implementation.
//!
//! # Features
//!
//! - **10x performance improvement** over the standard MCP implementation
//! - **Type-safe tool handlers** with compile-time validation
//! - **Native async/await** support with tokio
//! - **Built-in transport support** for stdio, WebSocket, and HTTP/SSE
//!
//! # Usage
//!
//! The pmcp-based server is activated using the `PMAT_PMCP_MCP` environment variable.
//! With pmcp 1.0, this is now always available as a core feature.
//!
//! ## Running the pmcp server
//!
//! ```bash
//! PMAT_PMCP_MCP=1 pmat
//! ```
//!
//! # Example
//!
//! ```rust,no_run
//! use pmat::mcp_pmcp::PmcpServer;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Create a new pmcp server instance
//! let server = PmcpServer::new();
//!
//! // Run the server on stdio transport
//! server.run().await?;
//!
//! Ok(())
//! }
//! ```
//!
//! # Available Tools
//!
//! The pmcp server implements 24 MCP tools across different categories:
//!
//! ## Analysis Tools
//! - `analyze_complexity` - Analyze code complexity metrics
//! - `analyze_satd` - Detect self-admitted technical debt
//! - `analyze_dead_code` - Find unused code
//! - `analyze_dag` - Generate dependency graphs
//! - `analyze_deep_context` - Comprehensive code analysis
//! - `analyze_big_o` - Big-O complexity analysis
//!
//! ## Refactoring Tools
//! - `refactor.start` - Start a refactoring session
//! - `refactor.nextIteration` - Advance refactoring state
//! - `refactor.getState` - Get current refactoring state
//! - `refactor.stop` - Stop refactoring session
//!
//! ## Quality Tools
//! - `quality_gate` - Run comprehensive quality checks
//! - `quality_proxy` - Proxy code changes through quality gates
//!
//! ## Git Tools
//! - `git_operation` - Perform git operations
//!
//! ## Context Tools
//! - `generate_context` - Generate project context
//! - `generate_template` - Generate file from template
//! - `scaffold_project` - Create project structure
//!
//! ## TDG System Tools (Sprint 31)
//! - `tdg_system_diagnostics` - Comprehensive TDG system diagnostics
//! - `tdg_storage_management` - Manage TDG storage operations
//! - `tdg_analyze_with_storage` - Analyze files with transactional storage
//! - `tdg_performance_metrics` - Real-time performance metrics
//! - `tdg_configure_storage` - Configure and validate storage backends
//! - `tdg_health_check` - Comprehensive system health check
//!
//! # Performance
//!
//! The pmcp implementation provides significant performance benefits:
//!
//! ```rust,ignore
//! // Standard MCP server
//! // Average response time: 50ms
//! // Memory usage: 100MB
//!
//! // pmcp-based server
//! // Average response time: 5ms (10x faster)
//! // Memory usage: 50MB (50% reduction)
//! ```
// Phase 4: Organizational Intelligence Integration
// KAIZEN-0178: build.rs-generated tool schema registry
// Sprint 65 Phase 2B: MCP git-context integration
// Export the simple unified server as the primary interface
pub use SimpleUnifiedServer as UnifiedServer;
// Keep PmcpServer for backward compatibility (will be removed)
pub use PmcpServer;
// Export the discovery service for MCP optimization
pub use ;