Fukuii MCP Enhancement Plan¶
Complete Agent Control via Model Context Protocol¶
Version: 1.0.0
Date: 2025-12-12
Status: Planning Phase
Goal: Enable complete agent control over Fukuii node through MCP interface
Table of Contents¶
- Executive Summary
- Current State Analysis
- Vision for Complete Agent Control
- Gap Analysis
- Proposed MCP Enhancements
- Phase 1: Core Node Control
- Phase 2: Mining & Block Production
- Phase 3: Transaction & Account Management
- Phase 4: Network & Peer Management
- Phase 5: Advanced Monitoring & Diagnostics
- Phase 6: Configuration & Optimization
- Security Considerations
- Implementation Roadmap
- Acceptance Criteria
- Testing Strategy
- Documentation Requirements
Executive Summary¶
This plan outlines the roadmap to transform Fukuii's MCP integration from basic read-only capabilities to complete agent-controlled node management. The goal is to enable AI agents to fully operate, monitor, troubleshoot, and optimize an Ethereum Classic node through the Model Context Protocol.
Key Metrics: - Current MCP Coverage: 7.2% (7/97 endpoints) - Target MCP Coverage: 85% (critical production endpoints) - Implementation Timeline: 6 phases over 12-16 weeks - New MCP Components: 45+ tools, 20+ resources, 15+ prompts
Benefits: 1. Autonomous Operations: Agents can start, stop, and configure node operations 2. Proactive Monitoring: Continuous health checks and anomaly detection 3. Intelligent Troubleshooting: Automated diagnosis and remediation 4. Performance Optimization: Dynamic configuration tuning based on conditions 5. Enhanced Security: Secure, auditable agent access with granular permissions
Current State Analysis¶
Existing MCP Implementation¶
Namespace: MCP
Endpoints: 7
Tools: 5 (mostly unimplemented)
Resources: 5 (mostly returning placeholder data)
Prompts: 3 (diagnostic guidance)
Current Tools¶
- ✅
mcp_node_info- Returns static build information - ⚠️
mcp_node_status- Placeholder (TODO: implement actor queries) - ⚠️
mcp_blockchain_info- Placeholder (TODO: implement) - ⚠️
mcp_sync_status- Placeholder (TODO: implement) - ⚠️
mcp_peer_list- Placeholder (TODO: implement)
Current Resources¶
- ⚠️
fukuii://node/status- Returns placeholder JSON - ⚠️
fukuii://node/config- Returns placeholder JSON - ⚠️
fukuii://blockchain/latest- Returns placeholder JSON - ⚠️
fukuii://peers/connected- Returns placeholder JSON - ⚠️
fukuii://sync/status- Returns placeholder JSON
Current Prompts¶
- ✅
mcp_node_health_check- Guides comprehensive health check - ✅
mcp_sync_troubleshooting- Guides sync issue diagnosis - ✅
mcp_peer_management- Guides peer connection management
Strengths¶
- ✅ Solid MCP protocol foundation (JSON-RPC integration)
- ✅ Clean modular architecture (Tools/Resources/Prompts separation)
- ✅ Good documentation structure
- ✅ Security-conscious design patterns
Weaknesses¶
- ❌ Most tools return placeholder data (not querying actual node state)
- ❌ No write operations (cannot control node)
- ❌ Limited observability (missing key metrics)
- ❌ No mining control capabilities
- ❌ No transaction management
- ❌ No peer management tools
- ❌ Missing configuration management
Vision for Complete Agent Control¶
Definition of "Complete Control"¶
An AI agent has complete control when it can autonomously:
- Monitor Node State
- Query all relevant blockchain data
- Access real-time sync status
- Monitor peer connections
- Track resource utilization
-
Retrieve transaction and block data
-
Manage Operations
- Start/stop mining
- Configure mining parameters
- Manage peer connections
- Control sync modes
-
Adjust resource limits
-
Handle Transactions
- Query transaction status
- Estimate gas costs
- Monitor pending transactions
-
Query account balances and nonces
-
Troubleshoot Issues
- Diagnose sync problems
- Identify performance bottlenecks
- Detect network issues
- Analyze error patterns
-
Recommend remediation steps
-
Optimize Performance
- Tune configuration parameters
- Manage peer quality
- Optimize resource allocation
-
Adjust sync strategies
-
Ensure Security
- Monitor for security issues
- Manage blacklists
- Control access
- Audit operations
Agent Capabilities Model¶
┌─────────────────────────────────────────────────┐
│ AI Agent │
│ (Claude, GPT, etc.) │
└───────────────┬─────────────────────────────────┘
│
│ MCP Protocol (JSON-RPC 2.0)
│
┌───────────────▼─────────────────────────────────┐
│ MCP Server (Fukuii) │
│ ┌──────────────────────────────────────────┐ │
│ │ Tools (Actions) │ │
│ │ - Query operations │ │
│ │ - Control operations │ │
│ │ - Management operations │ │
│ └──────────────────────────────────────────┘ │
│ ┌──────────────────────────────────────────┐ │
│ │ Resources (Data) │ │
│ │ - Real-time state │ │
│ │ - Historical data │ │
│ │ - Configuration │ │
│ └──────────────────────────────────────────┘ │
│ ┌──────────────────────────────────────────┐ │
│ │ Prompts (Guidance) │ │
│ │ - Diagnostic workflows │ │
│ │ - Operational procedures │ │
│ │ - Best practices │ │
│ └──────────────────────────────────────────┘ │
│ ┌──────────────────────────────────────────┐ │
│ │ Security Layer │ │
│ │ - Authentication │ │
│ │ - Authorization │ │
│ │ - Audit logging │ │
│ │ - Rate limiting │ │
│ └──────────────────────────────────────────┘ │
└───────────────┬─────────────────────────────────┘
│
│ Internal APIs
│
┌───────────────▼─────────────────────────────────┐
│ Fukuii Node Components │
│ - PeerManagerActor │
│ - SyncController │
│ - MiningCoordinator │
│ - Blockchain │
│ - TxPool │
└─────────────────────────────────────────────────┘
Gap Analysis¶
Critical Gaps for Node Control¶
1. Real Data Access (High Priority)¶
Current: All MCP tools return placeholder data
Needed: Integration with actual node actors and state
- Query PeerManagerActor for peer information
- Query SyncController for sync status
- Query Blockchain for block data
- Query TxPool for transaction status
- Query MiningCoordinator for mining status
2. Write Operations (High Priority)¶
Current: All operations are read-only
Needed: Control capabilities
- Start/stop mining
- Connect/disconnect peers
- Add/remove peer blacklist entries
- Configure node parameters
- Trigger maintenance operations
3. Comprehensive Monitoring (Medium Priority)¶
Current: Limited status information
Needed: Full observability
- Detailed performance metrics
- Resource utilization tracking
- Historical trend data
- Error and warning logs
- Network statistics
4. Transaction Management (Medium Priority)¶
Current: No transaction tools
Needed: Transaction observability
- Query transaction status
- Monitor pending transactions
- Estimate gas costs
- Query account states
5. Configuration Management (Medium Priority)¶
Current: Placeholder config data
Needed: Configuration access and validation
- Read current configuration
- Validate configuration changes
- Report configuration issues
- Recommend optimal settings
6. Diagnostic Capabilities (Low Priority)¶
Current: Basic prompt guidance
Needed: Advanced diagnostics
- Automated health checks
- Performance profiling
- Root cause analysis
- Predictive issue detection
Proposed MCP Enhancements¶
Phase 1: Core Node Control¶
Timeline: Weeks 1-3
Goal: Enable basic node state monitoring and control
New Tools (8)¶
Read Operations¶
mcp_node_status_detailed- Description: Get comprehensive node status with real actor data
- Queries: PeerManagerActor, SyncController, Blockchain, TxPool
- Returns: JSON with sync state, peer count, best block, network health
- Input Schema: None
-
Example:
-
mcp_blockchain_latest_block - Description: Get latest block details with full transaction info
- Queries: Blockchain
- Returns: Complete block data with transactions
-
Input Schema:
{ includeTransactions: boolean } -
mcp_sync_progress - Description: Get detailed sync progress metrics
- Queries: SyncController
- Returns: Sync mode, progress percentage, ETA, speed metrics
-
Input Schema: None
-
mcp_network_health - Description: Assess overall network health
- Queries: PeerManagerActor, SyncController
- Returns: Health score, peer diversity, sync reliability
- Input Schema: None
Write Operations¶
mcp_node_config_validate- Description: Validate configuration without applying
- Validates: Configuration syntax and semantics
- Returns: Validation results, warnings, recommendations
- Input Schema:
{ config: object } -
Safety: 🟢 Safe (read-only validation)
-
mcp_health_check - Description: Run comprehensive automated health check
- Checks: Sync status, peer quality, disk space, performance
- Returns: Health report with issues and recommendations
-
Input Schema:
{ deep: boolean } -
mcp_metrics_snapshot - Description: Capture current metrics snapshot
- Captures: All key performance indicators
- Returns: Timestamped metrics bundle
-
Input Schema: None
-
mcp_logs_recent - Description: Get recent log entries
- Queries: Log system
- Returns: Filtered log entries
- Input Schema:
{ level: string, count: int, since: timestamp }
Enhanced Resources (7)¶
fukuii://node/status/live- Real-time node status with actor queries
- Auto-refresh capability
-
WebSocket notification support
-
fukuii://node/config/current - Current running configuration
- Read from actual config system
-
Include defaults and overrides
-
fukuii://blockchain/chain-head - Latest block with full details
- Transaction summaries
-
State root information
-
fukuii://sync/progress - Detailed sync progress
- Historical sync rate
-
ETA calculation
-
fukuii://metrics/current - Current performance metrics
- CPU, memory, disk usage
-
Network bandwidth
-
fukuii://logs/errors - Recent error logs
- Filtered by severity
-
With context
-
fukuii://health/report - Automated health assessment
- Issue prioritization
- Remediation suggestions
Implementation Notes¶
- Complete actor integration for all existing placeholder tools
- Add proper error handling and timeout management
- Implement caching for expensive queries
- Add metrics collection for tool usage
Phase 2: Mining & Block Production¶
Timeline: Weeks 4-5
Goal: Full mining lifecycle management
New Tools (7)¶
mcp_mining_status- Get current mining status and configuration
- Query MiningCoordinator for real status
- Return hashrate, coinbase, block count
- Input: None
-
Safety: 🟢 Safe
-
mcp_mining_start - Start mining operation
- Validate pre-conditions (sync status, config)
- Return success status
- Input:
{ threads?: number, coinbase?: address } -
Safety: 🟡 Caution (state modification)
-
mcp_mining_stop - Stop mining operation gracefully
- Wait for current block to complete
- Return final statistics
- Input:
{ graceful: boolean } -
Safety: 🟡 Caution (state modification)
-
mcp_mining_configure - Update mining parameters
- Validate configuration
- Apply without restart if possible
- Input:
{ coinbase?: address, extraData?: string, gasFloor?: number, gasCeil?: number } -
Safety: 🟡 Caution (configuration change)
-
mcp_mining_statistics - Get detailed mining statistics
- Include hashrate history, block production, rewards
- Return last 24h, 7d, 30d statistics
- Input:
{ period?: string } -
Safety: 🟢 Safe
-
mcp_block_production_rate - Calculate block production rate
- Compare to network average
- Identify performance issues
- Input:
{ blocks?: number } -
Safety: 🟢 Safe
-
mcp_mining_profitability - Estimate mining profitability
- Consider electricity, hashrate, difficulty
- Return ROI estimate
- Input:
{ electricityCost?: number, hashpower?: number } - Safety: 🟢 Safe
Enhanced Resources (4)¶
fukuii://mining/status- Current mining status
- Live hashrate
-
Recent blocks mined
-
fukuii://mining/config - Mining configuration
- Coinbase address
-
Gas limits
-
fukuii://mining/statistics - Historical mining data
- Block production over time
-
Reward calculations
-
fukuii://mining/profitability - Profitability calculations
- Network difficulty trends
- Cost/benefit analysis
New Prompts (2)¶
mcp_mining_optimization- Guide for optimizing mining setup
- Hardware recommendations
- Configuration tuning
-
Profitability improvement
-
mcp_mining_troubleshooting - Diagnose mining issues
- Low hashrate investigation
- Block production problems
- Network difficulty analysis
Phase 3: Transaction & Account Management¶
Timeline: Weeks 6-7
Goal: Complete transaction lifecycle visibility
New Tools (8)¶
mcp_transaction_get- Get transaction details by hash
- Include receipt if mined
- Show pending status if not mined
- Input:
{ hash: string } -
Safety: 🟢 Safe
-
mcp_transaction_pending_list - List pending transactions
- Filter by age, gas price, from/to
- Sort by priority
- Input:
{ limit?: number, filter?: object } -
Safety: 🟢 Safe
-
mcp_transaction_trace - Get transaction execution trace
- Show all internal calls
- Include gas usage details
- Input:
{ hash: string } -
Safety: 🟢 Safe
-
mcp_account_balance - Get account balance at block
- Support historical queries
- Include pending balance
- Input:
{ address: string, block?: string } -
Safety: 🟢 Safe
-
mcp_account_transactions - List transactions for account
- Support pagination
- Filter by type (sent/received)
- Input:
{ address: string, limit?: number, offset?: number } -
Safety: 🟢 Safe
-
mcp_gas_price_estimate - Estimate optimal gas price
- Consider network congestion
- Provide fast/medium/slow options
- Input:
{ priority?: string } -
Safety: 🟢 Safe
-
mcp_gas_limit_estimate - Estimate gas limit for transaction
- Use eth_estimateGas internally
- Add safety margin
- Input:
{ from: string, to: string, data?: string, value?: string } -
Safety: 🟢 Safe
-
mcp_contract_info - Get contract information
- Show bytecode size
- Detect contract type if possible
- Input:
{ address: string } - Safety: 🟢 Safe
Enhanced Resources (5)¶
fukuii://transaction/{hash}- Transaction details by hash
- Receipt information
-
Execution trace
-
fukuii://transactions/pending - All pending transactions
- Mempool statistics
-
Fee market data
-
fukuii://account/{address}/balance - Account balance
- Historical balance
-
Pending transactions
-
fukuii://account/{address}/transactions - Transaction history
- Paginated results
-
Filter capabilities
-
fukuii://gas/price-oracle - Gas price recommendations
- Network congestion data
- Historical price trends
New Prompts (2)¶
mcp_transaction_stuck- Diagnose stuck transaction
- Recommend solutions
-
Guide replacement/cancellation
-
mcp_gas_optimization - Optimize gas usage
- Find gas-efficient patterns
- Avoid common pitfalls
Phase 4: Network & Peer Management¶
Timeline: Weeks 8-9
Goal: Full peer lifecycle control
New Tools (10)¶
mcp_peers_list_detailed- List all peers with full details
- Include connection quality metrics
- Show geographic distribution
- Input: None
-
Safety: 🟢 Safe
-
mcp_peer_info - Get detailed info about specific peer
- Show connection stats
- Protocol version info
- Input:
{ peerId: string } -
Safety: 🟢 Safe
-
mcp_peer_connect - Connect to specific peer
- Support enode URLs
- Validate before connecting
- Input:
{ enode: string } -
Safety: 🟡 Caution (network change)
-
mcp_peer_disconnect - Disconnect from peer
- Optionally blacklist
- Provide reason
- Input:
{ peerId: string, blacklist?: boolean, reason?: string } -
Safety: 🟡 Caution (network change)
-
mcp_peer_quality_analyze - Analyze peer quality
- Score peers by reliability
- Identify bad actors
- Input:
{ peerId?: string } -
Safety: 🟢 Safe
-
mcp_blacklist_list - List all blacklisted peers
- Show reasons and timestamps
- Support filtering
- Input: None
-
Safety: 🟢 Safe
-
mcp_blacklist_add - Add peer to blacklist
- Specify duration and reason
- Auto-disconnect if connected
- Input:
{ address: string, duration?: number, reason: string } -
Safety: 🟡 Caution (network policy change)
-
mcp_blacklist_remove - Remove peer from blacklist
- Allow reconnection
- Log the action
- Input:
{ address: string } -
Safety: 🟡 Caution (network policy change)
-
mcp_network_topology - Visualize network connections
- Show peer relationships
- Identify network partitions
- Input: None
-
Safety: 🟢 Safe
-
mcp_discovery_status- Get peer discovery status
- Show discovery mechanisms
- Active discovery nodes
- Input: None
- Safety: 🟢 Safe
Enhanced Resources (6)¶
fukuii://peers/all- Complete peer list
- Connection details
-
Quality metrics
-
fukuii://peers/{id}/details - Specific peer information
- Connection history
-
Performance stats
-
fukuii://network/topology - Network graph data
- Peer relationships
-
Connection map
-
fukuii://blacklist/entries - All blacklisted peers
- Reasons and timestamps
-
Expiration info
-
fukuii://discovery/state - Discovery mechanism status
- Boot nodes
-
DHT state
-
fukuii://network/statistics - Network-wide statistics
- Bandwidth usage
- Message counts
New Prompts (3)¶
mcp_peer_connectivity_issues- Diagnose connectivity problems
- Too few peers
- Connection failures
-
Firewall/NAT issues
-
mcp_peer_diversity_optimization - Improve peer diversity
- Geographic distribution
- Client diversity
-
Reduce centralization
-
mcp_network_attack_detection - Detect network attacks
- Eclipse attack prevention
- Sybil attack detection
- DDoS mitigation
Phase 5: Advanced Monitoring & Diagnostics¶
Timeline: Weeks 10-11
Goal: Proactive issue detection and resolution
New Tools (7)¶
mcp_health_check_comprehensive- Run all health checks
- Produce detailed report
- Prioritize issues
- Input: None
-
Safety: 🟢 Safe
-
mcp_performance_profile - Profile node performance
- Identify bottlenecks
- Resource utilization analysis
- Input:
{ duration?: number } -
Safety: 🟢 Safe
-
mcp_issue_detect_sync - Detect sync issues automatically
- Compare with peers
- Identify stuck sync
- Input: None
-
Safety: 🟢 Safe
-
mcp_issue_detect_peers - Detect peer issues
- Too few/many peers
- Bad peer detection
- Input: None
-
Safety: 🟢 Safe
-
mcp_logs_analyze - Analyze logs for patterns
- Detect error trends
- Find warning clusters
- Input:
{ hours?: number } -
Safety: 🟢 Safe
-
mcp_metrics_trend - Analyze metric trends
- Detect anomalies
- Predict issues
- Input:
{ metric: string, period?: string } -
Safety: 🟢 Safe
-
mcp_diagnostic_report - Generate comprehensive diagnostic report
- Include all subsystems
- Export for support
- Input: None
- Safety: 🟢 Safe
Enhanced Resources (5)¶
fukuii://diagnostics/health- Overall health status
- All subsystem checks
-
Issue summary
-
fukuii://diagnostics/performance - Performance metrics
- Bottleneck analysis
-
Optimization suggestions
-
fukuii://diagnostics/issues - Detected issues list
- Severity ranking
-
Remediation steps
-
fukuii://logs/analysis - Log pattern analysis
- Error clustering
-
Trend detection
-
fukuii://metrics/trends - Metric trend data
- Anomaly detection
- Predictions
New Prompts (3)¶
mcp_performance_degradation- Diagnose performance issues
- Slow block processing
- High resource usage
-
Optimization steps
-
mcp_error_investigation - Investigate error patterns
- Root cause analysis
- Historical comparison
-
Resolution steps
-
mcp_predictive_maintenance - Predict future issues
- Preventive actions
- Capacity planning
- Upgrade recommendations
Phase 6: Configuration & Optimization¶
Timeline: Weeks 12-13
Goal: Dynamic configuration and intelligent optimization
New Tools (5)¶
mcp_config_get_full- Get complete configuration
- Include all defaults
- Show overrides
- Input: None
-
Safety: 🟢 Safe
-
mcp_config_validate_changes - Validate configuration changes
- Check dependencies
- Warn about issues
- Input:
{ changes: object } -
Safety: 🟢 Safe (validation only)
-
mcp_config_recommend - Recommend configuration changes
- Based on usage patterns
- Hardware capabilities
- Network conditions
- Input:
{ goal?: string } -
Safety: 🟢 Safe
-
mcp_optimization_suggest - Suggest optimizations
- Performance improvements
- Resource efficiency
- Cost reduction
- Input:
{ focus?: string } -
Safety: 🟢 Safe
-
mcp_capacity_planning - Analyze capacity requirements
- Storage growth projections
- Resource scaling needs
- Input:
{ horizon?: string } - Safety: 🟢 Safe
Enhanced Resources (3)¶
fukuii://config/full- Complete configuration
- All parameters
-
Documentation
-
fukuii://optimization/recommendations - Optimization suggestions
- Expected improvements
-
Implementation steps
-
fukuii://capacity/projections - Capacity forecasts
- Resource trends
- Scaling recommendations
New Prompts (2)¶
mcp_configuration_optimization- Optimize node configuration
- Balance tradeoffs
- Best practices
-
Environment-specific tuning
-
mcp_upgrade_planning - Plan node upgrades
- Compatibility checks
- Migration strategy
- Rollback plans
Security Considerations¶
Authentication & Authorization¶
Multi-Level Access Control¶
Level 1: Read-Only (Monitoring) - Query node status - View blockchain data - Access logs and metrics - No state modifications
Level 2: Operational (Management) - Level 1 permissions - Start/stop mining - Manage peer connections - Modify blacklist - No sensitive data access
Level 3: Administrative (Full Control) - Level 1 & 2 permissions - Configuration changes - Account management - Full node control
Implementation Approach¶
// Permission-based access control
sealed trait McpPermission
object McpPermission {
case object ReadOnly extends McpPermission
case object Operational extends McpPermission
case object Administrative extends McpPermission
}
// Tool permission requirements
case class McpToolDefinition(
name: String,
description: Option[String],
requiredPermission: McpPermission,
category: String
)
// Authorization check
def checkPermission(
userPermission: McpPermission,
requiredPermission: McpPermission
): Boolean = {
(userPermission, requiredPermission) match {
case (McpPermission.Administrative, _) => true
case (McpPermission.Operational, McpPermission.ReadOnly) => true
case (McpPermission.Operational, McpPermission.Operational) => true
case (McpPermission.ReadOnly, McpPermission.ReadOnly) => true
case _ => false
}
}
API Key Management¶
# fukuii.conf
fukuii.network.rpc.mcp {
enabled = true
# Authentication
authentication {
required = true
method = "api-key" # or "jwt", "oauth"
keys = [
{
name = "monitoring-agent"
key = "${MCP_MONITORING_KEY}"
permission = "read-only"
rate-limit = 60 # requests per minute
},
{
name = "ops-agent"
key = "${MCP_OPS_KEY}"
permission = "operational"
rate-limit = 30
},
{
name = "admin-agent"
key = "${MCP_ADMIN_KEY}"
permission = "administrative"
rate-limit = 20
}
]
}
# Authorization
authorization {
enabled = true
# Tool-specific overrides
tool-permissions = {
"mcp_mining_start" = ["operational", "administrative"]
"mcp_mining_stop" = ["operational", "administrative"]
"mcp_config_validate_changes" = ["administrative"]
"mcp_peer_connect" = ["operational", "administrative"]
}
}
}
Audit Logging¶
case class McpAuditLog(
timestamp: Long,
apiKey: String,
toolName: String,
parameters: JValue,
result: Either[String, String],
duration: Long,
permission: McpPermission
)
trait McpAuditLogger {
def logToolExecution(log: McpAuditLog): Unit
}
Rate Limiting¶
case class RateLimitConfig(
requestsPerMinute: Int,
burstSize: Int,
penaltyDuration: FiniteDuration
)
trait RateLimiter {
def checkLimit(apiKey: String): Future[Boolean]
def recordRequest(apiKey: String): Unit
}
Input Validation¶
trait InputValidator {
def validateToolInput(
toolName: String,
input: JValue
): Either[ValidationError, ValidatedInput]
}
// Example: Validate enode URL for peer connection
def validateEnodeUrl(enode: String): Either[String, EnodeUrl] = {
val pattern = "^enode://[a-f0-9]{128}@[0-9.]+:[0-9]+$"
if (enode.matches(pattern)) {
Right(EnodeUrl(enode))
} else {
Left(s"Invalid enode URL format: $enode")
}
}
Security Best Practices¶
- Principle of Least Privilege
- Grant minimum necessary permissions
- Use read-only access when possible
-
Escalate only when required
-
Defense in Depth
- Multiple layers of security
- Authentication + Authorization + Rate Limiting
-
Input validation on all parameters
-
Audit Everything
- Log all MCP operations
- Track permission escalations
-
Monitor for suspicious patterns
-
Secure by Default
- MCP disabled by default
- Require explicit configuration
-
Enforce authentication
-
Fail Closed
- Deny access on auth failures
- Reject invalid inputs
- Default to most restrictive
Implementation Roadmap¶
Overall Timeline: 12-16 weeks¶
Week 1-3 : Phase 1 - Core Node Control
Week 4-5 : Phase 2 - Mining & Block Production
Week 6-7 : Phase 3 - Transaction & Account Management
Week 8-9 : Phase 4 - Network & Peer Management
Week 10-11 : Phase 5 - Advanced Monitoring & Diagnostics
Week 12-13 : Phase 6 - Configuration & Optimization
Week 14-16 : Integration Testing, Documentation, Release
Phase-by-Phase Breakdown¶
Phase 1: Core Node Control (Weeks 1-3)¶
Deliverables: - ✅ Complete actor integration for existing tools - ✅ 8 new tools implemented - ✅ 7 enhanced resources with real data - ✅ Update existing 5 tools with actual queries - ✅ Unit tests for all tools - ✅ Integration tests with actors - ✅ Documentation updates
Key Tasks: 1. Implement actor query patterns 2. Add caching layer for expensive queries 3. Create error handling framework 4. Implement timeout management 5. Add metrics collection 6. Update documentation
Dependencies: None
Phase 2: Mining & Block Production (Weeks 4-5)¶
Deliverables: - ✅ 7 new mining tools - ✅ 4 mining resources - ✅ 2 mining prompts - ✅ Integration with MiningCoordinator - ✅ Mining statistics collection - ✅ Tests and documentation
Key Tasks: 1. Query MiningCoordinator for status 2. Implement mining control operations 3. Add mining statistics tracking 4. Create profitability calculator 5. Add safety checks for mining operations
Dependencies: Phase 1 complete
Phase 3: Transaction & Account Management (Weeks 6-7)¶
Deliverables: - ✅ 8 transaction tools - ✅ 5 transaction resources - ✅ 2 transaction prompts - ✅ Integration with TxPool and Blockchain - ✅ Gas price oracle - ✅ Tests and documentation
Key Tasks: 1. Query TxPool for pending transactions 2. Implement transaction tracing 3. Create gas price estimator 4. Add account history queries 5. Implement contract analysis
Dependencies: Phase 1 complete
Phase 4: Network & Peer Management (Weeks 8-9)¶
Deliverables: - ✅ 10 peer management tools - ✅ 6 network resources - ✅ 3 network prompts - ✅ Integration with PeerManagerActor - ✅ Peer quality scoring - ✅ Tests and documentation
Key Tasks: 1. Query PeerManagerActor for peer data 2. Implement peer connection control 3. Add blacklist management 4. Create peer quality analyzer 5. Implement network topology visualization
Dependencies: Phase 1 complete
Phase 5: Advanced Monitoring & Diagnostics (Weeks 10-11)¶
Deliverables: - ✅ 7 diagnostic tools - ✅ 5 diagnostic resources - ✅ 3 diagnostic prompts - ✅ Automated health checks - ✅ Performance profiling - ✅ Tests and documentation
Key Tasks: 1. Implement comprehensive health checks 2. Add performance profiling 3. Create log analysis tools 4. Implement anomaly detection 5. Add trend analysis
Dependencies: Phases 1-4 complete
Phase 6: Configuration & Optimization (Weeks 12-13)¶
Deliverables: - ✅ 5 configuration tools - ✅ 3 configuration resources - ✅ 2 configuration prompts - ✅ Configuration validation - ✅ Optimization engine - ✅ Tests and documentation
Key Tasks: 1. Implement configuration reader 2. Add validation framework 3. Create optimization recommender 4. Implement capacity planner 5. Add configuration documentation
Dependencies: Phases 1-5 complete
Integration & Release (Weeks 14-16)¶
Deliverables: - ✅ End-to-end testing - ✅ Performance benchmarking - ✅ Security audit - ✅ Complete documentation - ✅ Example agents - ✅ Release notes
Key Tasks: 1. Run comprehensive integration tests 2. Perform security audit 3. Benchmark performance 4. Write user documentation 5. Create example agents 6. Prepare release
Dependencies: All phases complete
Acceptance Criteria¶
Functional Requirements¶
1. Node State Monitoring¶
- ✅ Agent can query real-time node status
- ✅ Agent can access blockchain data
- ✅ Agent can monitor sync progress
- ✅ Agent can view peer connections
- ✅ Agent can access performance metrics
2. Mining Control¶
- ✅ Agent can start mining
- ✅ Agent can stop mining
- ✅ Agent can configure mining parameters
- ✅ Agent can query mining statistics
- ✅ Agent can assess mining profitability
3. Transaction Management¶
- ✅ Agent can query transaction status
- ✅ Agent can monitor pending transactions
- ✅ Agent can estimate gas costs
- ✅ Agent can query account balances
- ✅ Agent can trace transaction execution
4. Peer Management¶
- ✅ Agent can list peers
- ✅ Agent can connect to peers
- ✅ Agent can disconnect from peers
- ✅ Agent can manage blacklist
- ✅ Agent can assess peer quality
5. Diagnostics¶
- ✅ Agent can run health checks
- ✅ Agent can profile performance
- ✅ Agent can detect issues automatically
- ✅ Agent can analyze logs
- ✅ Agent can generate diagnostic reports
6. Configuration¶
- ✅ Agent can read configuration
- ✅ Agent can validate changes
- ✅ Agent can receive recommendations
- ✅ Agent can plan capacity
- ✅ Agent can optimize settings
Non-Functional Requirements¶
1. Performance¶
- ✅ Tool execution time < 5 seconds (95th percentile)
- ✅ Resource read time < 1 second (95th percentile)
- ✅ No significant impact on node performance
- ✅ Efficient caching reduces redundant queries
2. Security¶
- ✅ All operations require authentication
- ✅ Authorization enforced based on permissions
- ✅ All operations are audited
- ✅ Rate limiting prevents abuse
- ✅ Input validation prevents injection attacks
3. Reliability¶
- ✅ 99.9% uptime for MCP endpoints
- ✅ Graceful degradation on component failures
- ✅ Proper error handling and reporting
- ✅ Automatic retry on transient failures
4. Usability¶
- ✅ Clear, comprehensive documentation
- ✅ Self-describing APIs (OpenAPI/JSON Schema)
- ✅ Helpful error messages
- ✅ Example agents provided
- ✅ Integration guides available
5. Maintainability¶
- ✅ Modular architecture
- ✅ Comprehensive test coverage (>80%)
- ✅ Clear code organization
- ✅ Well-documented patterns
- ✅ Easy to add new tools/resources
Integration Requirements¶
1. Backward Compatibility¶
- ✅ Existing RPC endpoints unchanged
- ✅ MCP is opt-in, not required
- ✅ No breaking changes to APIs
- ✅ Smooth upgrade path
2. Infrastructure¶
- ✅ Works with existing HTTP/WebSocket servers
- ✅ Integrates with existing authentication
- ✅ Uses existing logging system
- ✅ Compatible with monitoring systems
3. Documentation¶
- ✅ API reference complete
- ✅ Integration guides written
- ✅ Example code provided
- ✅ Troubleshooting guide available
- ✅ Security best practices documented
Testing Strategy¶
Unit Testing¶
Coverage Target: 85%
Focus Areas: - Tool execution logic - Resource data fetching - Input validation - Error handling - Permission checks
Example:
class NodeStatusToolSpec extends AnyFlatSpec with Matchers {
"NodeStatusTool" should "query actual node state" in {
val peerManager = mock[ActorRef]
val syncController = mock[ActorRef]
when(peerManager ? GetPeerCount).thenReturn(Future.successful(25))
when(syncController ? GetSyncStatus).thenReturn(
Future.successful(SyncStatus(syncing = true, currentBlock = 100, targetBlock = 200))
)
val result = NodeStatusTool.execute(peerManager, syncController).unsafeRunSync()
result should include("peerCount: 25")
result should include("currentBlock: 100")
}
}
Integration Testing¶
Test Scenarios: 1. Tool execution with real actor integration 2. Resource reading with actual blockchain queries 3. End-to-end MCP protocol flows 4. Error propagation and handling 5. Timeout and retry behavior
Example:
class McpIntegrationSpec extends AnyFlatSpec with Matchers {
"MCP Tools" should "integrate with actual node components" in {
val node = TestNode.start()
val mcpService = node.mcpService
// Test node status query
val statusReq = McpToolsCallRequest("mcp_node_status", None)
val statusResult = mcpService.toolsCall(statusReq).unsafeRunSync()
statusResult.isRight shouldBe true
val content = statusResult.right.get.content.head.text
content should include("\"syncing\":")
content should include("\"peerCount\":")
node.stop()
}
}
Performance Testing¶
Benchmarks: - Tool execution latency - Resource read latency - Concurrent request handling - Memory usage under load - Cache effectiveness
Tools: JMH for microbenchmarks, Gatling for load testing
Targets: - p50 latency < 100ms - p95 latency < 1s - p99 latency < 5s - Throughput > 100 req/s per endpoint - Memory overhead < 50MB
Security Testing¶
Test Cases: 1. Authentication bypass attempts 2. Authorization escalation attempts 3. Rate limit enforcement 4. Input injection attempts 5. Parameter tampering 6. Session hijacking 7. Replay attacks
Tools: OWASP ZAP, custom security scanners
End-to-End Testing¶
Test Scenarios: 1. Agent performs health check 2. Agent starts mining 3. Agent manages peers 4. Agent troubleshoots sync issue 5. Agent optimizes configuration
Approach: Scripted agent interactions using MCP SDK
Example:
# E2E test with Python MCP client
from mcp import Client
async def test_health_check_workflow():
client = Client("http://localhost:8545")
# Initialize MCP session
init = await client.initialize()
assert init["protocolVersion"] == "2024-11-05"
# List available tools
tools = await client.list_tools()
assert "mcp_health_check" in [t["name"] for t in tools]
# Run health check
result = await client.call_tool("mcp_health_check", {})
assert result["isError"] is None
health_report = result["content"][0]["text"]
# Parse and validate health report
report = json.loads(health_report)
assert "overall_health" in report
assert "issues" in report
Documentation Requirements¶
1. API Reference Documentation¶
Location: docs/api/MCP_API_REFERENCE.md
Contents: - Complete tool catalog with descriptions - Input/output schemas for each tool - Example requests and responses - Error codes and handling - Resource URI patterns - Prompt templates
Format: Markdown with OpenAPI/JSON Schema snippets
2. Integration Guide¶
Location: docs/api/MCP_INTEGRATION_GUIDE.md
Contents: - Getting started with MCP - Authentication setup - Client SDK examples (Python, TypeScript, Go) - Common use cases - Best practices - Troubleshooting
3. Security Guide¶
Location: docs/api/MCP_SECURITY_GUIDE.md
Contents: - Authentication mechanisms - Authorization model - API key management - Rate limiting configuration - Audit logging setup - Security best practices - Threat model
4. Operational Guide¶
Location: docs/runbooks/MCP_OPERATIONS.md
Contents: - Enabling MCP on node - Configuring permissions - Monitoring MCP usage - Performance tuning - Common issues and solutions - Upgrade procedures
5. Agent Development Guide¶
Location: docs/for-developers/MCP_AGENT_DEVELOPMENT.md
Contents: - Building custom agents - MCP client libraries - Agent design patterns - Example agents (monitoring, auto-miner, health-checker) - Testing agents - Deployment strategies
6. Changelog & Migration Guides¶
Location: CHANGELOG.md and docs/api/MCP_MIGRATION_*.md
Contents: - Version history - Breaking changes - New features - Deprecation notices - Migration guides for major versions
Summary¶
This plan provides a comprehensive roadmap to transform Fukuii's MCP implementation from basic read-only capabilities to full agent-controlled node management. The phased approach ensures:
- Incremental Value Delivery: Each phase delivers usable functionality
- Risk Management: Early phases establish patterns for later phases
- Security First: Authentication and authorization from the start
- Quality Assurance: Comprehensive testing at every phase
- Documentation: Detailed docs enable agent developers
Expected Outcomes: - 45+ new MCP tools covering all critical node operations - 20+ enhanced resources providing real-time data - 15+ prompts guiding agents through complex workflows - Complete agent control over node lifecycle - Secure, auditable, production-ready implementation
Success Metrics: - 85% coverage of production RPC endpoints via MCP - <5s tool execution time (p95) - 100% authentication/authorization enforcement - >80% test coverage - Zero security vulnerabilities - Comprehensive documentation
Document Maintainer: Chippr Robotics LLC
Last Updated: 2025-12-12
Status: Planning Phase - Awaiting Approval for Implementation