Skip to content

Add support for ForwardAgent SSH config directive #62

Description

@raphaelbahat

Description

Currently, ssh-mcp-server does not support parsing or honoring the ForwardAgent directive from ~/.ssh/config. This limits the ability to use pre-configured SSH agent forwarding settings defined in standard SSH configuration files.

Requested Feature

Add support for the ForwardAgent SSH config directive so that users can configure agent forwarding through their ~/.ssh/config file, similar to how native SSH clients work.

Expected behavior:

  • Parse ForwardAgent yes/no from host blocks in ~/.ssh/config
  • When ForwardAgent yes is set for a host alias and that alias is used with --host, automatically enable agent forwarding without requiring explicit --agent parameter

Current Workaround

Users currently must:

  1. Manually determine their SSH agent socket path (e.g., $SSH_AUTH_SOCK)
  2. Explicitly pass it via --agent /path/to/socket for each connection

This is less convenient than leveraging existing SSH config settings.

Related Code

  • SSH config parser: src/utils/ssh-config-parser.ts (currently only extracts hostname, user, port, identityfile)
  • SSH connection config types: src/models/types.ts (has agent?: string field)
  • SSH connection manager: src/services/ssh-connection-manager.ts (handles agent authentication)

Benefits

  • Better integration with standard SSH configuration workflows
  • Reduced need for manual parameter specification
  • Consistency with native SSH client behavior

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions