Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions apps/sim/tools/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1552,11 +1552,13 @@ async function executeMcpTool(

const baseUrl = getInternalApiBaseUrl()

const mcpScope = resolveToolScope(params, executionContext)

const headers: Record<string, string> = { 'Content-Type': 'application/json' }

if (typeof window === 'undefined') {
try {
const internalToken = await generateInternalToken(executionContext?.userId)
const internalToken = await generateInternalToken(mcpScope.userId)
headers.Authorization = `Bearer ${internalToken}`
} catch (error) {
logger.error(`[${actualRequestId}] Failed to generate internal token:`, error)
Expand Down Expand Up @@ -1587,8 +1589,6 @@ async function executeMcpTool(
)
}

const mcpScope = resolveToolScope(params, executionContext)

if (mcpScope.callChain && mcpScope.callChain.length > 0) {
headers[SIM_VIA_HEADER] = serializeCallChain(mcpScope.callChain)
}
Expand Down
Loading