Skip to content

feat: multi-workspace support for organizations with multiple spaces#44

Open
Snozu wants to merge 6 commits into
respond-io:masterfrom
Snozu:feature/multi-workspace-support
Open

feat: multi-workspace support for organizations with multiple spaces#44
Snozu wants to merge 6 commits into
respond-io:masterfrom
Snozu:feature/multi-workspace-support

Conversation

@Snozu
Copy link
Copy Markdown

@Snozu Snozu commented Mar 7, 2026

Summary

Companies using respond.io often manage multiple workspaces under one organization. Each workspace has its own API key. Currently, the MCP server only supports a single API key, forcing users to run separate server instances per workspace.

This PR adds multi-workspace support so an AI agent can target a specific workspace and the MCP server routes to the correct one automatically.

Key design decisions

  • 100% backwards compatible — users with a single RESPONDIO_API_KEY see zero changes
  • Zero changes to existing tool definitions — the workspace parameter is dynamically injected at registration time via BaseTool.register(), keeping all tool files clean
  • New list_workspaces tool — only registered when multi-workspace mode is active

Configuration

Single workspace (unchanged):

RESPONDIO_API_KEY=Bearer token...

Multiple workspaces (new):

RESPONDIO_WORKSPACES={"Workspace A":"token_a","Workspace B":"token_b","Workspace C":"token_c"}
RESPONDIO_DEFAULT_WORKSPACE=Workspace A  # optional, defaults to first entry

If both env vars are set, RESPONDIO_WORKSPACES takes priority.

Changes

Commit Files What
Core infrastructure constants.ts, types.ts, utils/api.ts Parse RESPONDIO_WORKSPACES, add isMultiWorkspace(), getWorkspaceToken(), update createSdkClient() signature
Schema injection BaseTool.ts Dynamically inject optional workspace param into all tools when multi-workspace is active
Handler updates contacts.tool.ts, messaging.tool.ts, conversation.tool.ts, comment.tool.ts, workspace.tool.ts Pass workspace from args to createSdkClient()
Startup + new tool index.ts, server.ts Validate config, log workspace info, register list_workspaces tool

Test plan

  • npm run build passes with no TypeScript errors
  • All 63 existing tests pass (single-key mode, no regressions)
  • Manual: set RESPONDIO_WORKSPACES with 2+ entries — list_workspaces tool appears, all tools show optional workspace param
  • Manual: call tool without workspace — uses default workspace
  • Manual: call tool with valid workspace name — uses that workspace's token
  • Manual: call tool with invalid workspace — returns clear error listing available workspaces

hasithaishere and others added 6 commits February 27, 2026 14:47
…ches--master--components--mcp-server

chore(master): release 1.2.0
Parse RESPONDIO_WORKSPACES env var, add isMultiWorkspace() helper,
WorkspaceConfig type, and getWorkspaceToken() for token resolution.
createSdkClient() now accepts optional workspace parameter.
… mode

BaseTool.register() dynamically adds optional workspace param to all
tools when isMultiWorkspace() is true. Single-key mode is unchanged.
All tool handlers now extract workspace from args and forward it
to createSdkClient() for multi-workspace token resolution.
Register list_workspaces tool only in multi-workspace mode.
Startup now accepts RESPONDIO_WORKSPACES as alternative to API_KEY
and logs configured workspace info.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants