@takashito/linode-mcp-server
Version:
MCP server for Linode API
165 lines (164 loc) • 4.87 kB
TypeScript
import { AxiosInstance } from 'axios';
import { PaginatedResponse, PaginationParams } from './common';
export interface ScopeDefinition {
name: string;
description: string;
category: string;
}
export interface AuthorizedApp {
id: number;
label: string;
thumbnail_url: string;
access: string;
scopes: string[];
website: string;
created: string;
expiry: string;
}
export interface TrustedDevice {
id: number;
user_agent: string;
last_remote_addr: string;
last_authenticated: string;
created: string;
expiry: string;
}
export interface Grant {
id: number;
permissions: string;
label: string;
entity: {
id: number;
type: string;
label: string;
};
}
export interface Login {
id: number;
ip: string;
datetime: string;
username: string;
status: string;
}
export interface UserPreferences {
sortKeys?: Record<string, string>;
timezone?: string;
email_notifications?: boolean;
default_from_email?: string;
authorized_keys?: string[];
theme?: string;
editorMode?: string;
}
export interface SecurityQuestion {
id: number;
question: string;
}
export interface SecurityQuestionAnswer {
question_id: number;
answer: string;
}
export interface PhoneVerificationPayload {
phone_number: string;
}
export interface PhoneVerificationConfirmPayload {
otp_code: string;
}
export interface UserProfile {
username: string;
email: string;
timezone: string;
email_notifications: boolean;
restricted: boolean;
two_factor_auth: boolean;
referrals: {
total: number;
completed: number;
pending: number;
credit: number;
code: string;
url: string;
};
authorized_keys: string[];
}
export interface UpdateProfileRequest {
email?: string;
timezone?: string;
email_notifications?: boolean;
restricted?: boolean;
}
export interface SSHKey {
id: number;
label: string;
ssh_key: string;
created: string;
}
export interface CreateSSHKeyRequest {
label: string;
ssh_key: string;
}
export interface UpdateSSHKeyRequest {
label?: string;
}
export interface APIToken {
id: number;
label: string;
created: string;
expiry: string | null;
token?: string;
scopes: string[];
website?: string;
thumbnail_url?: string;
}
export interface CreatePersonalAccessTokenRequest {
label: string;
expiry?: string;
scopes: string[];
}
export interface UpdateTokenRequest {
label?: string;
expiry?: string;
scopes?: string[];
}
export interface TwoFactorResponse {
secret: string;
service_name: string;
qr_code: string;
}
export interface TwoFactorConfirmRequest {
tfa_code: string;
scratch_code?: string;
}
export interface ScopeListResponse {
scopes: ScopeDefinition[];
}
export interface ProfileClientInterface {
getProfile(): Promise<UserProfile>;
updateProfile(data: UpdateProfileRequest): Promise<UserProfile>;
getSSHKeys(params?: PaginationParams): Promise<PaginatedResponse<SSHKey>>;
getSSHKey(id: number): Promise<SSHKey>;
createSSHKey(data: CreateSSHKeyRequest): Promise<SSHKey>;
updateSSHKey(id: number, data: UpdateSSHKeyRequest): Promise<SSHKey>;
deleteSSHKey(id: number): Promise<void>;
getAPITokens(params?: PaginationParams): Promise<PaginatedResponse<APIToken>>;
getAPIToken(id: number): Promise<APIToken>;
createPersonalAccessToken(data: CreatePersonalAccessTokenRequest): Promise<APIToken>;
updateToken(id: number, data: UpdateTokenRequest): Promise<APIToken>;
deleteToken(id: number): Promise<void>;
getTwoFactorSecret(): Promise<TwoFactorResponse>;
enableTwoFactor(data: TwoFactorConfirmRequest): Promise<{}>;
disableTwoFactor(data: TwoFactorConfirmRequest): Promise<{}>;
getAuthorizedApps(params?: PaginationParams): Promise<PaginatedResponse<AuthorizedApp>>;
getAuthorizedApp(appId: number): Promise<AuthorizedApp>;
revokeAuthorizedApp(appId: number): Promise<void>;
getTrustedDevices(params?: PaginationParams): Promise<PaginatedResponse<TrustedDevice>>;
getTrustedDevice(deviceId: number): Promise<TrustedDevice>;
revokeTrustedDevice(deviceId: number): Promise<void>;
getGrants(params?: PaginationParams): Promise<PaginatedResponse<Grant>>;
getLogins(params?: PaginationParams): Promise<PaginatedResponse<Login>>;
getLogin(loginId: number): Promise<Login>;
getUserPreferences(): Promise<UserPreferences>;
updateUserPreferences(data: UserPreferences): Promise<UserPreferences>;
getSecurityQuestions(): Promise<SecurityQuestion[]>;
answerSecurityQuestions(data: SecurityQuestionAnswer[]): Promise<{}>;
}
export declare function createProfileClient(axiosInstance: AxiosInstance): ProfileClientInterface;