feat(mcp): add Panel MCP task configuration and website binding structures (#14229)

* feat(mcp): add Panel MCP task configuration and website binding structures

* fix(mcp): correct variable assignment in mcpWebsiteDomain function
This commit is contained in:
蘭
2026-10-28 14:04:38 +08:00
committed by GitHub
parent 8684a26459
commit d32cbb40f6
105 changed files with 5407 additions and 817 deletions
+48
View File
@@ -96,12 +96,60 @@ export namespace PanelMCP {
endpoint: string;
internalEndpoint: string;
canManageService: boolean;
installing: boolean;
installTaskID: string;
website?: WebsiteBinding;
}
export interface WebsiteDraft {
requested: boolean;
domain: string;
enableSSL: boolean;
sslID: number;
}
export interface WebsitePendingRequest {
operation: 'bind' | 'update' | 'unbind';
requestId: string;
domain?: string;
enableSSL?: boolean;
sslID?: number;
}
export interface WebsiteBinding {
state: 'unbound' | 'pending' | 'bound' | 'unavailable';
websiteId: number;
domain: string;
endpoint: string;
sslID: number;
enableSSL: boolean;
websiteStatus: string;
requestId: string;
revision: number;
reason?: string;
pendingRequest?: WebsitePendingRequest;
}
export interface WebsiteMutation {
requestId: string;
revision: number;
}
export interface WebsiteBind extends WebsiteMutation {
domain: string;
enableSSL: boolean;
sslID: number;
}
export interface WebsiteUpdate extends WebsiteMutation {
enableSSL: boolean;
sslID: number;
}
export interface Installation {
dockerImage: string;
listenPort: number;
externalUrl: string;
revision: number;
accessPolicy: Settings['accessPolicy'];
allowedIPs: string[];
website?: Pick<WebsiteDraft, 'domain' | 'enableSSL' | 'sslID'>;
}
export interface InstallationTask {
taskID: string;
}
export type Operation = 'start' | 'stop' | 'restart';
export interface Invocation {
+13 -1
View File
@@ -1,18 +1,28 @@
import http from '@/api';
import type { ReqPage, ResPage } from '@/api/interface';
import type { PanelMCP } from '@/api/interface/panel-mcp';
import type { Container } from '@/api/interface/container';
const prefix = '/core/mcp';
const local = { headers: { CurrentNode: 'local' } };
export const getPanelMCPStatus = () => http.get<PanelMCP.ServiceStatus>(`${prefix}/status`, {}, local);
export const getPanelMCPDockerStatus = () =>
http.get<Container.DockerStatus>('/containers/docker/status', {}, { ...local, timeout: 5000 });
export const getPanelMCPSettings = () => http.get<PanelMCP.Settings>(`${prefix}/settings`, {}, local);
export const getPanelMCPWebsite = () => http.get<PanelMCP.WebsiteBinding>(`${prefix}/website/status`, {}, local);
export const bindPanelMCPWebsite = (params: PanelMCP.WebsiteBind) =>
http.postWithConfig<PanelMCP.WebsiteBinding>(`${prefix}/website/bind`, params, { ...local, timeout: 120000 });
export const updatePanelMCPWebsite = (params: PanelMCP.WebsiteUpdate) =>
http.postWithConfig<PanelMCP.WebsiteBinding>(`${prefix}/website/update`, params, { ...local, timeout: 120000 });
export const unbindPanelMCPWebsite = (params: PanelMCP.WebsiteMutation) =>
http.postWithConfig<PanelMCP.WebsiteBinding>(`${prefix}/website/unbind`, params, { ...local, timeout: 120000 });
export const savePanelMCPSettings = (params: PanelMCP.Settings) =>
http.postWithConfig(`${prefix}/settings`, params, { ...local, timeout: 60000 });
export const operatePanelMCPService = (operation: PanelMCP.Operation) =>
http.postWithConfig(`${prefix}/service/operate`, { operation }, { ...local, timeout: 60000 });
export const installPanelMCPService = (params: PanelMCP.Installation) =>
http.postWithConfig<PanelMCP.ServiceStatus>(`${prefix}/service/install`, params, { ...local, timeout: 420000 });
http.postWithConfig<PanelMCP.InstallationTask>(`${prefix}/service/install`, params, local);
export const getPanelMCPLogs = () => http.get<{ content: string }>(`${prefix}/service/logs`, {}, local);
export const getPanelMCPCatalog = () => http.get<PanelMCP.Catalog>(`${prefix}/catalog`, {}, local);
export const getPanelMCPNodes = () => http.get<PanelMCP.Node[]>(`${prefix}/nodes`, {}, local);
@@ -26,6 +36,8 @@ export const setPanelMCPCredentialStatus = (params: PanelMCP.Reference & { statu
http.postWithConfig(`${prefix}/credentials/status`, params, local);
export const revokePanelMCPCredential = (params: PanelMCP.Reference) =>
http.postWithConfig(`${prefix}/credentials/revoke`, params, local);
export const deletePanelMCPCredential = (params: PanelMCP.Reference) =>
http.postWithConfig(`${prefix}/credentials/delete`, params, local);
export const revealPanelMCPCredential = (params: PanelMCP.Reference, signal?: AbortSignal) =>
http.postWithConfig<PanelMCP.Revealed>(`${prefix}/credentials/reveal`, params, { ...local, signal });
export const rotatePanelMCPCredential = (params: PanelMCP.Reference, signal?: AbortSignal) =>