UNPKG

@takashito/linode-mcp-server

Version:

MCP server for Linode API

136 lines 5.68 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createProfileClient = createProfileClient; function createProfileClient(axiosInstance) { return { // Profile operations getProfile: async () => { const response = await axiosInstance.get('/profile'); return response.data; }, updateProfile: async (data) => { const response = await axiosInstance.put('/profile', data); return response.data; }, // SSH Key operations getSSHKeys: async (params) => { const response = await axiosInstance.get('/profile/sshkeys', { params }); return response.data; }, getSSHKey: async (id) => { const response = await axiosInstance.get(`/profile/sshkeys/${id}`); return response.data; }, createSSHKey: async (data) => { const response = await axiosInstance.post('/profile/sshkeys', data); return response.data; }, updateSSHKey: async (id, data) => { const response = await axiosInstance.put(`/profile/sshkeys/${id}`, data); return response.data; }, deleteSSHKey: async (id) => { await axiosInstance.delete(`/profile/sshkeys/${id}`); }, // API Token operations getAPITokens: async (params) => { const response = await axiosInstance.get('/profile/tokens', { params }); return response.data; }, getAPIToken: async (id) => { const response = await axiosInstance.get(`/profile/tokens/${id}`); return response.data; }, createPersonalAccessToken: async (data) => { // Linode API expects scopes as a space-separated string, not an array const payload = { ...data, scopes: Array.isArray(data.scopes) ? data.scopes.join(' ') : data.scopes, }; const response = await axiosInstance.post('/profile/tokens', payload); return response.data; }, updateToken: async (id, data) => { // Linode API expects scopes as a space-separated string, not an array const payload = { ...data }; if (payload.scopes !== undefined && Array.isArray(payload.scopes)) { payload.scopes = payload.scopes.join(' '); } const response = await axiosInstance.put(`/profile/tokens/${id}`, payload); return response.data; }, deleteToken: async (id) => { await axiosInstance.delete(`/profile/tokens/${id}`); }, // Two-Factor Auth operations getTwoFactorSecret: async () => { const response = await axiosInstance.post('/profile/tfa-enable'); return response.data; }, enableTwoFactor: async (data) => { const response = await axiosInstance.post('/profile/tfa-enable-confirm', data); return response.data; }, disableTwoFactor: async (data) => { const response = await axiosInstance.post('/profile/tfa-disable', data); return response.data; }, // Authorized Apps operations getAuthorizedApps: async (params) => { const response = await axiosInstance.get('/profile/apps', { params }); return response.data; }, getAuthorizedApp: async (appId) => { const response = await axiosInstance.get(`/profile/apps/${appId}`); return response.data; }, revokeAuthorizedApp: async (appId) => { await axiosInstance.delete(`/profile/apps/${appId}`); }, // Trusted Devices operations getTrustedDevices: async (params) => { const response = await axiosInstance.get('/profile/devices', { params }); return response.data; }, getTrustedDevice: async (deviceId) => { const response = await axiosInstance.get(`/profile/devices/${deviceId}`); return response.data; }, revokeTrustedDevice: async (deviceId) => { await axiosInstance.delete(`/profile/devices/${deviceId}`); }, // Grants operations getGrants: async (params) => { const response = await axiosInstance.get('/profile/grants', { params }); return response.data; }, // Logins operations getLogins: async (params) => { const response = await axiosInstance.get('/profile/logins', { params }); return response.data; }, getLogin: async (loginId) => { const response = await axiosInstance.get(`/profile/logins/${loginId}`); return response.data; }, // User Preferences operations getUserPreferences: async () => { const response = await axiosInstance.get('/profile/preferences'); return response.data; }, updateUserPreferences: async (data) => { const response = await axiosInstance.put('/profile/preferences', data); return response.data; }, // Security Questions operations getSecurityQuestions: async () => { const response = await axiosInstance.get('/profile/security-questions'); return response.data; }, answerSecurityQuestions: async (data) => { const response = await axiosInstance.post('/profile/security-questions', data); return response.data; }, }; } //# sourceMappingURL=profile.js.map