Skip to content
19 changes: 19 additions & 0 deletions src/oumi/mcp/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2025 - Oumi
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Allow running as python -m oumi.mcp."""

from oumi.mcp.server import main

main()
23 changes: 3 additions & 20 deletions src/oumi/mcp/config_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,34 +70,17 @@


def get_bundled_configs_dir() -> Path:
"""Get the path to the bundled configs shipped with the package.

Returns:
Path to the configs directory inside the installed package.
"""
"""Return the path to bundled configs shipped with the package."""
return Path(__file__).parent / "configs"


def get_cache_dir() -> Path:
"""Get the path to the user-level config cache directory.

Returns:
Path to ~/.cache/oumi-mcp/configs.
"""
"""Return the path to ~/.cache/oumi-mcp/configs."""
return Path.home() / ".cache" / "oumi-mcp" / "configs"


def get_configs_dir() -> Path:
"""Get the path to the configs directory.

Resolution order (first that exists and contains YAML files wins):
1. OUMI_MCP_CONFIGS_DIR environment variable (explicit override)
2. ~/.cache/oumi-mcp/configs (synced from GitHub, fresher)
3. Bundled configs shipped with the package (always available fallback)

Returns:
Path to the configs directory.
"""
"""Return the configs directory (env override > cache > bundled fallback)."""
env_dir = os.environ.get("OUMI_MCP_CONFIGS_DIR")
if env_dir:
p = Path(env_dir)
Expand Down
9 changes: 6 additions & 3 deletions src/oumi/mcp/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,18 @@
["train", "analyze", "synth", "evaluate", "eval", "infer", "tune", "quantize"]
)

# Base data directory for MCP job state (not cache – must survive reboots).
_MCP_DATA_DIR: Path = Path.home() / ".oumi" / "mcp"

# Default path for the single-file JSON job registry.
DEFAULT_JOBS_FILE: Path = Path.home() / ".cache" / "oumi-mcp" / "oumi-jobs.json"
DEFAULT_JOBS_FILE: Path = _MCP_DATA_DIR / "oumi-jobs.json"

# Directory for job log files (set as OUMI_LOGGING_DIR for local jobs).
# The oumi.launcher LocalClient writes subprocess stdout/stderr here.
JOB_LOGS_DIR: Path = Path.home() / ".cache" / "oumi-mcp" / "job-logs"
JOB_LOGS_DIR: Path = _MCP_DATA_DIR / "job-logs"

# Directory for per-job cloud launch staging files.
JOB_RUNS_DIR: Path = Path.home() / ".cache" / "oumi-mcp" / "job-runs"
JOB_RUNS_DIR: Path = _MCP_DATA_DIR / "job-runs"

# How often to poll launcher status while streaming logs (seconds).
LOG_POLL_INTERVAL_SECONDS: float = 2.0
Expand Down
Loading