Skip to content

Commit c4cfc52

Browse files
committed
feat: Add configuration management endpoints and UI integration
- Introduced API endpoints for retrieving, validating, and applying configurations. - Enhanced the Settings.vue component with a configuration editor using vue-monaco-editor for JSON editing. - Implemented validation error handling and display for configuration changes. - Added support for hot-reloading configuration changes without server restarts for certain fields. - Updated internal data structures to support configuration management. This feature improves the flexibility and usability of configuration management within the MCPProxy.
1 parent 758f8a4 commit c4cfc52

17 files changed

Lines changed: 1631 additions & 4 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,4 +111,5 @@ build-info.json
111111
.gocache/
112112
mcpproxy-tray
113113
config.db.backup.*
114-
node_modules/
114+
node_modules/
115+
certs/

frontend/package-lock.json

Lines changed: 52 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,18 @@
1313
"test:ui": "vitest --ui",
1414
"coverage": "vitest run --coverage"
1515
},
16-
"keywords": ["mcpproxy", "vue", "typescript", "daisyui", "control-panel"],
16+
"keywords": [
17+
"mcpproxy",
18+
"vue",
19+
"typescript",
20+
"daisyui",
21+
"control-panel"
22+
],
1723
"author": "",
1824
"license": "ISC",
1925
"dependencies": {
26+
"@guolao/vue-monaco-editor": "^1.5.5",
27+
"monaco-editor": "^0.53.0",
2028
"pinia": "^2.3.1",
2129
"vue": "^3.5.21",
2230
"vue-router": "^4.5.1"

frontend/src/services/api.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { APIResponse, Server, Tool, SearchResult, StatusUpdate, SecretRef, MigrationAnalysis, ConfigSecretsResponse, GetToolCallsResponse, GetToolCallDetailResponse, GetServerToolCallsResponse } from '@/types'
1+
import type { APIResponse, Server, Tool, SearchResult, StatusUpdate, SecretRef, MigrationAnalysis, ConfigSecretsResponse, GetToolCallsResponse, GetToolCallDetailResponse, GetServerToolCallsResponse, GetConfigResponse, ValidateConfigResponse, ConfigApplyResult } from '@/types'
22

33
// Event types for API service
44
export interface APIAuthEvent {
@@ -347,6 +347,25 @@ class APIService {
347347
return this.request<GetServerToolCallsResponse>(url)
348348
}
349349

350+
// Configuration management endpoints
351+
async getConfig(): Promise<APIResponse<GetConfigResponse>> {
352+
return this.request<GetConfigResponse>('/api/v1/config')
353+
}
354+
355+
async validateConfig(config: any): Promise<APIResponse<ValidateConfigResponse>> {
356+
return this.request<ValidateConfigResponse>('/api/v1/config/validate', {
357+
method: 'POST',
358+
body: JSON.stringify(config)
359+
})
360+
}
361+
362+
async applyConfig(config: any): Promise<APIResponse<ConfigApplyResult>> {
363+
return this.request<ConfigApplyResult>('/api/v1/config/apply', {
364+
method: 'POST',
365+
body: JSON.stringify(config)
366+
})
367+
}
368+
350369
// Utility methods
351370
async testConnection(): Promise<boolean> {
352371
try {

frontend/src/types/api.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,37 @@ export interface GetServerToolCallsResponse {
130130
server_name: string
131131
tool_calls: ToolCallRecord[]
132132
total: number
133+
}
134+
135+
// Configuration management types
136+
export interface ValidationError {
137+
field: string
138+
message: string
139+
}
140+
141+
export interface ConfigApplyResult {
142+
success: boolean
143+
applied_immediately: boolean
144+
requires_restart: boolean
145+
restart_reason?: string
146+
validation_errors?: ValidationError[]
147+
changed_fields?: string[]
148+
}
149+
150+
export interface GetConfigResponse {
151+
config: any // The full configuration object
152+
config_path: string
153+
}
154+
155+
export interface ValidateConfigRequest {
156+
config: any
157+
}
158+
159+
export interface ValidateConfigResponse {
160+
valid: boolean
161+
errors?: ValidationError[]
162+
}
163+
164+
export interface ApplyConfigRequest {
165+
config: any
133166
}

0 commit comments

Comments
 (0)