mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-23 00:35:51 +00:00
style: 完成所有文件的lint
This commit is contained in:
@@ -51,7 +51,10 @@ import {
|
||||
toolMatchesName,
|
||||
} from '../../Tool.js'
|
||||
import { ListMcpResourcesTool } from '@claude-code-best/builtin-tools/tools/ListMcpResourcesTool/ListMcpResourcesTool.js'
|
||||
import { type MCPProgress, MCPTool } from '@claude-code-best/builtin-tools/tools/MCPTool/MCPTool.js'
|
||||
import {
|
||||
type MCPProgress,
|
||||
MCPTool,
|
||||
} from '@claude-code-best/builtin-tools/tools/MCPTool/MCPTool.js'
|
||||
import { createMcpAuthTool } from '@claude-code-best/builtin-tools/tools/McpAuthTool/McpAuthTool.js'
|
||||
import { ReadMcpResourceTool } from '@claude-code-best/builtin-tools/tools/ReadMcpResourceTool/ReadMcpResourceTool.js'
|
||||
import { createAbortController } from '../../utils/abortController.js'
|
||||
@@ -903,7 +906,8 @@ export const connectToServer = memoize(
|
||||
)
|
||||
logMCPDebug(name, `claude.ai proxy transport created successfully`)
|
||||
} else if (
|
||||
((serverRef as ScopedMcpServerConfig).type === 'stdio' || !(serverRef as ScopedMcpServerConfig).type) &&
|
||||
((serverRef as ScopedMcpServerConfig).type === 'stdio' ||
|
||||
!(serverRef as ScopedMcpServerConfig).type) &&
|
||||
isClaudeInChromeMCPServer(name)
|
||||
) {
|
||||
// Run the Chrome MCP server in-process to avoid spawning a ~325 MB subprocess
|
||||
@@ -916,7 +920,9 @@ export const connectToServer = memoize(
|
||||
const { createLinkedTransportPair } = await import(
|
||||
'./InProcessTransport.js'
|
||||
)
|
||||
const context = createChromeContext((serverRef as McpStdioServerConfig).env)
|
||||
const context = createChromeContext(
|
||||
(serverRef as McpStdioServerConfig).env,
|
||||
)
|
||||
inProcessServer = createClaudeForChromeMcpServer(context)
|
||||
const [clientTransport, serverTransport] = createLinkedTransportPair()
|
||||
await inProcessServer.connect(serverTransport)
|
||||
@@ -924,7 +930,8 @@ export const connectToServer = memoize(
|
||||
logMCPDebug(name, `In-process Chrome MCP server started`)
|
||||
} else if (
|
||||
feature('CHICAGO_MCP') &&
|
||||
((serverRef as ScopedMcpServerConfig).type === 'stdio' || !(serverRef as ScopedMcpServerConfig).type) &&
|
||||
((serverRef as ScopedMcpServerConfig).type === 'stdio' ||
|
||||
!(serverRef as ScopedMcpServerConfig).type) &&
|
||||
isComputerUseMCPServer!(name)
|
||||
) {
|
||||
// Run the Computer Use MCP server in-process — same rationale as
|
||||
@@ -941,7 +948,10 @@ export const connectToServer = memoize(
|
||||
await inProcessServer.connect(serverTransport)
|
||||
transport = clientTransport
|
||||
logMCPDebug(name, `In-process Computer Use MCP server started`)
|
||||
} else if ((serverRef as ScopedMcpServerConfig).type === 'stdio' || !(serverRef as ScopedMcpServerConfig).type) {
|
||||
} else if (
|
||||
(serverRef as ScopedMcpServerConfig).type === 'stdio' ||
|
||||
!(serverRef as ScopedMcpServerConfig).type
|
||||
) {
|
||||
const stdioRef = serverRef as McpStdioServerConfig
|
||||
const finalCommand =
|
||||
process.env.CLAUDE_CODE_SHELL_PREFIX || stdioRef.command
|
||||
@@ -958,7 +968,9 @@ export const connectToServer = memoize(
|
||||
stderr: 'pipe', // prevents error output from the MCP server from printing to the UI
|
||||
})
|
||||
} else {
|
||||
throw new Error(`Unsupported server type: ${(serverRef as ScopedMcpServerConfig).type}`)
|
||||
throw new Error(
|
||||
`Unsupported server type: ${(serverRef as ScopedMcpServerConfig).type}`,
|
||||
)
|
||||
}
|
||||
|
||||
// Set up stderr logging for stdio transport before connecting in case there are any stderr
|
||||
@@ -3247,8 +3259,14 @@ async function callMCPTool({
|
||||
}
|
||||
|
||||
function extractToolUseId(message: AssistantMessage): string | undefined {
|
||||
const firstBlock = (message.message.content as ContentBlockParam[] | undefined)?.[0]
|
||||
if (!firstBlock || typeof firstBlock === 'string' || firstBlock.type !== 'tool_use') {
|
||||
const firstBlock = (
|
||||
message.message.content as ContentBlockParam[] | undefined
|
||||
)?.[0]
|
||||
if (
|
||||
!firstBlock ||
|
||||
typeof firstBlock === 'string' ||
|
||||
firstBlock.type !== 'tool_use'
|
||||
) {
|
||||
return undefined
|
||||
}
|
||||
return firstBlock.id
|
||||
|
||||
Reference in New Issue
Block a user