Skip to content

OpenClaw MCP projection writes schema-invalid _litellmAgentPlatform metadata into openclaw.json #479

Description

@Ivansy

Summary

When attaching an MCP server to an OpenClaw-backed LAP agent, the OpenClaw bridge writes _litellmAgentPlatform metadata into /data/.openclaw/openclaw.json.

However, OpenClaw config validation rejects this unknown key:

Invalid config at /data/.openclaw/openclaw.json:
- <root>: Unrecognized key: "_litellmAgentPlatform"

This causes openclaw config validate and openclaw mcp reload to fail.

I can reproduce this consistently when an MCP server is attached through the LAP Agent UI.

This appears related to the OpenClaw MCP projection logic introduced in PR #467, where LAP-provided mcp_servers are projected into OpenClaw's native mcp.servers config and bridge-owned MCP entries are tracked.

Environment

  • Repository: LiteLLM-Labs/litellm-agent-control-plane
  • Runtime: OpenClaw
  • OpenClaw version shown in container:
OpenClaw 2026.6.11 (e085fa1)
  • MCP transport used in LAP UI: HTTP
  • Example MCP server URL:
http://<host-ip>:8765/mcp

Steps to reproduce

  1. Start the LAP/OpenClaw stack.
  2. Create or edit an Agent using the OpenClaw runtime.
  3. Attach an MCP server in the Agent's MCP Servers section.
  4. Run the Agent, or trigger MCP config sync.
  5. Inspect /data/.openclaw/openclaw.json inside the OpenClaw container.
  6. Run:
openclaw config validate
openclaw mcp reload

Actual behavior

openclaw.json contains LAP-specific metadata like this:

{
  "_litellmAgentPlatform": {
    "managedMcpServers": [
      "mcp_xxx"
    ]
  },
  "mcp": {
    "servers": {
      "mcp_xxx": {
        "_litellmAgentPlatform": {
          "managedBy": "litellm-agent-platform"
        },
        "transport": "streamable-http",
        "url": "http://<host-ip>:8765/mcp"
      }
    }
  }
}

Then OpenClaw validation fails:

Invalid config at /data/.openclaw/openclaw.json:
- <root>: Unrecognized key: "_litellmAgentPlatform"

The logs also show MCP reload failure:

[reload] config reload skipped (invalid config): : Unrecognized key: "_litellmAgentPlatform"
OpenClaw MCP reload failed: Command '['openclaw', 'mcp', 'reload']' returned non-zero exit status 1.

Expected behavior

LAP should be able to project MCP servers into OpenClaw's native mcp.servers config without writing schema-invalid metadata into openclaw.json.

After MCP projection, the following commands should still pass:

openclaw config validate
openclaw mcp reload

Validation performed

I verified this inside the OpenClaw container with:

openclaw config validate
openclaw mcp reload

Both fail after _litellmAgentPlatform is written into /data/.openclaw/openclaw.json.

After manually removing _litellmAgentPlatform from the config, openclaw config validate passes again.

Possible root cause

The bridge appears to store LAP-specific tracking metadata directly inside OpenClaw's native config file:

_litellmAgentPlatform

This metadata is useful for tracking LAP-managed MCP entries, but OpenClaw's config schema does not accept it.

As a result, the config file written by the LAP bridge is no longer valid from OpenClaw's point of view.

Suggested fix

Store LAP bridge metadata outside openclaw.json, for example in:

  • LAP database
  • a sidecar state file
  • runtime-local metadata not consumed by OpenClaw config validation

Alternatively, strip all bridge-only metadata before writing /data/.openclaw/openclaw.json.

The final openclaw.json written to disk should contain only keys accepted by OpenClaw's config schema.

Workaround

Do not attach MCP servers through the LAP Agent UI.

Instead:

  1. Manually configure the MCP server in OpenClaw's native mcp.servers.
  2. Do not select the MCP server in the LAP Agent MCP Servers section.
  3. Remove _litellmAgentPlatform from /data/.openclaw/openclaw.json.
  4. Run:
openclaw config validate
openclaw mcp reload

After removing the metadata, OpenClaw config validation passes again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions