-
-
{{ metrics.totalServers }}
-
Total Servers
+
+
+
+
{{ data.totalItems }}
+
Total Items
-
-
-
{{ metrics.activeDeployments }}
-
Active Deployments
+
+
+
{{ data.activeItems }}
+
Active Items
-
-
-
{{ metrics.totalRequests.toLocaleString() }}
-
Total Requests
+
+
+
{{ data.totalRequests.toLocaleString() }}
+
Total Requests
@@ -159,71 +158,56 @@ onMounted(() => {
Create the main plugin file:
```typescript
-// src/plugins/mcp-metrics-plugin/index.ts
+// src/plugins/my-custom-plugin/index.ts
import type { Plugin } from '@/plugin-system/types'
import type { App } from 'vue'
import type { Router } from 'vue-router'
import type { Pinia } from 'pinia'
import { registerExtensionPoint } from '@/plugin-system/extension-points'
-import MetricsWidget from './components/MetricsWidget.vue'
-import MetricsPage from './views/MetricsPage.vue'
+import CustomWidget from './components/CustomWidget.vue'
+import CustomPage from './views/CustomPage.vue'
-class McpMetricsPlugin implements Plugin {
+class MyCustomPlugin implements Plugin {
meta = {
- id: 'mcp-metrics-plugin',
- name: 'MCP Metrics Plugin',
+ id: 'my-custom-plugin',
+ name: 'My Custom Plugin',
version: '1.0.0',
- description: 'Provides comprehensive metrics and analytics for MCP server deployments',
- author: 'DeployStack Team'
+ description: 'Provides custom functionality and widgets for the application',
+ author: 'Your Name'
}
- async initialize(app: App, router: Router, pinia: Pinia) {
- console.log('Initializing MCP Metrics Plugin...')
+ initialize(app: App, router: Router, pinia: Pinia) {
+ console.log('Initializing My Custom Plugin...')
- // Register the metrics widget in the dashboard
- registerExtensionPoint('dashboard-widgets', MetricsWidget, this.meta.id, {
+ // Register the widget at an extension point
+ registerExtensionPoint('dashboard-widgets', CustomWidget, this.meta.id, {
order: 10, // Show early in the dashboard
props: {
refreshInterval: 30000 // Refresh every 30 seconds
}
})
- // Register a dedicated metrics page
+ // Register a dedicated page route
router.addRoute({
- path: '/metrics',
- name: 'Metrics',
- component: MetricsPage,
+ path: '/custom',
+ name: 'Custom',
+ component: CustomPage,
meta: {
- title: 'MCP Metrics',
+ title: 'Custom Plugin',
requiresAuth: true
}
})
- // Add navigation item (if supported by your app)
- registerExtensionPoint('main-navigation', {
- template: `
-
-
- Metrics
-
- `,
- components: { BarChart: () => import('lucide-vue-next').then(m => m.BarChart) }
- }, this.meta.id)
-
- console.log('MCP Metrics Plugin initialized successfully')
+ console.log('My Custom Plugin initialized successfully')
}
- async cleanup() {
- console.log('Cleaning up MCP Metrics Plugin...')
- // Perform any necessary cleanup
+ cleanup() {
+ console.log('Cleaning up My Custom Plugin...')
// Extension points are automatically cleaned up by the plugin manager
}
}
-export default McpMetricsPlugin
+export default MyCustomPlugin
```
### 4. Create a Dedicated Page
@@ -231,126 +215,44 @@ export default McpMetricsPlugin
Create a full page view for your plugin:
```vue
-
-
-
-
-
-
- MCP Server Metrics
+
+
+
+
+ {{ pageData.title }}
-
- Comprehensive analytics and performance metrics for your MCP server deployments
+
+ {{ pageData.description }}
-
-
-
-
-
-
-
-
-
-
-
-
{{ detailedMetrics.responseTime }}
-
Avg Response Time
-
-
-
-
-
-
-
-
-
{{ detailedMetrics.uptime }}
-
Uptime
-
-
-
-
-
-
-
-
-
{{ detailedMetrics.errorRate }}
-
Error Rate
-
-
-
-
-
-
-
-
-
{{ detailedMetrics.throughput }}
-
Throughput
-
-
-
+
+
+
-
-
-
24-Hour Request Pattern
-
-
-
-
+
+
+
+
+ Plugin Settings
+
+
+ This is where you could add plugin-specific settings and configuration options.
+
@@ -361,115 +263,69 @@ onMounted(() => {
Create a Pinia store for your plugin:
```typescript
-// src/plugins/mcp-metrics-plugin/store.ts
+// src/plugins/my-custom-plugin/store.ts
import { defineStore } from 'pinia'
import { ref, computed } from 'vue'
-export interface MetricsData {
- totalServers: number
- activeDeployments: number
+export interface CustomData {
+ totalItems: number
+ activeItems: number
totalRequests: number
- responseTime: string
- uptime: string
- errorRate: string
- throughput: string
-}
-
-export interface ChartDataPoint {
- hour: number
- requests: number
- errors: number
}
-export const useMetricsStore = defineStore('mcp-metrics', () => {
+export const useCustomStore = defineStore('my-custom-plugin', () => {
// State
- const metrics = ref
({
- totalServers: 0,
- activeDeployments: 0,
- totalRequests: 0,
- responseTime: '0ms',
- uptime: '0%',
- errorRate: '0%',
- throughput: '0 req/min'
+ const data = ref({
+ totalItems: 0,
+ activeItems: 0,
+ totalRequests: 0
})
- const chartData = ref([])
const isLoading = ref(false)
const lastUpdated = ref(null)
// Getters
- const healthScore = computed(() => {
- const uptimePercent = parseFloat(metrics.value.uptime.replace('%', ''))
- const errorPercent = parseFloat(metrics.value.errorRate.replace('%', ''))
- return Math.max(0, 100 - errorPercent * 10) * (uptimePercent / 100)
+ const activePercentage = computed(() => {
+ if (data.value.totalItems === 0) return 0
+ return Math.round((data.value.activeItems / data.value.totalItems) * 100)
})
- const isHealthy = computed(() => healthScore.value > 80)
+ const isHealthy = computed(() => activePercentage.value > 80)
// Actions
- async function fetchMetrics() {
+ async function fetchData() {
isLoading.value = true
try {
// Simulate API call
await new Promise(resolve => setTimeout(resolve, 1000))
- metrics.value = {
- totalServers: Math.floor(Math.random() * 20) + 10,
- activeDeployments: Math.floor(Math.random() * 15) + 5,
- totalRequests: Math.floor(Math.random() * 5000) + 1000,
- responseTime: `${Math.floor(Math.random() * 200) + 50}ms`,
- uptime: `${(99 + Math.random()).toFixed(1)}%`,
- errorRate: `${(Math.random() * 2).toFixed(1)}%`,
- throughput: `${(Math.random() * 2 + 0.5).toFixed(1)}k req/min`
+ data.value = {
+ totalItems: Math.floor(Math.random() * 20) + 10,
+ activeItems: Math.floor(Math.random() * 15) + 5,
+ totalRequests: Math.floor(Math.random() * 5000) + 1000
}
lastUpdated.value = new Date()
} catch (error) {
- console.error('Failed to fetch metrics:', error)
+ console.error('Failed to fetch data:', error)
throw error
} finally {
isLoading.value = false
}
}
- async function fetchChartData() {
- try {
- // Simulate API call for chart data
- await new Promise(resolve => setTimeout(resolve, 800))
-
- chartData.value = Array.from({ length: 24 }, (_, i) => ({
- hour: i,
- requests: Math.floor(Math.random() * 100) + 50,
- errors: Math.floor(Math.random() * 5)
- }))
- } catch (error) {
- console.error('Failed to fetch chart data:', error)
- throw error
- }
- }
-
- function refreshAllData() {
- return Promise.all([
- fetchMetrics(),
- fetchChartData()
- ])
- }
-
return {
// State
- metrics,
- chartData,
+ data,
isLoading,
lastUpdated,
// Getters
- healthScore,
+ activePercentage,
isHealthy,
// Actions
- fetchMetrics,
- fetchChartData,
- refreshAllData
+ fetchData
}
})
```
@@ -485,22 +341,22 @@ Add extension points to your main application components:
```vue
-