Skip to main content
Glama

list_sessions

View all active SSH connections to monitor and manage remote host sessions established through the MCP SSH Session server.

Instructions

List all active SSH sessions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler for 'list_sessions'. Lists active SSH sessions using session_manager, formats the output as a bullet list or 'No active sessions' message, and returns it as a string.
    @mcp.tool() def list_sessions() -> str: """List all active SSH sessions.""" logger = session_manager.logger.getChild('tool_list_sessions') logger.info("Listing active SSH sessions.") sessions = session_manager.list_sessions() if sessions: response = "Active SSH Sessions:\n" + "\n".join(f"- {s}" for s in sessions) else: response = "No active SSH sessions" logger.debug(f"Response: {response}") return response
  • Helper method in SSHSessionManager class that returns a list of active SSH session keys (formatted as username@host:port) from the internal _sessions dictionary.
    def list_sessions(self) -> list[str]: """List all active session keys.""" logger = self.logger.getChild('list_sessions') with self._lock: sessions = list(self._sessions.keys()) logger.info(f"Listing {len(sessions)} active sessions.") logger.debug(f"Active sessions: {sessions}") return sessions

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/devnullvoid/mcp-ssh-session'

If you have feedback or need assistance with the MCP directory API, please join our Discord server