Skip to content

Add Lambda/Serverless Support for Sunpeak MCP Apps #38

Open
dcguim wants to merge 2 commits intoSunpeak-AI:mainfrom
dcguim:dcguim/expose-client-name
Open

Add Lambda/Serverless Support for Sunpeak MCP Apps #38
dcguim wants to merge 2 commits intoSunpeak-AI:mainfrom
dcguim:dcguim/expose-client-name

Conversation

@dcguim
Copy link
Copy Markdown

@dcguim dcguim commented Apr 7, 2026

In stateless/serverless environments (Lambda, Workers), each request creates a fresh MCP server instance. The client name is normally detected during MCP initialization, but non-initialize requests (like tools/list, tools/call) skip this handshake. This breaks domain resolution for resources since clientName is undefined.

Solution

Add clientName option to ProductionServerConfig that provides a default client name when the initialization handshake hasn't
occurred.

  const config: ProductionServerConfig = {
    // ...
    clientName: 'chatgpt', // Used when oninitialized hasn't fired
  };

Changes

  • Added clientName?: string to ProductionServerConfig interface
  • Initialize clientName variable from config: let clientName = configClientName
  • Fall back to configClientName in oninitialized: mcpServer.server.getClientVersion()?.name ?? configClientName

Copy link
Copy Markdown
Author

@dcguim dcguim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's another commit to follow removing the logs

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.

1 participant