feat: Add intelligent auto-router and enhanced integrations

- Add intelligent-router.sh hook for automatic agent routing
- Add AUTO-TRIGGER-SUMMARY.md documentation
- Add FINAL-INTEGRATION-SUMMARY.md documentation
- Complete Prometheus integration (6 commands + 4 tools)
- Complete Dexto integration (12 commands + 5 tools)
- Enhanced Ralph with access to all agents
- Fix /clawd command (removed disable-model-invocation)
- Update hooks.json to v5 with intelligent routing
- 291 total skills now available
- All 21 commands with automatic routing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
admin
2026-01-28 00:27:56 +04:00
Unverified
parent 3b128ba3bd
commit b52318eeae
1724 changed files with 351216 additions and 0 deletions

View File

@@ -0,0 +1,184 @@
# MCP Resources Demo Server
A comprehensive MCP server that demonstrates all three major MCP capabilities: **Resources**, **Prompts**, and **Tools**.
## Purpose
This server provides a complete reference implementation of the Model Context Protocol, demonstrating how to build an MCP server with multiple capabilities. It's used for:
- Testing Dexto's MCP client integration
- Comprehensive integration testing
- Example implementation for building custom MCP servers
## What This Provides
### 1. MCP Resources Capability
Provides structured data resources that can be read by AI assistants.
**Operations:**
- **`resources/list`** - Lists available resources with URIs, names, descriptions, and MIME types
- **`resources/read`** - Reads content of specific resources by URI
**Available Resources:**
1. **Product Metrics Dashboard** (`mcp-demo://product-metrics`)
- JSON data with KPIs, growth metrics, and feature usage
- Content: Business analytics and performance indicators
2. **User Feedback Summary** (`mcp-demo://user-feedback`)
- Markdown format with sentiment analysis and feature requests
- Content: Customer insights and improvement suggestions
3. **System Status Report** (`mcp-demo://system-status`)
- JSON data with infrastructure health and performance metrics
- Content: Service status, uptime, and system monitoring data
### 2. MCP Prompts Capability
Provides reusable prompt templates with argument substitution.
**Operations:**
- **`prompts/list`** - Lists available prompts with descriptions and arguments
- **`prompts/get`** - Retrieves a prompt with argument values substituted
**Available Prompts:**
1. **analyze-metrics** - Analyze product metrics and provide insights
- **Arguments:**
- `metric_type` (required) - Type of metric: users, revenue, or features
- `time_period` (optional) - Time period for analysis (e.g., "Q1 2025")
- **Usage:** Generates analysis prompt for product metrics dashboard
2. **generate-report** - Generate a comprehensive product report
- **Arguments:**
- `report_type` (required) - Type of report: metrics, feedback, or status
- **Usage:** Creates structured report prompt for specified data type
### 3. MCP Tools Capability
Provides executable tools that perform calculations and formatting.
**Operations:**
- **`tools/list`** - Lists available tools with descriptions and schemas
- **`tools/call`** - Executes a tool with provided arguments
**Available Tools:**
1. **calculate-growth-rate** - Calculate growth rate between two metrics
- **Parameters:**
- `current_value` (number, required) - Current metric value
- `previous_value` (number, required) - Previous metric value
- **Returns:** Growth rate percentage, absolute change
2. **format-metric** - Format a metric value with appropriate unit
- **Parameters:**
- `value` (number, required) - Metric value to format
- `unit` (enum, required) - Unit type: `users`, `dollars`, or `percentage`
- **Returns:** Formatted string with proper units and formatting
## Setup
1. Install dependencies:
```bash
cd examples/resources-demo-server
npm install
```
2. Run with Dexto:
```bash
# From project root
dexto --agent ./examples/resources-demo-server/agent.yml
```
## Testing All Capabilities
Try these interactions to test each capability:
### Testing Resources
1. **List Resources**: "What resources are available?"
2. **Read Specific Resource**: "Show me the product metrics data"
3. **Analyze Content**: "What does the user feedback summary say?"
4. **System Information**: "Check the current system status"
### Testing Prompts
1. **List Prompts**: "What prompts are available?"
2. **Use Prompt with Args**: "Use the analyze-metrics prompt for revenue in Q4 2024"
3. **Generate Report**: "Use generate-report to create a metrics summary"
### Testing Tools
1. **List Tools**: "What tools are available?"
2. **Calculate Growth**: "Use calculate-growth-rate with current value 1500 and previous value 1200"
3. **Format Metrics**: "Format the value 125000 as users"
## Expected Behavior
✅ **With All Capabilities Working:**
- Dexto connects to the MCP server successfully
- **Resources:** ResourceManager.listAllResources() returns 3 resources with URIs like `mcp:resources-demo:mcp-demo://product-metrics`
- **Prompts:** MCPManager.getAllPromptMetadata() returns 2 prompts (analyze-metrics, generate-report)
- **Tools:** MCPManager.getAllTools() returns 2 tools (calculate-growth-rate, format-metric)
- All capabilities are cached and accessible without network calls after initial connection
❌ **If MCP Integration Not Working:**
- Server connection fails during startup
- Capabilities are not discovered or cached
- Resource/prompt/tool operations return errors
## Technical Details
This server demonstrates the complete MCP protocol implementation:
1. **Server Side Implementation**:
- **Resources**: Implements `resources/list` and `resources/read` handlers
- **Prompts**: Implements `prompts/list` and `prompts/get` handlers with argument substitution
- **Tools**: Implements `tools/list` and `tools/call` handlers with schema validation
- Returns structured data with proper MIME types and schemas
- Uses standard MCP SDK patterns from `@modelcontextprotocol/sdk`
2. **Client Side** (Dexto):
- **MCPManager**: Discovers and caches all capabilities from the server
- **ResourceManager**: Aggregates MCP resources with qualified URIs
- **PromptManager**: Manages prompt templates and argument substitution
- **ToolManager**: Executes MCP tools with proper error handling
- All capabilities are cached for performance (no network calls after initial discovery)
3. **Integration Testing**:
- Comprehensive integration tests in `packages/core/src/mcp/manager.integration.test.ts`
- Tests verify resources, prompts, and tools all work together
- Validates caching behavior and multi-server coordination
## Architecture
```text
┌─────────────────────────────────────────────────────┐
│ Dexto Client │
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────┐ │
│ │ResourceManager│ │PromptManager│ │MCPManager│ │
│ └──────┬───────┘ └──────┬───────┘ └────┬─────┘ │
│ │ │ │ │
│ └─────────────────┴────────────────┘ │
│ MCPClient │
└─────────────────────┬───────────────────────────────┘
│ MCP Protocol (stdio)
│ - resources/*
│ - prompts/*
│ - tools/*
┌─────────────────────────────────────────────────────┐
│ Resources Demo Server (Node.js) │
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────┐ │
│ │ Resources │ │ Prompts │ │ Tools │ │
│ │ (3 items) │ │ (2 items) │ │(2 items) │ │
│ └──────────────┘ └──────────────┘ └──────────┘ │
└─────────────────────────────────────────────────────┘
```
## Use Cases
This server validates that Dexto can:
- ✅ Connect to external MCP servers via stdio transport
- ✅ Discover and cache multiple capability types
- ✅ Handle resources with custom URI schemes
- ✅ Execute prompts with argument substitution
- ✅ Call tools with schema validation
- ✅ Coordinate multiple MCP servers simultaneously
- ✅ Provide zero-latency access after caching

