-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add: mcp support as client. #10833
base: main
Are you sure you want to change the base?
Add: mcp support as client. #10833
Conversation
step: number; | ||
} | ||
|
||
const CONTEXT_SIZE_DIVISOR_FOR_OUTPUT = 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think divider
role: "function" as const, | ||
name: "missing_function_call_name", | ||
function_call_id: this.functionCallId ?? "missing_function_call_id", | ||
content: `Error: the content was not tokenized`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this message
role: "function" as const, | ||
name: this.functionCallName, | ||
function_call_id: "missing_function_call_id", | ||
content: `Error: the content was not tokenized`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
role: "function" as const, | ||
name: this.functionCallName, | ||
function_call_id: this.functionCallId, | ||
content: `Error: the content was not tokenized`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one I do understand :p
role: "function" as const, | ||
name: this.functionCallName, | ||
function_call_id: this.functionCallId, | ||
content: `Error: Action output has too many tokens to be included.`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we rather truncate (and append somnething like "[X more characters truncated]") ?
// the generation of the params. We store the action here as the params have been generated, if | ||
// an error occurs later on, the error will be stored on the parent agent message. | ||
const action = await AgentMCPAction.create({ | ||
host: "remote", // TODO(mcp): add the host of the MCP tool dynamically |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OOC can you provide a few more tokens regarding this comment ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm actually reworking this part, should be clearer (also, design doc incoming).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quite cool
// - system: the MCP tool is running inside the Dust system | ||
// - isolated: the MCP tool is running inside a isolated environment (e.g. in a container) | ||
// - remote: the MCP tool is running outside the Dust system (e.g. on another machine) | ||
export type MCPHostType = "client" | "system" | "isolated" | "remote"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very cool
@@ -23,6 +24,9 @@ export type ConversationBaseActionType = | |||
| "conversation_list_files_action" | |||
| "conversation_include_file_action"; | |||
|
|||
export type MCPBaseActionType = MCPActionType["type"]; | |||
// will also support "external" (run by an external server), "custom" (run by us in isolation) and "system" (dust provided actions) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
external -> remote and custom -> isolated ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, i iterated on naming quite a bit :)
e508aae
to
e8fb292
Compare
e8fb292
to
a707330
Compare
a707330
to
8b4a5cd
Compare
Description
This draft PR does 2 things:
Add support for Dust as an MCP client via a new MCPAction
This allow for an agent to run tools exposed by MCP servers.
Add a rudimentary MCP relay server
This allow MCP servers running on localhost (eg: in a Front "app") to be exposed to the dust agent.
It works by exposing a websocket endpoint for the localhost MCP Servers to connect to and keep.
On the other side, it expose itself as an http sse MCPServer to from the standpoint of the Dust Agent MCPClient, it's fully transparent.
The relay itself and the custom communication layer over websocket are very rudimentary, on that stand point it's really a POC.
The first goal is just to enable localhost MCP actions use-cases (to avoid a lot of UI complexity needed by the other uses cases).
Tests
Locally
Risk
Low, behind a feature flag.
Deploy Plan
Deploy the relay in our infra. Deploy
front