Skip to content

Conversation

rjohn-v
Copy link
Contributor

@rjohn-v rjohn-v commented Oct 10, 2025

🐛 Fix: Robot Specifications Not Accessible After pip Install

Problem

When ros-mcp is installed via pip (pip install ros-mcp), the list_verified_robot_specifications tool fails with the error:

Robot specifications directory not found: utils/robot_specifications

This occurs because the code was using relative paths from the current working directory (CWD) instead of resolving paths relative to the installed package location.

Changes Made

1. Moved robot_specifications to Root Level

  • Before: utils/robot_specifications/
  • After: robot_specifications/ (standalone package at project root)
  • Rationale: Robot specifications are configuration/data, not utility code. This provides better separation of concerns and clearer project structure.

2. Fixed Path Resolution in utils/config_utils.py

  • Updated parse_robot_config() and get_robot_specifications() to resolve paths relative to the module's location using Path(__file__).parent.parent / "robot_specifications"
  • Changed default parameter from hardcoded "utils/robot_specifications" to None with dynamic resolution
  • Added proper type hints using modern Python syntax (str | None)

3. Updated Package Configuration

  • pyproject.toml:
    • Added robot_specifications to packages list
    • Added [tool.setuptools.package-data] section to include *.yaml files
  • MANIFEST.in:
    • Added recursive-include robot_specifications *.yaml to include YAML files in source distribution

4. Type Hints Improvements

  • Used modern union syntax (str | None) instead of Optional[str]
  • Fixed type compatibility issues with proper conditional Path object creation

5. Updated inconsistent tool names

Files Changed

MANIFEST.in                     | 1 +
pyproject.toml                  | 5 ++++-
robot_specifications/*          | Moved from utils/robot_specifications/
utils/config_utils.py           | 19 +++++++++++++++----
server.py                       | 6 +++++-

How It Works Now

  1. When specs_dir=None (default), the functions resolve the path relative to the installed package location
  2. When specs_dir is provided, it uses the custom path (backward compatible)
  3. YAML files are properly included in both wheel and source distributions

Testing

After installing via pip:

pip install ros-mcp

The MCP configuration works correctly for Ubuntu

{
  "mcpServers": {
    "ros-mcp-server": {
      "command": "bash",
      "args": [
        "-lc", 
        "ros-mcp --transport=stdio"
      ]
    }
  }
}

For Mac:

{
  "mcpServers":{
    "ros-mcp-server": {
      "command": "zsh",
      "args": [
        "-lc", 
        "ros-mcp --transport=stdio"
      ]
    }
  }
}

And for WSL

{
  "mcpServers":{
    "ros-mcp-server": {
      "command": "wsl",
        "args": [
          "-d", 
          "Ubuntu-22.04", 
          "bash", 
          "-lc", 
          "ros-mcp --transport=stdio"
        ]
    }
}

And list_verified_robot_specifications successfully returns available robot specs regardless of the current working directory.

Note:

  • The instructions for the repository still need to be updated to use pip install. This PR likely fixes the last major bug that prevented it.

Fixes: Issue with robot specifications not being accessible when installed via pip
#141 - Consistent naming of tools

@rjohn-v rjohn-v requested review from lpigeon and stex2005 October 10, 2025 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant