Skip to content

Commit ddae8eb

Browse files
waleedlatif1claude
andcommitted
fix(mcp): use canonical serverId from contract; drop dual-semantics state field
- tool-input now passes result.serverId (the contract-defined property) to startOauthForServer instead of the duplicated result.id alias. - Drop the unused state field from McpOauthRow. The DB column stores a hash; the in-memory copy was only ever assigned (never read for logic), and provider.state() was setting it to plaintext, creating an inconsistent hash-vs-plaintext type. Removing it eliminates the foot-gun. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 4f3b32a commit ddae8eb

3 files changed

Lines changed: 1 addition & 7 deletions

File tree

  • apps/sim

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/tool-input.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2142,7 +2142,7 @@ export const ToolInput = memo(function ToolInput({
21422142
config: { ...config, enabled: true },
21432143
})
21442144
if (result.authType === 'oauth') {
2145-
await startOauthForServer(result.id)
2145+
await startOauthForServer(result.serverId)
21462146
}
21472147
}}
21482148
workspaceId={workspaceId}

apps/sim/lib/mcp/oauth/provider.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ export class SimMcpOauthProvider implements OAuthClientProvider {
7474
async state(): Promise<string> {
7575
const state = `${this.row.id}.${generateId()}`
7676
await saveState(this.row.id, state)
77-
this.row.state = state
7877
return state
7978
}
8079

@@ -139,7 +138,6 @@ export class SimMcpOauthProvider implements OAuthClientProvider {
139138
await clearVerifier(this.row.id)
140139
await clearState(this.row.id)
141140
this.row.codeVerifier = null
142-
this.row.state = null
143141
}
144142
}
145143

apps/sim/lib/mcp/oauth/storage.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ export interface McpOauthRow {
2121
clientInformation: OAuthClientInformationMixed | null
2222
tokens: OAuthTokens | null
2323
codeVerifier: string | null
24-
state: string | null
2524
}
2625

2726
async function encryptTokens(tokens: OAuthTokens): Promise<string> {
@@ -74,7 +73,6 @@ export async function getOrCreateOauthRow(params: {
7473
clientInformation: null,
7574
tokens: null,
7675
codeVerifier: null,
77-
state: null,
7876
}
7977
}
8078

@@ -104,7 +102,6 @@ export async function loadOauthRow(params: {
104102
: null,
105103
tokens: row.tokens ? await decryptTokens(row.tokens) : null,
106104
codeVerifier: row.codeVerifier ? (await decryptSecret(row.codeVerifier)).decrypted : null,
107-
state: row.state,
108105
}
109106
}
110107

@@ -125,7 +122,6 @@ export async function loadOauthRowByState(state: string): Promise<McpOauthRow |
125122
: null,
126123
tokens: row.tokens ? await decryptTokens(row.tokens) : null,
127124
codeVerifier: row.codeVerifier ? (await decryptSecret(row.codeVerifier)).decrypted : null,
128-
state: row.state,
129125
}
130126
}
131127

0 commit comments

Comments
 (0)