Skip to main content
Glama

clone_project

Clone an Overleaf LaTeX project to your local machine for offline editing and version control integration.

Instructions

Clone an Overleaf project to a local directory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesThe ID of the Overleaf project
localPathYesThe local path to clone the project to (absolute path)
emailNoOverleaf account email (optional if configured globally)
tokenNoOverleaf git token (optional if configured globally)

Implementation Reference

  • Core handler function that clones the Overleaf project using simple-git, handling authentication via provided credentials or global config.
    async cloneProject(projectId: string, localPath: string, email?: string, token?: string) { // Ensure parent directory exists await fs.ensureDir(path.dirname(localPath)); let gitUrl = ''; // Try to get credentials if not provided if (!email || !token) { const creds = await this.authManager.getCredentials(); if (creds) { gitUrl = this.getGitUrl(projectId, creds.email, creds.token); } else { // Fallback to no-auth URL (will likely fail or prompt if interactive, but MCP is non-interactive) // Ideally we should error here if no auth is available for a private repo, // but let's try to construct it. gitUrl = this.getGitUrl(projectId); } } else { gitUrl = this.getGitUrl(projectId, email, token); } const git: SimpleGit = simpleGit(); try { await git.clone(gitUrl, localPath); console.error(`Successfully cloned project ${projectId} to ${localPath}`); return { success: true, message: `Cloned to ${localPath}` }; } catch (error: any) { console.error('Clone failed:', error); throw new Error(`Failed to clone project: ${error.message}`); }
  • Input schema and metadata for the clone_project tool.
    name: 'clone_project', description: 'Clone an Overleaf project to a local directory', inputSchema: { type: 'object', properties: { projectId: { type: 'string', description: 'The ID of the Overleaf project', }, localPath: { type: 'string', description: 'The local path to clone the project to (absolute path)', }, email: { type: 'string', description: 'Overleaf account email (optional if configured globally)', }, token: { type: 'string', description: 'Overleaf git token (optional if configured globally)', }, }, required: ['projectId', 'localPath'], },
  • src/index.ts:129-135 (registration)
    Registration and dispatch logic in the CallToolRequestHandler switch case, which calls the handler.
    case 'clone_project': { const { projectId, localPath, email, token } = request.params.arguments as any; const result = await gitManager.cloneProject(projectId, localPath, email, token); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/juho127/overleafMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server