// AI 接入 (MCP): 个人授权 token 管理 import { api, getApiBase } from './client.js' export const mcpTokenApi = { list: () => api('/mcp-tokens'), create: (name) => api('/mcp-tokens', { method: 'POST', body: { name } }), rename: (id, name) => api(`/mcp-tokens/${id}`, { method: 'PATCH', body: { name } }), remove: (id) => api(`/mcp-tokens/${id}`, { method: 'DELETE' }), } /** MCP 端点完整地址 (随 API 基址变化) */ export function getMcpEndpoint() { const base = getApiBase() if (base) return base.replace(/\/+$/, '') + '/api/mcp' if (typeof window !== 'undefined') return window.location.origin + '/api/mcp' return '/api/mcp' }