Skip to content

Commit

Permalink
wip: mcp support
Browse files Browse the repository at this point in the history
  • Loading branch information
Fraggle committed Feb 16, 2025
1 parent bd437cb commit e508aae
Show file tree
Hide file tree
Showing 41 changed files with 6,397 additions and 5 deletions.
2 changes: 2 additions & 0 deletions front/admin/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
AgentGithubGetPullRequestAction,
} from "@app/lib/models/assistant/actions/github";
import { AgentGithubConfiguration } from "@app/lib/models/assistant/actions/github";
import { AgentMCPAction } from "@app/lib/models/assistant/actions/mcp";
import {
AgentProcessAction,
AgentProcessConfiguration,
Expand Down Expand Up @@ -178,6 +179,7 @@ async function main() {
await AgentGithubGetPullRequestAction.sync({ alter: true });
await AgentGithubCreateIssueAction.sync({ alter: true });
await AgentReasoningAction.sync({ alter: true });
await AgentMCPAction.sync({ alter: true });

await RetrievalDocument.sync({ alter: true });
await RetrievalDocumentChunk.sync({ alter: true });
Expand Down
33 changes: 33 additions & 0 deletions front/components/actions/mcp/MCPActionDetails.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { ServerIcon } from "@dust-tt/sparkle";
import { Markdown } from "@dust-tt/sparkle";
import type { MCPActionType } from "@dust-tt/types";

import { ActionDetailsWrapper } from "@app/components/actions/ActionDetailsWrapper";
import type { ActionDetailsComponentBaseProps } from "@app/components/actions/types";

export function MCPActionDetails({
action,
defaultOpen,
}: ActionDetailsComponentBaseProps<MCPActionType>) {
return (
<ActionDetailsWrapper
actionName="Calling a tool"
defaultOpen={defaultOpen}
visual={ServerIcon}
>
<div className="flex flex-col gap-1 gap-4 py-4 pl-6">
{action.output && (
<div className="text-sm font-normal text-muted-foreground dark:text-muted-foreground-night">
<Markdown
content={`\`\`\`json\n${action.output.replaceAll("\\n", "\n")}`}
textColor="text-muted-foreground"
isStreaming={false}
forcedTextSize="md"
isLastMessage={false}
/>
</div>
)}
</div>
</ActionDetailsWrapper>
);
}
5 changes: 5 additions & 0 deletions front/components/actions/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { ConversationIncludeFileActionDetails } from "@app/components/actions/co
import { DustAppRunActionDetails } from "@app/components/actions/dust_app_run/DustAppRunActionDetails";
import { GithubCreateIssueActionDetails } from "@app/components/actions/github/GithubCreateIssueActionDetails";
import { GithubGetPullRequestActionDetails } from "@app/components/actions/github/GithubGetPullRequestActionDetails";
import { MCPActionDetails } from "@app/components/actions/mcp/MCPActionDetails";
import { ProcessActionDetails } from "@app/components/actions/process/ProcessActionDetails";
import { ReasoningActionDetails } from "@app/components/actions/reasoning/ReasoningActionDetails";
import { RetrievalActionDetails } from "@app/components/actions/retrieval/RetrievalActionDetails";
Expand Down Expand Up @@ -76,6 +77,10 @@ const actionsSpecification: ActionSpecifications = {
detailsComponent: ReasoningActionDetails,
runningLabel: ACTION_RUNNING_LABELS.reasoning_action,
},
mcp_action: {
detailsComponent: MCPActionDetails,
runningLabel: ACTION_RUNNING_LABELS.mcp_action,
},
};

export function getActionSpecification<T extends ActionType>(
Expand Down
1 change: 1 addition & 0 deletions front/components/assistant/conversation/AgentMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ export function AgentMessage({
case "reasoning_started":
case "reasoning_thinking":
case "reasoning_tokens":
case "mcp_params":
setStreamedAgentMessage((m) => {
return updateMessageWithAction(m, event.action);
});
Expand Down
Loading

0 comments on commit e508aae

Please sign in to comment.