feat(mcp): add registryUrl to initialState for improved package manag… (#4279)

* feat(mcp): add registryUrl to initialState for improved package management

* feat(mcp): initialize registryUrl in MCP server state for future enhancements

* fix(inputbar):mcp server list

* refactor(Inputbar): remove unused MCP server variable and console log for cleaner code

* fix(Inputbar): 还原

* fix(Inputbar): Add activedMcpServers to Inputbar component props
This commit is contained in:
MyPrototypeWhat 2025-04-03 18:51:29 +08:00 committed by GitHub
parent 06c730aaf6
commit 23de48ecbd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 7 deletions

View File

@ -180,15 +180,11 @@ const Inputbar: FC<Props> = ({ assistant: _assistant, setActiveTopic, topic }) =
if (mentionModels) {
userMessage.mentions = mentionModels
}
if (isFunctionCallingModel(model)) {
if (!isEmpty(enabledMCPs) && !isEmpty(activedMcpServers)) {
userMessage.enabledMCPs = activedMcpServers.filter((server) =>
enabledMCPs?.some((s) => s.id === server.id)
)
userMessage.enabledMCPs = activedMcpServers.filter((server) => enabledMCPs?.some((s) => s.id === server.id))
}
}
userMessage.usage = await estimateMessageUsage(userMessage)
currentMessageId.current = userMessage.id
@ -208,7 +204,6 @@ const Inputbar: FC<Props> = ({ assistant: _assistant, setActiveTopic, topic }) =
console.error('Failed to send message:', error)
}
}, [
activedMcpServers,
assistant,
dispatch,
files,
@ -219,7 +214,9 @@ const Inputbar: FC<Props> = ({ assistant: _assistant, setActiveTopic, topic }) =
resizeTextArea,
selectedKnowledgeBases,
text,
topic
topic,
enabledMCPs,
activedMcpServers
])
const translate = async () => {

View File

@ -11,6 +11,7 @@ const initialState: MCPConfig = {
baseUrl: '',
command: 'npx',
args: ['-y', '@mcpmarket/mcp-auto-install', 'connect', '--json'],
registryUrl: 'https://registry.npmmirror.com',
env: {},
isActive: false
}

View File

@ -245,6 +245,7 @@ export async function callMCPTool(tool: MCPTool): Promise<any> {
command: resp.data.command,
args: resp.data.args,
env: resp.data.env,
registryUrl: '',
isActive: false
}
store.dispatch(addMCPServer(mcpServer))