hermes-agent/tests/tools
Teknium 38d8446011
feat: implement MCP OAuth 2.1 PKCE client support (#5420)
Implement tools/mcp_oauth.py — the OAuth adapter that mcp_tool.py's
existing auth: oauth hook has been waiting for.

Components:
- HermesTokenStorage: persists tokens + client registration to
  HERMES_HOME/mcp-tokens/<server>.json with 0o600 permissions
- Callback handler factory: per-flow isolated HTTP handlers (safe for
  concurrent OAuth flows across multiple MCP servers)
- OAuthClientProvider integration: wraps the MCP SDK's httpx.Auth
  subclass which handles discovery, DCR, PKCE, token exchange,
  refresh, and step-up auth (403 insufficient_scope) automatically
- Non-interactive detection: warns when gateway/cron environments
  try to OAuth without cached tokens
- Pre-registered client support: injects client_id/secret from config
  for servers that don't support Dynamic Client Registration (e.g. Slack)
- Path traversal protection on server names
- remove_oauth_tokens() for cleanup

Config format:
  mcp_servers:
    sentry:
      url: 'https://mcp.sentry.dev/mcp'
      auth: oauth
      oauth:                          # all optional
        client_id: '...'              # skip DCR
        client_secret: '...'          # confidential client
        scope: 'read write'           # server-provided by default

Also passes oauth config dict through from mcp_tool.py (was passing
only server_name and url before).

E2E verified: full OAuth flow (401 → discovery → DCR → authorize →
token exchange → authenticated request → tokens persisted) against
local test servers. 23 unit tests + 186 MCP suite tests pass.
2026-04-05 22:08:00 -07:00
..
__init__.py
…
test_ansi_strip.py
…
test_approval.py fix(gateway): isolate approval session key per turn 2026-04-03 17:50:01 -07:00
test_browser_camofox.py
…
test_browser_camofox_persistence.py
…
test_browser_camofox_state.py
…
test_browser_cdp_override.py
…
test_browser_cleanup.py
…
test_browser_console.py
…
test_browser_content_none_guard.py
…
test_browser_homebrew_paths.py
…
test_browser_secret_exfil.py
…
test_browser_ssrf_local.py
…
test_checkpoint_manager.py
…
test_clarify_tool.py
…
test_clipboard.py
…
test_code_execution.py fix: remove stale test skips, fix regex backtracking, file search bug, and test flakiness 2026-04-04 10:18:57 -07:00
test_command_guards.py
…
test_config_null_guard.py
…
test_credential_files.py feat: wire skills.external_dirs into all remaining discovery paths 2026-04-03 21:14:42 -07:00
test_cron_prompt_injection.py
…
test_cronjob_tools.py
…
test_daytona_environment.py
…
test_debug_helpers.py
…
test_delegate.py fix: keep ACP stdout protocol-clean 2026-04-05 12:05:13 -07:00
test_delegate_toolset_scope.py
…
test_docker_environment.py feat: add docker_env config for explicit container environment variables (#4738) 2026-04-03 23:30:12 -07:00
test_docker_find.py
…
test_env_passthrough.py
…
test_file_operations.py
…
test_file_read_guards.py
…
test_file_staleness.py
…
test_file_tools.py
…
test_file_tools_live.py fix: remove stale test skips, fix regex backtracking, file search bug, and test flakiness 2026-04-04 10:18:57 -07:00
test_file_write_safety.py
…
test_force_dangerous_override.py
…
test_fuzzy_match.py
…
test_hidden_dir_filter.py
…
test_homeassistant_tool.py
…
test_interrupt.py
…
test_llm_content_none_guard.py
…
test_local_env_blocklist.py
…
test_local_persistent.py
…
test_managed_browserbase_and_modal.py
…
test_managed_media_gateways.py
…
test_managed_modal_environment.py
…
test_managed_tool_gateway.py
…
test_mcp_dynamic_discovery.py
…
test_mcp_oauth.py feat: implement MCP OAuth 2.1 PKCE client support (#5420) 2026-04-05 22:08:00 -07:00
test_mcp_probe.py fix: remove stale test skips, fix regex backtracking, file search bug, and test flakiness 2026-04-04 10:18:57 -07:00
test_mcp_stability.py fix(mcp): stability fix pack — reload timeout, shutdown cleanup, event loop handler, OAuth non-blocking (#4757) 2026-04-03 02:29:20 -07:00
test_mcp_tool.py fix(gateway): normalize step_callback prev_tools for backward compat 2026-04-02 20:54:27 -07:00
test_mcp_tool_issue_948.py fix: remove stale test skips, fix regex backtracking, file search bug, and test flakiness 2026-04-04 10:18:57 -07:00
test_memory_tool.py fix(memory): profile-scoped memory isolation and clone support (#4845) 2026-04-03 13:10:11 -07:00
test_mixture_of_agents_tool.py
…
test_modal_sandbox_fixes.py
…
test_modal_snapshot_isolation.py
…
test_osv_check.py feat: OSV malware check for MCP extension packages (#5305) 2026-04-05 12:46:07 -07:00
test_parse_env_var.py
…
test_patch_parser.py
…
test_process_registry.py
…
test_read_loop_detection.py
…
test_registry.py
…
test_rl_training_tool.py
…
test_search_hidden_dirs.py
…
test_send_message_missing_platforms.py
…
test_send_message_tool.py fix: resolve listed messaging targets consistently 2026-04-05 11:59:28 -07:00
test_session_search.py
…
test_singularity_preflight.py
…
test_skill_env_passthrough.py
…
test_skill_improvements.py
…
test_skill_manager_tool.py
…
test_skill_size_limits.py
…
test_skill_view_path_check.py
…
test_skill_view_traversal.py
…
test_skills_guard.py
…
test_skills_hub.py
…
test_skills_hub_clawhub.py
…
test_skills_sync.py
…
test_skills_tool.py
…
test_ssh_environment.py
…
test_symlink_prefix_confusion.py
…
test_terminal_disk_usage.py
…
test_terminal_exit_semantics.py feat: add exit code context for common CLI tools in terminal results (#5144) 2026-04-04 16:57:24 -07:00
test_terminal_requirements.py
…
test_terminal_timeout_output.py
…
test_terminal_tool_requirements.py
…
test_tirith_security.py
…
test_todo_tool.py
…
test_transcription.py
…
test_transcription_tools.py
…
test_url_safety.py
…
test_vision_tools.py
…
test_voice_cli_integration.py
…
test_voice_mode.py
…
test_web_tools_config.py
…
test_web_tools_tavily.py
…
test_website_policy.py
…
test_windows_compat.py
…
test_write_deny.py
…
test_yolo_mode.py
…