Skip to content

MCP api_key authentification fails #1207

@maxjeblick

Description

@maxjeblick

Version

1.3.1

Which installation method(s) does this occur on?

No response

Describe the bug.

When using the workflow below (adpated from the NAT example), the authentification fails.

The mcp tool should be the equivalent of

"servers": {
  "kaggle": {
    "url": "https://www.kaggle.com/mcp",
    "type": "http",
      "headers" : {
      "authorization": "Bearer ${YOUR_TOKEN}"
		}
	}
}

see https://www.kaggle.com/docs/mcp.

Minimum reproducible example

llms:
   # Tell NeMo Agent Toolkit which LLM to use for the agent
   nim_llm:
      _type: nim
      model_name: meta/llama-3.1-70b-instruct
      temperature: 0.0
function_groups:
  kaggle_mcp_tools:
    _type: mcp_client
    server:
      transport: streamable-http
      url: https://www.kaggle.com/mcp
      auth_provider: kaggle
    include:
      - list_dataset_files
      - search_datasets
      - search_notebooks
      - list_models
      - search_competitions
  huggingface_mcp_tools:
    _type: mcp_client
    server:
      transport: streamable-http
      url: https://huggingface.co/mcp
    include:
      - hub_repo_details
authentication:
  kaggle:
    _type: api_key
    raw_key: ${KAGGLE_TOKEN}
    auth_scheme: Bearer
workflow:
   # Use an agent that 'reasons' and 'acts'
   _type: react_agent
   # Give it access to our kaggle search tool
   tool_names: [kaggle]
   # Tell it which LLM to use
   llm_name: nim_llm
   # Make it verbose
   verbose: true
   # Retry up to 3 times
   parse_agent_response_max_retries: 3

Relevant log output

Click here to see error details

(datascout-agent) ✘ mjeblick@888c354-lcedt  /mnt/2tb/PyCharmProjects/ai-dataset-research  ↱ max/new_kaggle_mcp  nat run --config_file ./datascout_agent/src/datascout_agent/configs/debug_config.yml --input "Find datasets for chart QA"
2025-11-26 12:21:50 - INFO - nat.cli.commands.start:192 - Starting NAT from config file: 'datascout_agent/src/datascout_agent/configs/debug_config.yml'
2025-11-26 12:21:50 - WARNING - nat.experimental.decorators.experimental_warning_decorator:59 - The Authentication feature is experimental and the API may change in future releases. Future versions may introduce breaking changes without notice. Function: nat.builder.workflow_builder.WorkflowBuilder.add_auth_provider
2025-11-26 12:21:50 - ERROR - nat.builder.workflow_builder:1010 - Failed to initialize component kaggle_mcp_tools (function_groups)
2025-11-26 12:21:50 - ERROR - nat.builder.workflow_builder:1013 - Successfully built components:
2025-11-26 12:21:50 - ERROR - nat.builder.workflow_builder:1015 - - kaggle (authentication)
2025-11-26 12:21:50 - ERROR - nat.builder.workflow_builder:1020 - Remaining components to build:
2025-11-26 12:21:50 - ERROR - nat.builder.workflow_builder:1022 - - huggingface_mcp_tools (function_groups)
2025-11-26 12:21:50 - ERROR - nat.builder.workflow_builder:1022 - - nim_llm (llms)
2025-11-26 12:21:50 - ERROR - nat.builder.workflow_builder:1022 - - (workflow)
2025-11-26 12:21:50 - ERROR - nat.builder.workflow_builder:1026 - Original error: 'APIKeyAuthProviderConfig' object has no attribute 'default_user_id'
Traceback (most recent call last):
File "/mnt/2tb/PyCharmProjects/ai-dataset-research/.venv/lib/python3.13/site-packages/nat/builder/workflow_builder.py", line 1113, in populate_builder
await self.add_function_group(component_instance.name,
cast(FunctionGroupBaseConfig, component_instance.config))
File "/mnt/2tb/PyCharmProjects/ai-dataset-research/.venv/lib/python3.13/site-packages/nat/builder/workflow_builder.py", line 491, in add_function_group
build_result = await self._build_function_group(name=name, config=config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/2tb/PyCharmProjects/ai-dataset-research/.venv/lib/python3.13/site-packages/nat/builder/workflow_builder.py", line 456, in _build_function_group
build_result = await self._get_exit_stack().enter_async_context(build_fn(config, inner_builder))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/mjeblick/.local/share/uv/python/cpython-3.13.5-linux-x86_64-gnu/lib/python3.13/contextlib.py", line 668, in enter_async_context
result = await _enter(cm)
^^^^^^^^^^^^^^^^
File "/home/mjeblick/.local/share/uv/python/cpython-3.13.5-linux-x86_64-gnu/lib/python3.13/contextlib.py", line 214, in aenter
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "/mnt/2tb/PyCharmProjects/ai-dataset-research/.venv/lib/python3.13/site-packages/nat/profiler/decorators/framework_wrapper.py", line 135, in wrapper
async with func(workflow_config, builder) as result:
~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/mjeblick/.local/share/uv/python/cpython-3.13.5-linux-x86_64-gnu/lib/python3.13/contextlib.py", line 214, in aenter
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "/mnt/2tb/PyCharmProjects/ai-dataset-research/.venv/lib/python3.13/site-packages/nat/profiler/decorators/framework_wrapper.py", line 174, in base_fn
async with original_build_fn(*args, **kwargs) as w:
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "/home/mjeblick/.local/share/uv/python/cpython-3.13.5-linux-x86_64-gnu/lib/python3.13/contextlib.py", line 214, in aenter
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "/mnt/2tb/PyCharmProjects/ai-dataset-research/.venv/lib/python3.13/site-packages/nat/plugins/mcp/client_impl.py", line 510, in mcp_client_function_group
base_user_id = auth_provider.config.default_user_id if auth_provider else None
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/2tb/PyCharmProjects/ai-dataset-research/.venv/lib/python3.13/site-packages/pydantic/main.py", line 991, in getattr
raise AttributeError(f'{type(self).name!r} object has no attribute {item!r}')

Other/Misc.

auth_provider.config
Out[2]: APIKeyAuthProviderConfig(raw_key', auth_scheme=<HeaderAuthScheme.BEARER: 'Bearer'>, custom_header_name=None, custom_header_prefix=None)

APIKeyAuthProviderConfig is missing default_user_id field, which is needed, however (see traceback).

Code of Conduct

  • I agree to follow the NeMo Agent toolkit Code of Conduct
  • I have searched the open bugs and have found no duplicates for this bug report

Metadata

Metadata

Labels

Needs TriageNeed team to review and classifybugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions