Skip to main content

Setup MCP & ENV

Benchmarked against: Anthropic — Get API key Scope: MCP server configuration + environment variables for a new ship or agent

MCP (Model Context Protocol) is the communication standard between agents and tools. Every agent needs at least one MCP server configured to operate. This page covers the full setup for both Claude Code CLI and Claude Desktop App agents.


MCP server inventory

A fully configured SuperPortia ship runs these MCP servers:

ServerTypeTransportPurpose
Cloud UBCustomRemote HTTPShared fleet knowledge, WO system, messaging
Local UBICustomstdio (Python)Local tools, dispatch engine, MTAAA pipeline
CloudflareOfficialRemoteCloudflare API operations (Workers, D1, R2)
SupabaseOfficialRemoteDatabase operations for web projects
ChromeExtensionWebSocketBrowser automation
MemoryOfficialstdioPersonal knowledge graph
FilesystemOfficialstdioSafe file operations outside repo
ObsidianCommunitystdioNote search (legacy)

Configuration files

Claude Code CLI (~/.claude.json or project settings.json)

MCP servers for CLI agents are configured in Claude Code's settings:

{
"mcpServers": {
"cloud-ub": {
"url": "https://your-cloud-ub-worker.workers.dev/mcp",
"headers": {
"Authorization": "Bearer YOUR_AUTH_TOKEN"
}
},
"local-ubi": {
"command": "python",
"args": ["-m", "ub.mcp_server"],
"cwd": "/path/to/superportia",
"env": {
"SP_SHIP_ID": "SS1",
"SP_AGENT_ID": "Mac CLI 小克"
}
}
}
}

Claude Desktop App (claude_desktop_config.json)

For App-based agents (Chat tab = 小西, Code tab = 小克):

{
"mcpServers": {
"cloud-ub": {
"url": "https://your-cloud-ub-worker.workers.dev/mcp"
},
"local-ubi": {
"command": "python",
"args": ["-m", "ub.mcp_server"],
"cwd": "/path/to/superportia"
}
}
}

Environment variables

Required for all agents

VariableValuePurpose
SP_SHIP_IDSS1, SS2, or SS3Ship identity for UB tagging
SP_AGENT_IDAgent identity stringAgent identity for audit trail

Required for Local UBI

VariableValuePurpose
GROQ_API_KEYGroq API keyFree engine access
GEMINI_API_KEYGoogle AI API keyGemini engine + embeddings
DEEPSEEK_API_KEYDeepSeek API keyDeepSeek engine
MISTRAL_API_KEYMistral API keyMistral engine
ZHIPU_API_KEYZhipu API keyGLM-5 engine

Required for Cloud UB

VariableValuePurpose
CLOUD_UB_URLWorker URLCloud UB endpoint
CLOUD_UB_AUTHBearer tokenAuthentication

Verification checklist

After configuration, verify each MCP server:

CheckCommandExpected
Cloud UB healthcloud_ub_health(){"status": "healthy"}
Agent registrationagent_heartbeat(){"status": "registered"}
Mailbox accesscheck_agent_mailbox()No error
UB searchsearch_brain("test")Returns results array
Engine availabilitylist_models()Shows configured providers
File toolsubi_list_directory(path="/tmp")Directory listing

Ship identity naming

Each agent has a unique identity based on ship + interface:

ShipCLI AgentApp Agent
SS1Mac CLI 小克Mac App 小克
SS1Mac CLI 小AMac App 小A
SS2Win CLI 小克Win App 小克
SS2Win CLI 小AWin App 小A
SS3Web 小克

Set SP_AGENT_ID to the exact identity string. This appears in UB entries, WO audit trails, and agent messages.


Troubleshooting

SymptomLikely causeFix
MCP server keeps restartingPython environment issueCheck .venv activation, dependencies
agent_heartbeat() failsCloud UB unreachableCheck CLOUD_UB_URL, network, Worker status
Tools return emptyWrong ship/agent IDVerify SP_SHIP_ID and SP_AGENT_ID
list_models() shows missing keysAPI keys not setAdd keys to .env or environment
Chrome MCP disconnectedExtension not runningOpen Chrome, check extension status

PageRelationship
QuickstartEnd-to-end first run
First HeartbeatAgent registration details
MCP Servers OverviewAll MCP servers
Fleet ManagementShip architecture