View File

@@ -0,0 +1,30 @@
# MCP Resources Demo Agent Configuration
# This agent demonstrates MCP Resources capability from external server
# MCP Servers configuration
mcpServers:
resources-demo:
type: stdio
command: node
args:
- "${{dexto.agent_dir}}/server.js"
timeout: 30000
connectionMode: lenient
# LLM configuration
llm:
provider: openai
model: gpt-5-mini
apiKey: $OPENAI_API_KEY
# System prompt configuration
systemPrompt:
contributors:
- id: primary
type: static
priority: 0
content: |
You are a helpful assistant.
# Optional greeting
greeting: "Hello! I'm connected to an MCP server that provides Resources. Ask me about product metrics, user feedback, or system status to see MCP Resources in action!"

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,15 @@
{
"name": "resources-demo-server",
"version": "1.0.0",
"description": "MCP server demonstrating Resources capability",
"type": "module",
"main": "server.js",
"scripts": {
"start": "node server.js"
},
"dependencies": {
"@modelcontextprotocol/sdk": "^1.25.2"
},
"keywords": ["mcp", "resources", "demo"],
"license": "MIT"
}

View File

@@ -0,0 +1,717 @@
#!/usr/bin/env node
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
import {
ListResourcesRequestSchema,
ReadResourceRequestSchema,
ListPromptsRequestSchema,
GetPromptRequestSchema,
ListToolsRequestSchema,
CallToolRequestSchema
} from '@modelcontextprotocol/sdk/types.js';
class ResourcesDemoServer {
constructor() {
this.server = new Server(
{
name: 'resources-demo-server',
version: '1.0.0',
},
{
capabilities: {
resources: {},
prompts: {},
tools: {},
},
}
);
this.setupHandlers();
}
setupHandlers() {
// Handle resources/list requests
this.server.setRequestHandler(ListResourcesRequestSchema, async () => {
try {
console.error(`📋 MCP Resources: Listing available resources`);
const resources = [
{
uri: 'mcp-demo://product-metrics',
name: 'Product Metrics Dashboard',
description: 'Key performance indicators and product analytics',
mimeType: 'application/json',
},
{
uri: 'mcp-demo://user-feedback',
name: 'User Feedback Summary',
description: 'Customer feedback analysis and insights',
mimeType: 'text/markdown',
},
{
uri: 'mcp-demo://system-status',
name: 'System Status Report',
description: 'Current system health and performance metrics',
mimeType: 'application/json',
},
];
return {
resources: resources,
};
} catch (error) {
console.error(`Error listing MCP resources: ${error.message}`);
return {
resources: [],
};
}
});
// Handle resources/read requests
this.server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
try {
const { uri } = request.params;
console.error(`📖 MCP Resources: Reading resource ${uri}`);
const content = await this.getResourceContent(uri);
return {
contents: [content],
};
} catch (error) {
console.error(`Error reading MCP resource ${request.params.uri}: ${error.message}`);
throw new Error(`Failed to read resource: ${error.message}`);
}
});
// Handle prompts/list requests
this.server.setRequestHandler(ListPromptsRequestSchema, async () => {
try {
console.error(`📝 MCP Prompts: Listing available prompts`);
const prompts = [
{
name: 'analyze-metrics',
description: 'Analyze product metrics and provide insights',
arguments: [
{
name: 'metric_type',
description: 'Type of metric to analyze (users, revenue, features)',
required: true,
},
{
name: 'time_period',
description: 'Time period for analysis (e.g., "Q4 2024")',
required: false,
},
],
},
{
name: 'generate-report',
description: 'Generate a comprehensive product report',
arguments: [
{
name: 'report_type',
description: 'Type of report (metrics, feedback, status)',
required: true,
},
],
},
{
name: 'deep-dive-analysis',
description: 'Perform deep analysis with linked reference data (demonstrates resource_link)',
arguments: [
{
name: 'focus',
description: 'Analysis focus area (growth, satisfaction, operations)',
required: false,
},
],
},
];
return {
prompts: prompts,
};
} catch (error) {
console.error(`Error listing MCP prompts: ${error.message}`);
return {
prompts: [],
};
}
});
// Handle prompts/get requests
this.server.setRequestHandler(GetPromptRequestSchema, async (request) => {
try {
const { name, arguments: args } = request.params;
console.error(`📖 MCP Prompts: Reading prompt ${name}`);
const promptContent = await this.getPromptContent(name, args);
return {
messages: promptContent,
};
} catch (error) {
console.error(`Error reading MCP prompt ${request.params.name}: ${error.message}`);
throw new Error(`Failed to read prompt: ${error.message}`);
}
});
// Handle tools/list requests
this.server.setRequestHandler(ListToolsRequestSchema, async () => {
try {
console.error(`🔧 MCP Tools: Listing available tools`);
const tools = [
{
name: 'calculate-growth-rate',
description: 'Calculate growth rate between two metrics',
inputSchema: {
type: 'object',
properties: {
current_value: {
type: 'number',
description: 'Current metric value',
},
previous_value: {
type: 'number',
description: 'Previous metric value',
},
},
required: ['current_value', 'previous_value'],
},
},
{
name: 'format-metric',
description: 'Format a metric value with appropriate unit',
inputSchema: {
type: 'object',
properties: {
value: {
type: 'number',
description: 'Metric value to format',
},
unit: {
type: 'string',
description: 'Unit type (users, dollars, percentage)',
enum: ['users', 'dollars', 'percentage'],
},
},
required: ['value', 'unit'],
},
},
];
return {
tools: tools,
};
} catch (error) {
console.error(`Error listing MCP tools: ${error.message}`);
return {
tools: [],
};
}
});
// Handle tools/call requests
this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
try {
const { name, arguments: args } = request.params;
console.error(`⚙️ MCP Tools: Calling tool ${name}`);
const result = await this.callTool(name, args);
return {
content: [
{
type: 'text',
text: JSON.stringify(result, null, 2),
},
],
};
} catch (error) {
console.error(`Error calling MCP tool ${request.params.name}: ${error.message}`);
throw new Error(`Failed to call tool: ${error.message}`);
}
});
}
async getResourceContent(uri) {
switch (uri) {
case 'mcp-demo://product-metrics':
return {
uri: uri,
mimeType: 'application/json',
text: JSON.stringify({
"dashboard": "Product Metrics",
"period": "Q4 2024",
"metrics": {
"monthly_active_users": 125000,
"daily_active_users": 45000,
"conversion_rate": 3.2,
"churn_rate": 2.1,
"customer_satisfaction": 4.6,
"net_promoter_score": 72
},
"growth": {
"user_growth_rate": 15.3,
"revenue_growth_rate": 22.1,
"feature_adoption_rate": 68.4
},
"top_features": [
{
"name": "Analytics Dashboard",
"usage_percentage": 89.2,
"satisfaction": 4.7
},
{
"name": "Mobile App",
"usage_percentage": 76.5,
"satisfaction": 4.4
},
{
"name": "API Integration",
"usage_percentage": 45.8,
"satisfaction": 4.5
}
],
"geographic_data": {
"north_america": 45,
"europe": 32,
"asia_pacific": 18,
"other": 5
},
"last_updated": "2024-12-15T10:30:00Z"
}, null, 2),
};
case 'mcp-demo://user-feedback':
return {
uri: uri,
mimeType: 'text/markdown',
text: `# User Feedback Summary - December 2024
## Overall Sentiment Analysis
- **Positive**: 78% (up from 72% last month)
- **Neutral**: 15%
- **Negative**: 7% (down from 11% last month)
## Top Positive Feedback Themes
### 1. User Interface Improvements (42% of positive feedback)
> "The new dashboard is so much cleaner and easier to navigate. Finding what I need takes half the time now."
> "Love the dark mode option! Finally my eyes don't hurt during late-night work sessions."
### 2. Performance Enhancements (31% of positive feedback)
> "The app loads so much faster now. What used to take 10 seconds now happens instantly."
> "Mobile app performance is night and day better. No more freezing or crashes."
### 3. New Feature Adoption (27% of positive feedback)
> "The AI-powered suggestions are spot on. It's like the app reads my mind."
> "Export functionality is exactly what we needed for our quarterly reports."
## Areas for Improvement
### 1. Search Functionality (38% of suggestions)
- Users want more advanced filtering options
- Request for saved search presets
- Need better search result relevance
### 2. Mobile Experience (31% of suggestions)
- Offline mode for key features
- Better handling of poor network conditions
- More gestures and shortcuts
### 3. Integration Capabilities (31% of suggestions)
- More third-party app connections
- Better API documentation
- Webhook support for real-time updates
## Feature Requests by Priority
| Feature | Votes | Priority | Est. Effort |
|---------|-------|----------|-------------|
| Advanced Search Filters | 234 | High | 3 weeks |
| Offline Mobile Mode | 187 | High | 5 weeks |
| Slack Integration | 156 | Medium | 2 weeks |
| Custom Dashboard Widgets | 143 | Medium | 4 weeks |
| Bulk Operations | 98 | Low | 6 weeks |
## Customer Support Insights
- Average response time: 4.2 hours (target: <4 hours) ✅
- First contact resolution: 67% (target: 70%) ⚠️
- Customer satisfaction with support: 4.4/5.0 ✅
## Recommended Actions
1. **Immediate (Next Sprint)**
- Implement basic search filtering
- Fix remaining mobile performance issues
2. **Short-term (Next Month)**
- Develop offline mode MVP
- Begin Slack integration development
3. **Medium-term (Q1 2025)**
- Launch custom dashboard features
- Expand integration marketplace
## Competitive Analysis Insights
Users comparing us to competitors highlighted:
- **Strengths**: Ease of use, customer support, pricing
- **Gaps**: Advanced analytics, enterprise features, mobile capabilities
*Report generated on December 15, 2024*`,
};
case 'mcp-demo://system-status':
return {
uri: uri,
mimeType: 'application/json',
text: JSON.stringify({
"status": "operational",
"last_updated": "2024-12-15T14:45:00Z",
"uptime_percentage": 99.8,
"services": {
"api_gateway": {
"status": "operational",
"response_time_ms": 85,
"error_rate": 0.002,
"requests_per_minute": 1250
},
"database": {
"status": "operational",
"connection_pool_usage": 0.45,
"query_performance_ms": 12,
"active_connections": 67
},
"cache_layer": {
"status": "operational",
"hit_rate": 0.94,
"memory_usage": 0.72,
"keys_count": 245000
},
"file_storage": {
"status": "operational",
"storage_usage": 0.68,
"upload_speed_mbps": 125,
"download_speed_mbps": 180
},
"background_jobs": {
"status": "operational",
"queue_size": 23,
"processing_rate_per_minute": 450,
"failed_jobs_last_hour": 2
}
},
"infrastructure": {
"servers": {
"web_servers": 4,
"api_servers": 6,
"database_servers": 2,
"cache_servers": 3
},
"load_balancer": {
"status": "healthy",
"active_connections": 1850,
"ssl_termination": "enabled"
},
"cdn": {
"status": "operational",
"cache_hit_ratio": 0.89,
"global_edge_locations": 45
}
},
"security": {
"ssl_certificate": {
"status": "valid",
"expires": "2025-03-15T00:00:00Z"
},
"firewall": {
"status": "active",
"blocked_requests_last_hour": 127
},
"ddos_protection": {
"status": "active",
"threats_mitigated": 5
}
},
"recent_incidents": [],
"scheduled_maintenance": {
"next_window": "2024-12-22T02:00:00Z",
"duration_hours": 2,
"description": "Database optimization and index rebuilding"
}
}, null, 2),
};
default:
throw new Error(`Unknown resource URI: ${uri}`);
}
}
async getPromptContent(name, args = {}) {
switch (name) {
case 'analyze-metrics': {
const metricType = args.metric_type || 'users';
const timePeriod = args.time_period || 'Q4 2024';
// Fetch the resource content to embed
const resourceContent = await this.getResourceContent('mcp-demo://product-metrics');
// Return multiple messages, each with a single content block
// This is spec-compliant: PromptMessage.content must be a single ContentBlock
return [
{
role: 'user',
content: {
type: 'text',
text: `Please analyze the ${metricType} metrics for ${timePeriod}.
Consider:
1. Current trends and patterns
2. Growth or decline rates
3. Key insights and recommendations
4. Areas of concern or opportunity`,
},
},
{
role: 'user',
content: {
type: 'resource',
resource: {
uri: resourceContent.uri,
mimeType: resourceContent.mimeType,
text: resourceContent.text,
},
},
},
];
}
case 'generate-report': {
const reportType = args.report_type || 'metrics';
let resourceUri;
switch (reportType) {
case 'metrics':
resourceUri = 'mcp-demo://product-metrics';
break;
case 'feedback':
resourceUri = 'mcp-demo://user-feedback';
break;
case 'status':
resourceUri = 'mcp-demo://system-status';
break;
default:
resourceUri = 'mcp-demo://product-metrics';
}
// Fetch the resource content to embed
const resourceContent = await this.getResourceContent(resourceUri);
// Return multiple messages, each with a single content block
// This is spec-compliant: PromptMessage.content must be a single ContentBlock
return [
{
role: 'user',
content: {
type: 'text',
text: `Generate a comprehensive ${reportType} report.
Include:
- Executive summary
- Key findings
- Data visualization suggestions
- Actionable recommendations`,
},
},
{
role: 'user',
content: {
type: 'resource',
resource: {
uri: resourceContent.uri,
mimeType: resourceContent.mimeType,
text: resourceContent.text,
},
},
},
];
}
case 'deep-dive-analysis': {
const focus = args.focus || 'growth';
// Define analysis based on focus area
let analysisPrompt;
let relevantResources = [];
switch (focus) {
case 'growth':
analysisPrompt = `Conduct a comprehensive growth analysis:
1. Analyze user acquisition and retention trends from the metrics
2. Identify growth drivers and potential bottlenecks
3. Cross-reference user feedback to understand growth quality
4. Evaluate system capacity for scaling
Reference the linked data sources below and provide:
- Growth trajectory analysis with key inflection points
- User sentiment correlation with growth metrics
- Infrastructure readiness assessment
- Actionable growth recommendations for next quarter`;
relevantResources = [
'mcp-demo://product-metrics',
'mcp-demo://user-feedback',
'mcp-demo://system-status',
];
break;
case 'satisfaction':
analysisPrompt = `Perform deep customer satisfaction analysis:
1. Examine satisfaction scores and NPS trends in metrics
2. Analyze qualitative feedback themes and sentiment
3. Correlate feature usage with satisfaction levels
4. Assess support team performance impact
Reference the linked data sources below and provide:
- Satisfaction trend analysis with root causes
- Feature satisfaction breakdown
- Critical improvement areas ranked by impact
- Customer retention risk assessment`;
relevantResources = [
'mcp-demo://product-metrics',
'mcp-demo://user-feedback',
];
break;
case 'operations':
analysisPrompt = `Analyze operational health and performance:
1. Review system performance metrics and uptime
2. Assess infrastructure capacity and efficiency
3. Identify operational risks and bottlenecks
4. Evaluate technical debt and maintenance needs
Reference the linked data sources below and provide:
- System health score with risk factors
- Performance optimization opportunities
- Capacity planning recommendations
- Incident prevention strategies`;
relevantResources = [
'mcp-demo://system-status',
'mcp-demo://product-metrics',
];
break;
default:
// Default to growth analysis
analysisPrompt = `Conduct a comprehensive growth analysis with available data sources.`;
relevantResources = [
'mcp-demo://product-metrics',
'mcp-demo://user-feedback',
'mcp-demo://system-status',
];
}
// Build resource reference links using @<uri> syntax
// This demonstrates the difference from embedded resources:
// - Embedded resources (type: 'resource'): Content included directly in prompt
// - Resource references (@<uri>): Pointers that UI/client can fetch separately
// - Use references when you have multiple large data sources
const resourceRefs = relevantResources.map(uri => `@<${uri}>`).join('\n');
const fullPrompt = `${analysisPrompt}
Data sources for analysis:
${resourceRefs}`;
// Return single message with text content including @<uri> references
return [
{
role: 'user',
content: {
type: 'text',
text: fullPrompt,
},
},
];
}
default:
throw new Error(`Unknown prompt: ${name}`);
}
}
async callTool(name, args = {}) {
switch (name) {
case 'calculate-growth-rate': {
const { current_value, previous_value } = args;
if (previous_value === 0) {
return {
growth_rate: null,
error: 'Cannot calculate growth rate with zero previous value',
};
}
const growthRate = ((current_value - previous_value) / previous_value) * 100;
return {
growth_rate: growthRate.toFixed(2) + '%',
current_value,
previous_value,
absolute_change: current_value - previous_value,
};
}
case 'format-metric': {
const { value, unit } = args;
let formatted;
switch (unit) {
case 'users':
formatted = value.toLocaleString() + ' users';
break;
case 'dollars':
formatted = '$' + value.toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
break;
case 'percentage':
formatted = value.toFixed(1) + '%';
break;
default:
formatted = value.toString();
}
return {
formatted_value: formatted,
raw_value: value,
unit: unit,
};
}
default:
throw new Error(`Unknown tool: ${name}`);
}
}
async start() {
const transport = new StdioServerTransport();
await this.server.connect(transport);
console.error('🚀 MCP Resources Demo Server started');
console.error('📋 Capabilities: Resources, Prompts, Tools');
console.error('🔄 Operations: resources/*, prompts/*, tools/*');
console.error('💡 Comprehensive demo of MCP protocol features');
}
}
// Start the server
const server = new ResourcesDemoServer();
server.start().catch(error => {
console.error('Failed to start server:', error);
process.exit(1);
});