summaryrefslogtreecommitdiff
path: root/src/mcp/lattex.mjs
diff options
context:
space:
mode:
authorhaoyuren <13851610112@163.com>2026-03-15 18:47:29 -0500
committerhaoyuren <13851610112@163.com>2026-03-15 18:47:29 -0500
commita36b73505754acab6872d23c9add58dfca3cecdd (patch)
tree2c750e7710fa828a277ee7db15e4e5e081747758 /src/mcp/lattex.mjs
parent4969ea10ffd14e52c83f32e708563bacf910e238 (diff)
Add online users popover, MCP get_online_users, claude-workspace, stronger CLAUDE.mdv0.3.4
- Online users: click "N online" badge to see user names with cursor colors - MCP get_online_users tool: main process tracks users in .lattex-online-users.json - CLAUDE.md: show current user's Overleaf name (fetched from /user/settings) - CLAUDE.md: mandatory first steps with MUST/NEVER language at top of file - claude-workspace/ directory: untracked scratch space for Claude Code experiments - chokidar + bridge skip claude-workspace/ to prevent syncing to Overleaf Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'src/mcp/lattex.mjs')
-rw-r--r--src/mcp/lattex.mjs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/mcp/lattex.mjs b/src/mcp/lattex.mjs
index 861ff40..cfac04a 100644
--- a/src/mcp/lattex.mjs
+++ b/src/mcp/lattex.mjs
@@ -486,6 +486,15 @@ const TOOLS = [
}
}
}
+ },
+ // ── Online Users ──
+ {
+ name: 'get_online_users',
+ description: 'Get the list of users currently online in this Overleaf project.',
+ inputSchema: {
+ type: 'object',
+ properties: {}
+ }
}
]
@@ -861,6 +870,21 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
)
}
+ case 'get_online_users': {
+ const cwd = process.cwd()
+ const usersPath = join(cwd, '.lattex-online-users.json')
+ try {
+ const users = JSON.parse(readFileSync(usersPath, 'utf-8'))
+ if (!Array.isArray(users) || users.length === 0) {
+ return textResult('No other users currently online.')
+ }
+ const lines = users.map(u => `- ${u.name}${u.email ? ` (${u.email})` : ''}`)
+ return textResult(`${users.length} user(s) online:\n${lines.join('\n')}`)
+ } catch {
+ return textResult('No other users currently online.')
+ }
+ }
+
default:
return errorResult(`Unknown tool: ${name}`)
}