Skip to content

arctl mcp build fails with "unknown project type" due to fragile path resolution and file detection (v0.3.3) #579

Description

@startLight2019

Problem

arctl mcp build (v0.3.3) fails with Error: build failed: failed to detect project type: unknown project type when the project directory contains a valid pyproject.toml.

Root Cause

The bug is in internal/cli/mcp/build/build.go:

  1. detectProjectType() (line 59-73) checks for the existence of pyproject.toml, go.mod, etc. If the path argument is not resolved to absolute, or if the working directory differs from the project directory, the file check fails silently and returns "unknown project type".

  2. runBuild() (line 46) in internal/cli/mcp/build.go passes args[0] directly to detectProjectType() without calling filepath.Abs(). When users run arctl mcp build ./my-project from a different working directory, the relative path may not resolve correctly.

  3. Error message (line 73) only says "unknown project type" without listing which files were searched, making it hard to diagnose.

Affected Version

arctl version v0.3.3 (release date: 2026-03-27)

Steps to Reproduce

arctl mcp init python my-mcp-server
cd my-mcp-server
arctl mcp build . --image my-mcp:latest
# or from parent directory:
arctl mcp build my-mcp-server --image my-mcp:latest

Expected Behavior

The command should detect pyproject.toml and successfully build the Docker image.

Suggested Fix

  1. Resolve buildDirectory with filepath.Abs() in runBuild() before passing to Builder.Build().
  2. Improve error message in detectProjectType() to list the files that were searched.
  3. Consider using arctl.yaml (framework + language fields) for project type detection instead of file heuristics, as the main branch already does.

Additional Issue: Docker socket detection on macOS

The checkDockerAvailable() function (line 124-129) calls docker version --format '{{.Server.Version}}' which fails when Docker Desktop uses a non-default context (e.g., desktop-linux) on macOS. The socket path ~/.docker/run/docker.sock may differ from the default. Consider also checking the DOCKER_HOST environment variable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions