Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions mcp_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,19 @@ def mcp_client_params(available_toolboxes: dict, requested_toolboxes: list):
if headers and isinstance(headers, dict):
for k, v in headers.items():
headers[k] = swap_env(v)
optional_headers = available_toolboxes[tb]['server_params'].get('optional_headers')
# support {{ env SOMETHING }} for header values as well for e.g. tokens
if optional_headers and isinstance(optional_headers, dict):
for k, v in dict(optional_headers).items():
try:
optional_headers[k] = swap_env(v)
except LookupError as e:
del optional_headers[k]
if isinstance(headers, dict):
if isinstance(optional_headers, dict):
headers.update(optional_headers)
elif isinstance(optional_headers, dict):
headers = optional_headers
# if None will default to float(5) in client code
timeout = available_toolboxes[tb]['server_params'].get('timeout')
server_params['url'] = available_toolboxes[tb]['server_params'].get('url')
Expand All @@ -329,6 +342,19 @@ def mcp_client_params(available_toolboxes: dict, requested_toolboxes: list):
if headers and isinstance(headers, dict):
for k, v in headers.items():
headers[k] = swap_env(v)
optional_headers = available_toolboxes[tb]['server_params'].get('optional_headers')
# support {{ env SOMETHING }} for header values as well for e.g. tokens
if optional_headers and isinstance(optional_headers, dict):
for k, v in dict(optional_headers).items():
try:
optional_headers[k] = swap_env(v)
except LookupError as e:
del optional_headers[k]
if isinstance(headers, dict):
if isinstance(optional_headers, dict):
headers.update(optional_headers)
elif isinstance(optional_headers, dict):
headers = optional_headers
# if None will default to float(5) in client code
timeout = available_toolboxes[tb]['server_params'].get('timeout')
server_params['url'] = available_toolboxes[tb]['server_params'].get('url')
Expand Down
2 changes: 2 additions & 0 deletions taskflows/examples/example_large_list_result_iter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ taskflow:
You do not need to provide a summary of the results.
toolboxes:
- github_official
env:
GITHUB_MCP_TOOLSETS: pull_requests
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
GITHUB_MCP_TOOLSETS: pull_requests
GITHUB_MCP_TOOLSETS: pull_requests # See more available toolsets at: https://github.com/github/github-mcp-server?tab=readme-ov-file#configuration

Copy link
Contributor

Choose a reason for hiding this comment

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

Only add if you think it's necessary (unfortunately, there seems to be no perfect list with all toolsets - at least not in this simple form)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This seems to be more complete docs: https://github.com/github/github-mcp-server/blob/main/docs/remote-server.md as you can see it gets bloated quite a lot compare to the one on readme (default is "all") It is also pretty rubbish in that it doesn't really tells you what header to use. I just have to guest and hope that it is the same as the url

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll add the link in the github_official.yaml file instead as that seems to be a better place for it

Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM

- task:
must_complete: true
repeat_prompt: true
Expand Down
6 changes: 5 additions & 1 deletion toolboxes/github_official.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@ seclab-taskflow-agent:
server_params:
kind: streamable
url: https://api.githubcopilot.com/mcp/
#See https://github.com/github/github-mcp-server/blob/main/docs/remote-server.md
headers:
Authorization: "{{ env GITHUB_AUTH_HEADER }}"
Authorization: "{{ env GITHUB_AUTH_HEADER }}"
optional_headers:
X-MCP-Toolsets: "{{ env GITHUB_MCP_TOOLSETS }}"
X-MCP-Readonly: "{{ env GITHUB_MCP_READONLY }}"