Molecule AI
Guides

MCP Server Setup Guide

Connect Claude Code, Cursor, or any MCP-compatible tool to Molecule AI. Full 87-tool reference for workspace management, agents, secrets, memory, schedules, channels, and plugins.

MCP Server Setup Guide

The Molecule AI MCP server lets any MCP-compatible AI agent manage workspaces, agents, secrets, memory, schedules, channels, and more through the platform API. It works with Claude Code, Cursor, and any other tool that speaks the MCP protocol.

Quick Start

1. Install

The MCP server is published as @molecule-ai/mcp-server on npm.

npx @molecule-ai/mcp-server

2. Configure in .mcp.json

Add to your project's .mcp.json:

{
  "mcpServers": {
    "molecule": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@molecule-ai/mcp-server"],
      "env": {
        "MOLECULE_URL": "http://localhost:8080"
      }
    }
  }
}

For production/SaaS deployments, set MOLECULE_URL to your tenant URL:

"MOLECULE_URL": "https://your-org.moleculesai.app"

3. Verify

Once configured, your MCP client should show 87 Molecule AI tools. Test with:

list_workspaces

Environment Variables

VariableDefaultDescription
MOLECULE_URLhttp://localhost:8080Platform API URL
LOG_LEVELinfoLog level — trace, debug, info, warn, error, fatal (pino numeric levels: 10–60)

Structured Logging

The MCP server emits structured JSON logs via pino. Each log entry includes level, time, pid, hostname, msg, and any extra fields passed as context.

When NODE_ENV != "production", logs are pretty-printed for human readability. In production the output is machine-parseable JSON.

Every log entry automatically includes MCP request context (tool name, request ID, workspace ID) when called from within a tool handler:

{
  "level": 30,
  "time": "2026-04-22T18:30:00.000Z",
  "pid": 1234,
  "hostname": "workspace-server",
  "msg": "rate limit hit",
  "tool": "list_workspaces",
  "requestId": "req_abc123",
  "workspaceId": "ws_xyz789"
}

Set LOG_LEVEL=debug (level 20) to trace all tool calls and request IDs. Set LOG_LEVEL=error (level 50) in CI to suppress informational output.

See molecule-mcp-server PR #6 for implementation details.

Tool Reference

Workspace Management

MCP ToolAPI RouteMethodDescription
list_workspaces/workspacesGETList all workspaces
get_workspace/workspaces/:idGETGet workspace details
create_workspace/workspacesPOSTCreate a new workspace
update_workspace/workspaces/:idPATCHUpdate workspace fields
delete_workspace/workspaces/:idDELETEDelete a workspace
restart_workspace/workspaces/:id/restartPOSTRestart workspace container
pause_workspace/workspaces/:id/pausePOSTPause workspace
resume_workspace/workspaces/:id/resumePOSTResume paused workspace
discover_workspace/registry/discover/:idGETGet workspace URL + agent card

Agent Management

MCP ToolAPI RouteMethodDescription
assign_agent/workspaces/:id/agentPOSTAssign agent to workspace
remove_agent/workspaces/:id/agentDELETERemove agent
replace_agent/workspaces/:id/agentPATCHReplace agent config
move_agent/workspaces/:id/agent/movePOSTMove agent to different workspace

Communication

MCP ToolAPI RouteMethodDescription
chat_with_agent/workspaces/:id/a2aPOSTSend A2A message to agent
async_delegate/workspaces/:id/delegatePOSTFire-and-forget delegation
check_delegations/workspaces/:id/delegationsGETCheck delegation status
send_channel_message/workspaces/:id/channels/:channelId/sendPOSTSend to social channel
notify_user/workspaces/:id/notifyPOSTPush notification to canvas
list_peers/registry/:id/peersGETFind sibling/parent workspaces
check_access/registry/check-accessPOSTCheck if two workspaces can communicate

Configuration

MCP ToolAPI RouteMethodDescription
get_config/workspaces/:id/configGETGet workspace config.yaml
update_config/workspaces/:id/configPATCHUpdate config fields
get_model/workspaces/:id/modelGETGet configured LLM model

Secrets

MCP ToolAPI RouteMethodDescription
list_secrets/workspaces/:id/secretsGETList workspace secret keys
set_secret/workspaces/:id/secretsPOSTSet a workspace secret
delete_secret/workspaces/:id/secrets/:keyDELETEDelete a secret
list_global_secrets/settings/secretsGETList global secrets
set_global_secret/settings/secretsPUTSet a global secret
delete_global_secret/settings/secrets/:keyDELETEDelete global secret

Memory

MCP ToolAPI RouteMethodDescription
memory_list/workspaces/:id/memoryGETList memory keys
memory_get/workspaces/:id/memory/:keyGETGet memory value
memory_set/workspaces/:id/memoryPOSTSet memory key-value
memory_delete_kv/workspaces/:id/memory/:keyDELETEDelete memory key
search_memory/workspaces/:id/memoriesGETFull-text search memories
commit_memory/workspaces/:id/memoriesPOSTCommit HMA memory
delete_memory/workspaces/:id/memories/:idDELETEDelete HMA memory

Files

MCP ToolAPI RouteMethodDescription
list_files/workspaces/:id/filesGETList workspace files
read_file/workspaces/:id/files/*pathGETRead file content
write_file/workspaces/:id/files/*pathPUTWrite/overwrite file
delete_file/workspaces/:id/files/*pathDELETEDelete file
replace_all_files/workspaces/:id/filesPUTReplace all files atomically

Schedules

MCP ToolAPI RouteMethodDescription
list_schedules/workspaces/:id/schedulesGETList cron schedules
create_schedule/workspaces/:id/schedulesPOSTCreate cron schedule
update_schedule/workspaces/:id/schedules/:idPATCHUpdate schedule
delete_schedule/workspaces/:id/schedules/:idDELETEDelete schedule
run_schedule/workspaces/:id/schedules/:id/runPOSTTrigger schedule now
get_schedule_history/workspaces/:id/schedules/:id/historyGETPast run history

Channels (Social Integrations)

MCP ToolAPI RouteMethodDescription
list_channels/workspaces/:id/channelsGETList configured channels
add_channel/workspaces/:id/channelsPOSTAdd Telegram/Slack/Lark channel
update_channel/workspaces/:id/channels/:idPATCHUpdate channel config
remove_channel/workspaces/:id/channels/:idDELETERemove channel
test_channel/workspaces/:id/channels/:id/testPOSTTest channel connectivity
list_channel_adapters/channels/adaptersGETAvailable platforms
discover_channel_chats/channels/discoverPOSTAuto-detect chats for bot token

Plugins

MCP ToolAPI RouteMethodDescription
list_installed_plugins/workspaces/:id/pluginsGETList installed plugins
install_plugin/workspaces/:id/pluginsPOSTInstall plugin from source
uninstall_plugin/workspaces/:id/plugins/:nameDELETEUninstall plugin
list_available_plugins/workspaces/:id/plugins/availableGETPlugins matching runtime
list_plugin_registry/pluginsGETFull plugin registry
list_plugin_sources/plugins/sourcesGETRegistered source schemes
check_plugin_compatibility/workspaces/:id/plugins/compatibilityGETPreflight check

Teams / Hierarchy

MCP ToolAPI RouteMethodDescription
expand_team/workspaces/:id/expandPOSTExpand team node
collapse_team/workspaces/:id/collapsePOSTCollapse team node

Templates & Bundles

MCP ToolAPI RouteMethodDescription
list_templates/templatesGETAvailable templates
import_template/templates/importPOSTImport template
list_org_templates/org/templatesGETOrg template list
import_org/org/importPOSTImport org template
export_bundle/bundles/export/:idGETExport workspace bundle
import_bundle/bundles/importPOSTImport workspace bundle

Tokens

MCP ToolAPI RouteMethodDescription
list_tokens/workspaces/:id/tokensGETList workspace tokens
create_token/workspaces/:id/tokensPOSTCreate new bearer token
revoke_token/workspaces/:id/tokens/:idDELETERevoke specific token

Monitoring

MCP ToolAPI RouteMethodDescription
list_activity/workspaces/:id/activityGETActivity log
report_activity/workspaces/:id/activityPOSTReport agent activity
list_events/eventsGETPlatform event stream
list_traces/workspaces/:id/tracesGETLLM traces (Langfuse)
session_search/workspaces/:id/session-searchGETSearch chat sessions

Approvals

MCP ToolAPI RouteMethodDescription
create_approval/workspaces/:id/approvalsPOSTRequest approval
get_workspace_approvals/workspaces/:id/approvalsGETList approvals
decide_approval/workspaces/:id/approvals/:id/decidePOSTApprove/reject
list_pending_approvals/approvals/pendingGETAll pending approvals

Canvas

MCP ToolAPI RouteMethodDescription
get_canvas_viewport/canvas/viewportGETCurrent viewport
set_canvas_viewport/canvas/viewportPUTSet viewport position

Remote Agents

MCP ToolAPI RouteMethodDescription
list_remote_agents/workspaces?runtime=externalGETList remote agents
get_remote_agent_state/registry/discover/:idGETRemote agent status
check_remote_agent_freshness/registry/heartbeatPOSTCheck if agent is alive
get_remote_agent_setup_command(local)Get setup instructions

Authentication

Most routes require a bearer token:

curl -H "Authorization: Bearer <token>" http://localhost:8080/workspaces

Tokens are issued on workspace registration (POST /registry/register) or via the token management API (POST /workspaces/:id/tokens).

The MCP server handles auth automatically when configured with the correct MOLECULE_URL.

Troubleshooting

IssueFix
"Connection refused"Check MOLECULE_URL points to running platform
"401 Unauthorized"Token expired or revoked — create a new one
Tools not showingRun npx @molecule-ai/mcp-server standalone to check for errors
Stale dataMCP server doesn't cache — check platform directly
High-volume log outputSet LOG_LEVEL=error to suppress info/warn; in production, log output is JSON (machine-parseable)

On this page