Skip to content

add http header auth config #4982

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

newfish-cmyk
Copy link
Collaborator

No description provided.

Copy link

github-actions bot commented Jun 9, 2025

Preview mcp_server Image: ghcr.io/labring/fastgpt-pr:fatsgpt_mcp_server_d3fbbc522313bc566281c67ab9c96cfd6664ed2c

Copy link

github-actions bot commented Jun 9, 2025

Preview sandbox Image: ghcr.io/labring/fastgpt-pr:fatsgpt_sandbox_d3fbbc522313bc566281c67ab9c96cfd6664ed2c

Copy link

github-actions bot commented Jun 9, 2025

Preview fastgpt Image: ghcr.io/labring/fastgpt-pr:fatsgpt_d3fbbc522313bc566281c67ab9c96cfd6664ed2c

Copy link

github-actions bot commented Jun 9, 2025

Preview mcp_server Image: ghcr.io/labring/fastgpt-pr:fatsgpt_mcp_server_5bf3a3e6f5091677e3b80029097d9b81386c5125

Copy link

github-actions bot commented Jun 9, 2025

Preview sandbox Image: ghcr.io/labring/fastgpt-pr:fatsgpt_sandbox_5bf3a3e6f5091677e3b80029097d9b81386c5125

Copy link

github-actions bot commented Jun 9, 2025

Preview fastgpt Image: ghcr.io/labring/fastgpt-pr:fatsgpt_5bf3a3e6f5091677e3b80029097d9b81386c5125

Copy link

github-actions bot commented Jun 9, 2025

Preview mcp_server Image: ghcr.io/labring/fastgpt-pr:fatsgpt_mcp_server_46cdc5200b6ba0ac51386d3be89bc9cb3d80ec99

Copy link

github-actions bot commented Jun 9, 2025

Preview sandbox Image: ghcr.io/labring/fastgpt-pr:fatsgpt_sandbox_46cdc5200b6ba0ac51386d3be89bc9cb3d80ec99

Copy link

github-actions bot commented Jun 9, 2025

Preview mcp_server Image: ghcr.io/labring/fastgpt-pr:fatsgpt_mcp_server_460356fbbd4c65cc6c7a99c5ccb3d240bcc582e5

Copy link

github-actions bot commented Jun 9, 2025

Preview sandbox Image: ghcr.io/labring/fastgpt-pr:fatsgpt_sandbox_460356fbbd4c65cc6c7a99c5ccb3d240bcc582e5

Copy link

github-actions bot commented Jun 9, 2025

Preview fastgpt Image: ghcr.io/labring/fastgpt-pr:fatsgpt_460356fbbd4c65cc6c7a99c5ccb3d240bcc582e5

@newfish-cmyk newfish-cmyk marked this pull request as ready for review June 10, 2025 02:20

export type HeaderAuthConfigType = {
enableAuth: boolean;
authType: HeaderAuthTypeEnum;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是不是不需要 authType 了,如果下面有 3 个值的话

@@ -201,3 +206,63 @@ export async function rewriteAppWorkflowToSimple(formatNodes: StoreNodeItemType[
});
});
}

export async function secureHttpAuth(nodes: StoreNodeItemType[], appId: string) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

语义化一点,加个动词

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

顺便备注下,是干了哪些事


export async function secureHttpAuth(nodes: StoreNodeItemType[], appId: string) {
const getNodeHttpAuth = (node: StoreNodeItemType) =>
node.flowNodeType === FlowNodeTypeEnum.httpRequest468
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

node.flowNodeType === FlowNodeTypeEnum.httpRequest468 这个不用了,可能还有其他的。只看 input key 好了。

});
}

export const formatHeaderAuth = async (headerAuth: StoreHeaderAuthValueType) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个应该放到 secret/controller 里?看着和 app 没关系

@@ -41,7 +50,7 @@ const Header = ({ url, toolList }: { url: string; toolList: McpToolConfigType[]

const { runAsync: saveMCPTools, loading: isSavingMCPTools } = useRequest2(
async () => {
return await postUpdateMCPTools({ appId, url, toolList });
return await postUpdateMCPTools({ appId, url, toolList, headerAuth });
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改鉴权的话,确认就直接触发了。 不用等手动保存。


const mcpClient = new MCPClient({ url });
const mcpClient = new MCPClient({ url, headerAuth: formattedHeaderAuth });
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

合并一行


const mcpClient = new MCPClient({ url });
const mcpClient = new MCPClient({ url, headerAuth: formattedHeaderAuth });
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

合并

await MongoApp.updateOne(
{ _id: appId },
{
modules: [getMCPToolSetRuntimeNode({ url, toolList, name: app.name, avatar: app.avatar })],
modules: [
getMCPToolSetRuntimeNode({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

和下面合并下

@@ -89,7 +116,11 @@ const updateMCPChildrenTool = async ({
session
}: {
parentApp: AppDetailType;
toolSetData: MCPToolSetData;
toolSetData: {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MCPToolSetData 能不能改造

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants