Skip to content

Conversation

@jussi-sa
Copy link
Contributor

Summary

This PR introduces a flexible command-line configuration system that allows users to selectively enable or disable tools when starting the mcp-devkit-server. This feature provides fine-grained control over which Mapbox DevKit tools are available during a session, improving security and reducing cognitive load by limiting available tools to only those needed for specific tasks.

Changes

Core Implementation

  • Tool Registry System: Created centralized tool registry (toolRegistry.ts) to manage all 12 available tools
  • Configuration Module: Added toolConfig.ts module with argument parsing and tool filtering logic
  • Main Entry Point Updates: Modified index.ts to use the filtered tool set based on command-line arguments
  • No Console Output: Respects stdio transport constraints by avoiding any console logging

Command-Line Options

  • --enable-tools: Specify exact tools to enable (exclusive mode)
  • --disable-tools: Specify tools to disable (all others remain enabled)
  • Precedence: When both options are provided, --enable-tools takes priority

Testing

  • Comprehensive test suite added with 17 test cases
  • Tests cover argument parsing, filtering logic, edge cases, and precedence rules
  • All existing tests continue to pass

Documentation

  • Added TOOL_CONFIGURATION.md with complete usage guide
  • Includes examples for Node.js, NPX, Docker, and Claude Desktop
  • Documents all 12 available tools with descriptions

Benefits

  1. Security: Limit exposure by disabling potentially dangerous operations (e.g., delete_style_tool)
  2. Focus: Reduce cognitive load by showing only relevant tools for the task at hand
  3. Flexibility: Different configurations for different use cases
  4. Backward Compatible: No breaking changes - default behavior unchanged

Example Usage

# Enable only read-only tools (safe mode)
node dist/index.js --enable-tools
list_styles_tool,retrieve_style_tool,preview_style_tool

# Disable dangerous operations
node dist/index.js --disable-tools delete_style_tool,create_token_tool

# Claude Desktop configuration
{
  "mcpServers": {
    "mapbox-devkit": {
      "command": "node",
      "args": ["path/to/index.js", "--enable-tools",
"list_styles_tool,create_style_tool"],
      "env": {
        "MAPBOX_ACCESS_TOKEN": "your-token"
      }
    }
  }
}

Testing

- ✅ All new tests passing (17 new tests)
- ✅ All existing tests passing
- ✅ Build successful
- ✅ Manual testing with various tool combinations

---
🤖 Implementation by Claude (Anthropic) - Enhancing developer tools with intelligent configuration

@jussi-sa jussi-sa requested a review from a team as a code owner August 27, 2025 10:45
Copy link
Member

@zmofei zmofei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me. also tested locally, all good!

@jussi-sa jussi-sa merged commit bdb9d6f into main Aug 27, 2025
1 check passed
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.

2 participants