feat: multi-workspace support for organizations with multiple spaces#44
Open
Snozu wants to merge 6 commits into
Open
feat: multi-workspace support for organizations with multiple spaces#44Snozu wants to merge 6 commits into
Snozu wants to merge 6 commits into
Conversation
…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.
24a7e8c to
f3b9966
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
RESPONDIO_API_KEYsee zero changesworkspaceparameter is dynamically injected at registration time viaBaseTool.register(), keeping all tool files cleanlist_workspacestool — only registered when multi-workspace mode is activeConfiguration
Single workspace (unchanged):
Multiple workspaces (new):
If both env vars are set,
RESPONDIO_WORKSPACEStakes priority.Changes
constants.ts,types.ts,utils/api.tsRESPONDIO_WORKSPACES, addisMultiWorkspace(),getWorkspaceToken(), updatecreateSdkClient()signatureBaseTool.tsworkspaceparam into all tools when multi-workspace is activecontacts.tool.ts,messaging.tool.ts,conversation.tool.ts,comment.tool.ts,workspace.tool.tsworkspacefrom args tocreateSdkClient()index.ts,server.tslist_workspacestoolTest plan
npm run buildpasses with no TypeScript errorsRESPONDIO_WORKSPACESwith 2+ entries —list_workspacestool appears, all tools show optionalworkspaceparamworkspace— uses default workspace