feat: add per-session MCP server support for REST API (parity with ACP) #4267

Open
opened 2026-02-16 17:43:14 -05:00 by yindo · 1 comment
Owner

Originally created by @HyeongDoYun on GitHub (Jan 5, 2026).

Originally assigned to: @thdxr on GitHub.

Problem

ACP (newSession()) supports mcpServers parameter for per-session MCP configuration, but REST API POST /session doesn't.

This creates inconsistency for integrations that need dynamic MCP configuration via REST.

Use Case

External platforms (like MCP orchestrators) need to:

  1. Create sessions via REST API
  2. Attach user-specific MCP servers to each session
  3. Currently impossible without ACP

Proposed Solution

Add mcpServers parameter to POST /session endpoint, matching ACP behavior:

POST /session
{
  "title": "My Session",
  "mcpServers": {
    "user-mcp": {
      "type": "remote",
      "url": "https://user-specific-mcp.com/sse"
    }
  }
}

Implementation

I've already implemented this and opened a PR: #6884

Changes are minimal (~15 lines):

  • Add mcpServers to Session.create.schema
  • Call MCP.add() in createNext()

All existing tests pass.

Questions

Is this something the team would consider? Happy to adjust the implementation based on feedback.

Originally created by @HyeongDoYun on GitHub (Jan 5, 2026). Originally assigned to: @thdxr on GitHub. ## Problem ACP (`newSession()`) supports `mcpServers` parameter for per-session MCP configuration, but REST API `POST /session` doesn't. This creates inconsistency for integrations that need dynamic MCP configuration via REST. ## Use Case External platforms (like MCP orchestrators) need to: 1. Create sessions via REST API 2. Attach user-specific MCP servers to each session 3. Currently impossible without ACP ## Proposed Solution Add `mcpServers` parameter to `POST /session` endpoint, matching ACP behavior: ```bash POST /session { "title": "My Session", "mcpServers": { "user-mcp": { "type": "remote", "url": "https://user-specific-mcp.com/sse" } } } ``` ## Implementation I've already implemented this and opened a PR: #6884 Changes are minimal (~15 lines): - Add `mcpServers` to `Session.create.schema` - Call `MCP.add()` in `createNext()` All existing tests pass. ## Questions Is this something the team would consider? Happy to adjust the implementation based on feedback.
Author
Owner

@github-actions[bot] commented on GitHub (Jan 5, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #5784: [FEATURE]: MCP auth configuration for multi-tenant serve deployments - addresses per-session MCP configuration via REST API for multi-tenant deployments

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Jan 5, 2026): This issue might be a duplicate of existing issues. Please check: - #5784: [FEATURE]: MCP auth configuration for multi-tenant `serve` deployments - addresses per-session MCP configuration via REST API for multi-tenant deployments Feel free to ignore if none of these address your specific case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4267