dbx-mcp-server
Version:
A Model Context Protocol server for Dropbox integration with AI-powered PDF analysis, multi-directory indexing, and parallel processing
89 lines • 3.86 kB
JavaScript
import { getDropboxClient } from './client-factory.js';
import { getCachedTeamConfig, getCachedBusinessUserId, shouldUseTeamSpace } from './team-config.js';
import { handleDropboxError } from './error-handler.js';
export async function getAccountInfo() {
try {
const client = await getDropboxClient(); // Account info doesn't need team space
const response = await client.usersGetCurrentAccount();
const accountInfo = {
account_id: response.result.account_id,
name: response.result.name,
email: response.result.email,
email_verified: response.result.email_verified,
profile_photo_url: response.result.profile_photo_url,
country: response.result.country,
locale: response.result.locale,
team: response.result.team ? {
name: response.result.team.name,
team_id: response.result.team.id,
} : null,
account_type: response.result.account_type['.tag'] || 'unknown',
};
return {
content: [{
type: 'text',
text: JSON.stringify(accountInfo, null, 2),
}],
};
}
catch (error) {
handleDropboxError(error);
}
}
export async function getTeamInfo() {
try {
const client = await getDropboxClient(); // Use basic client to get team info
// Get current account to check if it's a business account
const accountResponse = await client.usersGetCurrentAccount();
const account = accountResponse.result;
let teamInfo = {
account_type: account.account_type['.tag'],
is_business_account: !!account.team,
};
if (account.team) {
teamInfo.team = {
name: account.team.name,
team_id: account.team.id,
};
// Get team configuration
const teamConfig = await getCachedTeamConfig();
teamInfo.team_space_enabled = teamConfig?.hasTeamSpace || false;
// Get business user ID
const businessUserId = await getCachedBusinessUserId();
teamInfo.business_user_id = businessUserId;
teamInfo.team_folder_access = {
can_access_surge: shouldUseTeamSpace('/Surge', teamConfig),
team_space_indicators: ['/Surge', '/team', '/shared', '/company', '/organization', '/projects'],
recommended_approach: teamInfo.team_space_enabled
? 'Use team space paths like /Surge/internal for team folders'
: 'Team folders may be accessible via member-specific paths',
pathRoot_config: teamConfig?.hasTeamSpace ? {
".tag": "namespace_id",
"namespace_id": teamConfig.teamId || "team_space"
} : null
};
// Debug information for troubleshooting
teamInfo.debug_info = {
environment_business_user_id: process.env.DROPBOX_BUSINESS_USER_ID,
cached_business_user_id: businessUserId,
team_config: teamConfig,
path_routing: {
'/Surge': shouldUseTeamSpace('/Surge', teamConfig),
'/Surge/internal': shouldUseTeamSpace('/Surge/internal', teamConfig),
'/team': shouldUseTeamSpace('/team', teamConfig),
'/normal/path': shouldUseTeamSpace('/normal/path', teamConfig)
}
};
}
return {
content: [{
type: 'text',
text: JSON.stringify(teamInfo, null, 2)
}],
};
}
catch (error) {
handleDropboxError(error);
}
}
//# sourceMappingURL=team-operations.js.map