Skip to main content
Glama

Chat Context MCP

by aolshaun
sync.ts1.54 kB
/** * Sync Command */ import { Command } from 'commander'; import ora from 'ora'; import { CursorContext } from '../../core/index.js'; import { printError, printSuccess } from '../utils/output.js'; import type { SyncOptions } from '../types.js'; export function createSyncCommand(): Command { const cmd = new Command('sync'); cmd .description('Sync sessions from Cursor and/or Claude Code databases') .option('-l, --limit <number>', 'Maximum number of sessions to sync', '50') .option('-s, --source <source>', 'Source to sync (cursor, claude, all)', 'all') .action(async (options: SyncOptions) => { const source = (options.source || 'all') as 'cursor' | 'claude' | 'all'; const sourceLabel = source === 'all' ? 'Cursor and Claude Code' : source === 'cursor' ? 'Cursor' : 'Claude Code'; const spinner = ora(`Syncing sessions from ${sourceLabel}...`).start(); try { const api = new CursorContext(); const limit = options.limit ? parseInt(options.limit.toString(), 10) : 50; const synced = await api.syncSessions(limit, source); spinner.stop(); if (synced === 0) { printSuccess('No new sessions to sync (all up to date)'); } else { printSuccess(`Synced ${synced} new session(s) from ${sourceLabel}`); } api.close(); } catch (error: any) { spinner.stop(); printError(error.message); process.exit(1); } }); return cmd; }

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/aolshaun/chat-context-mcp'

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