feat/session-cursor-module
CI / test (pull_request) Successful in 43s
Adds `./session-cursor` — a shared, session-keyed durable since_id cursor store, beside `inbox-uploads`/`targets`, so every /activity-polling TS adapter (channel today; hermes-ts / codex-ts next) uses one implementation of the polling-cursor contract instead of re-implementing (and re-bugging) it inline. Why session-namespaced: a host can run more than one adapter session (two `claude` invocations both loading the plugin). The platform is fully concurrent — register/heartbeat are workspace-keyed last-writer-wins and /activity is read-only with a client-driven since_id (molecule-core registry.go / activity.go) — so the ONLY thing that races is a *shared* cursor file. Keying the file by session removes that race: - primary (no key) -> cursor.json (survives restarts; resumes) - secondary (key) -> cursor.<key>.json (independent; pruned when gone) Surface: `CursorStore` (load/get/has/set/delete/entries/save/unlink, atomic temp+rename, 0600), `cursorFileName(sessionKey?)`, `parseSessionKey`, `pruneOrphanCursors(stateDir, isAlive)`. Logging-agnostic: load() swallows corruption (optional onLoadError hook) and save() throws — the adapter owns its phrasing and fatal-vs-recoverable policy. Additive: new subpath export only; existing 1.3.x consumers unaffected. Context: molecule-mcp-claude-channel#26 (secondary) / internal#726. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Merge pull request 'docs(mcp): sync CLAUDE.md after provision_workspace tool added (PR #19)' (#20) from fix/claude-88th-tool into main
Molecule AI MCP Server
MCP server that exposes Molecule AI platform operations as tools for AI coding agents.
87 Tools Available
See the full tool registry for all tools. Highlights:
| Category | Tools |
|---|---|
| Workspace | list, create, get, update, delete, restart, pause, resume |
| Agent | chat_with, assign, replace, remove, move, get_model |
| Delegation | async_delegate, check_delegations, record_delegation, notify_user, list_activity |
| Secrets | set, list, delete (workspace + global variants) |
| Files | list, read, write, delete, replace_all, get_config, update_config |
| Memory | commit, search, delete (HMA scopes) + memory_set/get/list/delete (K/V) |
| Plugins | list registry, list installed, install, uninstall, list sources, check compatibility |
| Channels | list adapters, list, add, update, remove, send, test, discover chats |
| Schedules | list, create, update, delete, run, get history |
| Discovery | list peers, discover, check_access, list events, import/export, canvas viewport |
| Approvals | list pending, decide, create, get workspace approvals |
| Remote Agents | list (runtime=external), get state, setup command, check freshness |
Setup
Claude Code
Add to your project's .mcp.json:
{
"mcpServers": {
"molecule": {
"command": "node",
"args": ["./mcp-server/dist/index.js"],
"env": {
"MOLECULE_API_URL": "http://localhost:8080"
}
}
}
}
Cursor
Add to .cursor/mcp.json:
{
"mcpServers": {
"molecule": {
"command": "node",
"args": ["./mcp-server/dist/index.js"],
"env": {
"MOLECULE_API_URL": "http://localhost:8080"
}
}
}
}
Codex / OpenCode
MOLECULE_API_URL=http://localhost:8080 node mcp-server/dist/index.js
Environment Variables
| Variable | Default | Description |
|---|---|---|
MOLECULE_API_URL |
http://localhost:8080 |
Platform API base URL |
MOLECULE_API_KEY |
— | API key for platform authentication |
MCP_SERVER_PORT |
3000 |
Port (for HTTP/SSE transport) |
Quick Start
npm install && npm run build- Set
MOLECULE_API_URLandMOLECULE_API_KEY npm start(stdio mode) or use an MCP host config
Examples
You: "Create an SEO agent workspace using the seo-agent template"
Agent: [calls create_workspace with template="seo-agent"]
You: "Set the OpenRouter API key for the SEO workspace"
Agent: [calls set_secret with key="OPENROUTER_API_KEY"]
You: "Ask the SEO agent to audit my homepage"
Agent: [calls chat_with_agent with message="Audit https://example.com for SEO"]
You: "What skills does the coding agent have?"
Agent: [calls get_workspace, reads agent_card.skills]
Remote Agents (Phase 30)
For agents running outside the platform's Docker network, the get_remote_agent_setup_command
tool generates a bash one-liner:
pip install molecule-ai-sdk
WORKSPACE_ID=... PLATFORM_URL=... python3 -c "from molecule_agent import RemoteAgentClient; ..."
See the full tool registry in CLAUDE.md for all 87 tools.
Description
Languages
TypeScript
94.7%
JavaScript
3.6%
Shell
1.7%