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
450 changes: 450 additions & 0 deletions docs/connection-testing.md

Large diffs are not rendered by default.

833 changes: 833 additions & 0 deletions docs/design/connection-test-feature.md

Large diffs are not rendered by default.

2,461 changes: 2,461 additions & 0 deletions docs/design/connection-test-implementation-plan.md

Large diffs are not rendered by default.

58 changes: 50 additions & 8 deletions src/itential_mcp/cli/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,65 @@
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later

"""Terminal utilities for CLI output formatting."""

import shutil


class Colors:
"""ANSI color codes for terminal output."""

RED = "\033[91m"
GREEN = "\033[92m"
YELLOW = "\033[93m"
BLUE = "\033[94m"
RESET = "\033[0m"
BOLD = "\033[1m"


def getcols() -> int:
"""
Get the number of columns for the current terminal session
"""Get the number of columns for the current terminal session.

This function will get the current terminal size and return the number of
columns in the current terminal.

Returns:
int: The number of columns for the current terminal.
"""
return shutil.get_terminal_size().columns


def print_success(message: str) -> None:
"""Print success message in green.

Args:
None
message: The message to print.
"""
print(f"{Colors.GREEN}{message}{Colors.RESET}")

Returns:
int: The number of columns for the current terminal

Raises:
None
def print_error(message: str) -> None:
"""Print error message in red.

Args:
message: The message to print.
"""
return shutil.get_terminal_size().columns
print(f"{Colors.RED}{message}{Colors.RESET}")


def print_warning(message: str) -> None:
"""Print warning message in yellow.

Args:
message: The message to print.
"""
print(f"{Colors.YELLOW}{message}{Colors.RESET}")


def print_info(message: str) -> None:
"""Print info message in blue.

Args:
message: The message to print.
"""
print(f"{Colors.BLUE}{message}{Colors.RESET}")
14 changes: 14 additions & 0 deletions src/itential_mcp/config/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,20 @@ class ServerConfig:
},
)

test_connection_on_startup: bool = _create_field_with_env(
"ITENTIAL_MCP_SERVER_TEST_CONNECTION_ON_STARTUP",
"Test platform connection during server startup",
default=defaults.ITENTIAL_MCP_SERVER_TEST_CONNECTION_ON_STARTUP,
env_getter=env.getbool,
)

startup_test_timeout: int = _create_field_with_env(
"ITENTIAL_MCP_SERVER_STARTUP_TEST_TIMEOUT",
"Timeout for startup connection test in seconds",
default=defaults.ITENTIAL_MCP_SERVER_STARTUP_TEST_TIMEOUT,
env_getter=env.getint,
)


@dataclass(frozen=True)
class AuthConfig:
Expand Down
6 changes: 6 additions & 0 deletions src/itential_mcp/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@
ITENTIAL_MCP_SERVER_RESPONSE_FORMAT = (
"json" # Response serialization format: json, toon, or auto
)
ITENTIAL_MCP_SERVER_TEST_CONNECTION_ON_STARTUP = (
False # Test platform connection during server startup
)
ITENTIAL_MCP_SERVER_STARTUP_TEST_TIMEOUT = (
30 # Timeout for startup connection test in seconds
)
ITENTIAL_MCP_SERVER_AUTH_TYPE = "none" # Authentication provider type
ITENTIAL_MCP_SERVER_AUTH_JWKS_URI = None # JWKS URI for JWT validation
ITENTIAL_MCP_SERVER_AUTH_PUBLIC_KEY = (
Expand Down
Loading