multica-ai/multica · error
add agent mcp server: %w
Error message
add agent mcp server: %w
What it means
Thrown by `multica agent mcp add <agentID> <serverID>` when POST /api/agents/{id}/mcp-servers with body {server_id} fails. Common wrapped causes: the server_id is not a known workspace MCP server, the agent ID is unknown, the server is already attached, or auth/connectivity failures.
Source
Thrown at server/cmd/multica/cmd_agent_mcp.go:122
if err := client.GetJSON(ctx, agentMcpPath(agentID), &servers); err != nil {
return fmt.Errorf("list agent mcp servers: %w", err)
}
return printWorkspaceMcpServers(cmd, servers)
}
func runAgentMcpAdd(cmd *cobra.Command, args []string) error {
agentID, serverID := strings.TrimSpace(args[0]), strings.TrimSpace(args[1])
client, err := newAPIClient(cmd)
if err != nil {
return err
}
ctx, cancel := cli.APIContext(context.Background())
defer cancel()
var servers []workspaceMcpServer
body := map[string]any{"server_id": serverID}
if err := client.PostJSON(ctx, agentMcpPath(agentID), body, &servers); err != nil {
return fmt.Errorf("add agent mcp server: %w", err)
}
return printWorkspaceMcpServers(cmd, servers)
}
func runAgentMcpEnable(cmd *cobra.Command, args []string) error {
return setAgentMcpEnabled(cmd, args, true)
}
func runAgentMcpDisable(cmd *cobra.Command, args []string) error {
return setAgentMcpEnabled(cmd, args, false)
}
func setAgentMcpEnabled(cmd *cobra.Command, args []string, enabled bool) error {
agentID, serverID := strings.TrimSpace(args[0]), strings.TrimSpace(args[1])
client, err := newAPIClient(cmd)
if err != nil {
return err
}View on GitHub (pinned to 2c0912b6ec)
Solutions
- List available workspace MCP servers and re-run with an exact ID
- Confirm the agent still exists: multica agent list
- Check the wrapped error for duplicate-attachment rejections — the server may already be attached
Example fix
# before multica agent mcp add <agent-id> srv_typo # after multica mcp list # or the workspace servers command multica agent mcp add <agent-id> <exact-server-id>
Defensive patterns
Strategy: validation
Validate before calling
# verify both IDs exist before attaching
multica agent get "$AGENT_ID" >/dev/null || exit 1
multica mcp list --output json | jq -e --arg s "$SERVER_ID" 'map(.id) | index($s)' >/dev/null || { echo "unknown server" >&2; exit 1; }
multica agent mcp add "$AGENT_ID" "$SERVER_ID" Prevention
- Copy server IDs from a live listing, never from another workspace's output
- Check current attachments before adding to avoid duplicate rejections
- Keep agent and MCP server provisioning in the same environment/script
When it happens
Trigger: `multica agent mcp add <agent> <server>` where serverID does not match any workspace MCP server (typo or different workspace); adding to a deleted agent; duplicate attachment rejected by the API.
Common situations: Server IDs copied from another workspace; MCP server deleted after listing; agents and MCP servers managed in different environments.
Related errors
- list agent mcp servers: %w
- update agent mcp server: %w
- remove agent mcp server: %w
- list agents: %w
- get agent: %w
AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15).
Data as JSON: /api/errors/50e8e1e531d10ab7.
Report an issue: GitHub.