Skip to content

Configure MCP servers, implement "Add Docker Compose Service" Claude Code command - #178

Merged
bubacoder merged 3 commits into
mainfrom
feature/claude-add-serivce-command
Aug 15, 2025
Merged

Configure MCP servers, implement "Add Docker Compose Service" Claude Code command#178
bubacoder merged 3 commits into
mainfrom
feature/claude-add-serivce-command

Conversation

@bubacoder

@bubacoder bubacoder commented Aug 14, 2025

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Added an app-icon resolution tool that prefers dashboard icons and falls back to site favicons.
    • Expanded MCP integrations with new servers (Context7, GitHub, Postgres, Playwright) and added interactive inputs for credentials/DB URL.
    • Added project-level MCP configuration for streamlined server connections.
  • Documentation

    • Added a step-by-step guide for adding Docker Compose services, including linting and verification.
    • Updated Docker service template metadata and simplified Traefik example.
  • Chores

    • Added script dependencies for icon discovery (requests, beautifulsoup4).

@coderabbitai

coderabbitai Bot commented Aug 14, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Adds MCP configuration and VS Code MCP inputs/servers, implements a new MCP tool "find-app-icon" with a supporting AppIconFinder utility and new dependencies, adds a Docker Compose command doc, and tweaks docker/guidelines.md template metadata and Traefik example.

Changes

Cohort / File(s) Change Summary
MCP root config
/.mcp.json
Adds .mcp.json defining an HTTP MCP server entry "context7" at https://mcp.context7.com/mcp.
VS Code MCP config
/.vscode/mcp.json
Adds top-level inputs (GitHub PAT, Postgres URL); converts homelab-infra launcher from url to stdio; adds context7, github, postgres, and playwright servers; wires env/inputs into github and postgres servers; postgres uses a docker run stdio launcher.
MCP tool & utility
/scripts/task-mcp/server.py, /scripts/task-mcp/find_app_icon.py, /scripts/task-mcp/requirements.txt
Adds AppIconFinder utility to resolve dashboard CDN icons or favicons and a new MCP tool find-app-icon in server.py. Adds requests and beautifulsoup4 to requirements. Error handling returns "default" on failure.
Docker docs & command
/docker/guidelines.md, /.claude/commands/add-compose-service.md
Updates template metadata labels/emojis and removes Traefik Host rule from example; adds .claude/commands/add-compose-service.md documenting how to add a Docker Compose service, file location, TODOs, linting, and image pull verification.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant VSCode as MCP Client (VS Code)
  participant TaskMCP as task-mcp Server
  participant Finder as AppIconFinder
  participant CDN as Dashboard Icons CDN
  participant Site as App Homepage

  User->>VSCode: request find-app-icon(app_name, homepage_url)
  VSCode->>TaskMCP: call tool find-app-icon
  TaskMCP->>Finder: get_app_icon(app_name, homepage_url)
  alt Dashboard icon exists
    Finder->>CDN: HEAD /.../{normalized}.png
    CDN-->>Finder: 200
    Finder-->>TaskMCP: normalized icon name
  else Fallback to favicon
    Finder->>Site: GET homepage
    Site-->>Finder: HTML with <link rel="icon">...
    Finder-->>TaskMCP: resolved favicon URL or "default"
  end
  TaskMCP-->>VSCode: result string
  VSCode-->>User: icon name or URL
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Update documentation #167 — Also modifies docker/guidelines.md and likely related to the template metadata and Traefik routing example changes.

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/claude-add-serivce-command

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🔭 Outside diff range comments (1)
docker/guidelines.md (1)

185-187: Traefik Host rule omitted in the new service template; likely breaks routing.

The “Traefik Labels Pattern” section still shows a Host rule, but the new-service template no longer includes it. Without a router rule (or a global defaultRule/file-provider), services won’t be addressable.

Add the Host rule back, or add a comment explaining the global rule in use. Example fix:

     labels:
       traefik.enable: true
+      # If you rely on a global defaultRule/file-provider, adjust accordingly.
+      traefik.http.routers.service-name.rule: Host(`service.${MYDOMAIN}`)
       traefik.http.routers.service-name.middlewares: middleware-name@file
       traefik.http.services.service-name.loadbalancer.server.port: PORT
🧹 Nitpick comments (3)
scripts/task-mcp/requirements.txt (1)

2-3: Dependency strategy: consider tighter minimums and reproducibility.

  • requests>=2.25.0 is quite old; recommend bumping minimum to a modern baseline (e.g., 2.32.3) to avoid known CVEs.
  • Consider pinning via constraints or lockfile (e.g., uv/pyproject + uv.lock or pip-tools with hashes) for reproducible dev setups.

Apply one of:

-requests>=2.25.0
+requests>=2.32.3

Or migrate this directory to a pyproject.toml with uv-managed locking for deterministic installs.

docker/guidelines.md (1)

188-193: Optional: tie in your new icon workflow.

Since this PR adds an MCP tool to find app icons, consider referencing it in the template/comments so authors consistently populate homepage.icon with high-quality assets.

I can add a brief note here pointing to the MCP “find-app-icon” tool and the expected icon naming.

.claude/commands/add-compose-service.md (1)

5-7: Tighten variable declarations formatting.

Use a colon after the heading and remove the extra blank line to reduce ambiguity in parsing by some renderers.

-## Variables
-
-APPLICATION_NAME: $ARGUMENTS
-APPLICATION_HOMEPAGE: $ARGUMENTS
+## Variables:
+APPLICATION_NAME: $ARGUMENTS
+APPLICATION_HOMEPAGE: $ARGUMENTS
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these settings in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between adf76ea and 32ef1ae.

📒 Files selected for processing (7)
  • .claude/commands/add-compose-service.md (1 hunks)
  • .mcp.json (1 hunks)
  • .vscode/mcp.json (1 hunks)
  • docker/guidelines.md (1 hunks)
  • scripts/task-mcp/find_app_icon.py (1 hunks)
  • scripts/task-mcp/requirements.txt (1 hunks)
  • scripts/task-mcp/server.py (2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-08-06T20:29:29.605Z
Learnt from: CR
PR: bubacoder/infra#0
File: CLAUDE.md:0-0
Timestamp: 2025-08-06T20:29:29.605Z
Learning: Applies to docker/**/*.{yml,yaml} : Docker Compose files for services should be placed under the docker/ directory, organized by service type (e.g., security, media, storage, monitoring).

Applied to files:

  • .claude/commands/add-compose-service.md
📚 Learning: 2025-08-06T20:29:29.605Z
Learnt from: CR
PR: bubacoder/infra#0
File: CLAUDE.md:0-0
Timestamp: 2025-08-06T20:29:29.605Z
Learning: Use Docker and Docker Compose for containerized services.

Applied to files:

  • .claude/commands/add-compose-service.md
🧬 Code Graph Analysis (2)
.claude/commands/add-compose-service.md (2)
docs/web/update-docs.py (3)
  • process_docker_compose_file (295-337)
  • process_docker_directory (339-352)
  • process_docker_stack_index (252-260)
docker/labctl.py (1)
  • docker_command (94-133)
scripts/task-mcp/server.py (1)
scripts/task-mcp/find_app_icon.py (2)
  • AppIconFinder (8-91)
  • get_app_icon (22-45)
🪛 LanguageTool
.claude/commands/add-compose-service.md

[grammar] ~5-~5: There might be a mistake here.
Context: ... Variables APPLICATION_NAME: $ARGUMENTS APPLICATION_HOMEPAGE: $ARGUMENTS ## Ins...

(QB_NEW_EN)


[grammar] ~15-~15: There might be a mistake here.
Context: ...ack to plain docker deployment examples. - Based on the application's type, determi...

(QB_NEW_EN)


[grammar] ~16-~16: There might be a mistake here.
Context: ...der) this application belong to. Do not create new category, use the category "tools" ...

(QB_NEW_EN)


[grammar] ~16-~16: There might be a mistake here.
Context: ..., use the category "tools" for fallback. - Based on the patterns in docker/guidelin...

(QB_NEW_EN)


[grammar] ~17-~17: There might be a mistake here.
Context: ..." for fallback. - Based on the patterns in docker/guidelines.md file and the found...

(QB_NEW_EN)


[style] ~18-~18: Consider using the synonym “brief” (= concise, using a few words, not lasting long) to strengthen your wording.
Context: ...sure the docker-compose file contains a short description of the project and links to...

(QUICK_BRIEF)


[grammar] ~18-~18: There might be a mistake here.
Context: ...setup example (whether it is available). - If the installation guide mentions furth...

(QB_NEW_EN)


[style] ~19-~19: Consider an alternative to strengthen your wording.
Context: ...). - If the installation guide mentions further improvements, e.g. a) use of an optional database in...

(IMPROVEMENTS_REFINEMENTS)


[grammar] ~19-~19: There might be a mistake here.
Context: ...in the head section of the compose file. - Also mention as TODO if new environment ...

(QB_NEW_EN)


[grammar] ~20-~20: There might be a mistake here.
Context: ...ion of the compose file. - Also mention as TODO if new environment variables needs...

(QB_NEW_EN)


[grammar] ~22-~22: There might be a mistake here.
Context: .../`, check if this succeeds.

(QB_NEW_EN)

🪛 Checkov (3.2.334)
.vscode/mcp.json

[MEDIUM] 14-15: Basic Auth Credentials

(CKV_SECRET_4)

🪛 Biome (2.1.2)
.vscode/mcp.json

[error] 23-23: Expected a property but instead found '}'.

Expected a property here.

(parse)

🔇 Additional comments (14)
.mcp.json (1)

3-7: Confirm intent: duplicate 'context7' server defined here (HTTP) and in .vscode/mcp.json (STDIO).

You’re declaring the same logical server name via two transports in two different configs. Some clients may surface both, others may de-dupe by name. If both configs are consumed by the same client, consider renaming one or consolidating to avoid confusion.

Would you like me to scan the repo for other MCP configs and list overlapping server names so we can standardize?

scripts/task-mcp/requirements.txt (1)

1-3: Verify install path: uv run may not install from requirements.txt automatically.

In .vscode/mcp.json, the server is launched with uv run --directory scripts/task-mcp server.py. Unless scripts/task-mcp contains a pyproject.toml declaring fastmcp, requests, and beautifulsoup4, imports may fail at runtime.

I can add a minimal pyproject.toml here. Do you want me to open a patch that defines the project and these dependencies so uv run Just Works?

docker/guidelines.md (1)

167-169: Header metadata tweak looks good.

Switch to “📦 Source” and “📜 Docs” reads well and is consistent.

.vscode/mcp.json (5)

24-28: Context7 duplication across configs; verify you want both HTTP and STDIO variants.

You define context7 here (stdio via npx) and in .mcp.json (http). If both are used by the same client, prefer one consistent transport to avoid confusion.

Do you plan to keep both for different clients (e.g., VS Code vs. other MCP hosts)? If not, I can prepare a patch to standardize on one.


4-17: Inputs look good; minor note on secret handling.

Using promptString with password=true is appropriate. Ensure these IDs match env resolution exactly in the servers’ env blocks.


36-42: Docker-based STDIO server: validate image availability and transport.

Running the Postgres MCP via docker run -i is fine if the image prints MCP over stdio. Ensure the image exists locally or is pulled automatically, and that host Docker is accessible in VS Code context.

I can add a Taskfile or a devcontainer postCreateCommand to build/pull postgres-mcp:latest so this server is ready out of the box. Want me to?


29-35: Env var name is correct — no change required

The @modelcontextprotocol/server-github expects GITHUB_PERSONAL_ACCESS_TOKEN (confirmed from the project README/npm), so the .vscode/mcp.json entry is correct.

  • File: .vscode/mcp.json (lines 29–35)
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github-personal-access-token}"
      }
    },

20-23: Ensure uv can resolve project deps in scripts/task-mcp.

uv run --directory scripts/task-mcp server.py requires a pyproject.toml in that directory to declare deps (otherwise imports like fastmcp/requests/bs4 will fail). My repository search returned no evidence of pyproject.toml or server.py under scripts/task-mcp, so I could not verify.

Please check/fix one of the following:

  • Confirm or add: scripts/task-mcp/pyproject.toml (declare fastmcp, requests, bs4).
  • Confirm presence of: scripts/task-mcp/server.py (or update the launcher to point to the correct file).
  • Alternatively update .vscode/mcp.json to run from the project root or use a venv/requirements-based launcher.

File: .vscode/mcp.json
Lines: 20-23

      "type": "stdio",
      "command": "uv",
      "args": ["run", "--directory", "scripts/task-mcp", "server.py"],
    },
scripts/task-mcp/find_app_icon.py (4)

1-6: LGTM - Clean imports and proper organization.

The imports are well-organized with standard library modules first, followed by third-party dependencies. All imported modules are used in the implementation.


8-21: LGTM - Well-structured class with appropriate initialization.

The class is well-documented with a clear docstring explaining its purpose. The initialization sets up reasonable default headers with a realistic User-Agent string to avoid being blocked by websites.


22-45: LGTM - Solid main interface with clear fallback strategy.

The method provides a clear workflow with good fallback logic: dashboard icons first, then favicons, finally a default value. The documentation clearly explains the return types and behavior.


94-119: LGTM - Good test coverage with realistic examples.

The main function provides comprehensive test cases with popular applications that are likely to have icons in the dashboard-icons repository or proper favicons. This is helpful for development and debugging.

scripts/task-mcp/server.py (2)

17-17: LGTM - Clean import of the new dependency.

The import follows the existing pattern and correctly imports the required class from the new module.


162-176: LGTM - Well-implemented MCP tool integration.

The tool is properly decorated with the MCP tool decorator, has clear documentation, and correctly delegates to the AppIconFinder class. The function signature and return type are appropriate for the MCP framework.

Comment thread .claude/commands/add-compose-service.md Outdated
Comment thread .vscode/mcp.json
Comment thread .vscode/mcp.json
Comment thread scripts/task-mcp/find_app_icon.py Outdated
Comment thread scripts/task-mcp/find_app_icon.py
Comment thread scripts/task-mcp/server.py
@bubacoder
bubacoder force-pushed the feature/claude-add-serivce-command branch from 32ef1ae to 79d238f Compare August 14, 2025 20:50

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

♻️ Duplicate comments (2)
.claude/commands/add-compose-service.md (1)

13-22: Fix grammar, tighten wording, align with current Traefik guidance, and add icon step.

Improves clarity and correctness, removes “docker-compose”/“docker compose” inconsistencies, and aligns routing guidance with docker/guidelines.md (Host rule optional depending on your stack). Also adds the new MCP “find-app-icon” step so compose docs can render icons.

-Implementation steps:
-- Visit the APPLICATION_NAME application's homepage at APPLICATION_HOMEPAGE and GitHub page (if available).
-- Search for docker compose deployment examples of this application on the homepage and related documentation sites. If none found, fallback to plain docker deployment examples.
-- Based on the application's type, determine which existing category (existing subfolder in docker/ folder) this application belong to. Do not create new category, use the category "tools" for fallback.
-- Based on the patterns in docker/guidelines.md file and the found examples, create a docker-compose file with the name "docker/<category>/<application>.yaml".
-- Ensure the docker-compose file contains a short description of the project and links to the homepage, GitHub page and docker (-compose) setup example (whether it is available).
-- If the installation guide mentions further improvements, e.g. a) use of an optional database instead of a built-in or b) configuration of SSO authentication describe this briefly as TODO in the head section of the compose file.
-- Also mention as TODO if new environment variables needs to be set in .env files. Add these variables to the file "config-example/docker/myhost/.env" if it does not contain them yet.
-- After the docker-compose file is written, execute this linting tool: `pre-commit run --files <docker-compose-filename>` and fix the reported errors.
-- Execute the command to pull the container image(s): `docker/labctl.py service pull <category>/<application>`, check if this succeeds.
+Implementation steps:
+- Visit the APPLICATION_NAME homepage at APPLICATION_HOMEPAGE and the GitHub page (if available).
+- Search the homepage and docs for Docker Compose examples. If none are found, fall back to plain Docker examples.
+- Determine the appropriate category (an existing subfolder under docker/). Do not create a new category; use "tools" as a fallback.
+- Following docker/guidelines.md and the found examples, create docker/<category>/<application>.yaml.
+- Ensure the compose file contains a brief description of the project and links to the homepage, GitHub page, and any Docker(-Compose) setup example (if available).
+- Use the MCP “find-app-icon” tool to select a suitable icon and include icon metadata per docker/guidelines.md so docs can render it.
+- If the installation guide mentions optional improvements (e.g., using an external database instead of a built-in one, or enabling SSO), add TODOs for these in the head section of the compose file.
+- Add TODOs for any new environment variables required. If necessary, add them to config-example/docker/myhost/.env.
+- Ensure Traefik routing is configured per docker/guidelines.md. Only add an explicit Host rule if your stack does not provide a global defaultRule/file-provider.
+- After writing the compose file, run: `pre-commit run --files <docker-compose-filename>` and fix any reported issues.
+- Pull the container image(s): `docker/labctl.py service pull <category>/<application>` and verify success.
.vscode/mcp.json (1)

29-36: Good fix: add "type": "stdio" for all stdio servers.

This resolves the earlier spec compliance issue for github, postgres, and playwright servers.

Also applies to: 37-44, 45-48

🧹 Nitpick comments (9)
.claude/commands/add-compose-service.md (2)

10-12: Reference metadata expectations to improve generated docs.

Add a brief note that the compose file should include metadata supported by docs/web/update-docs.py (description, optional icon) to ensure good documentation output.

-Implement a container-based service by creating and configuring a Docker Compose file.
-Follow the architectural pattern in the docker/guidelines.md file.
+Implement a container-based service by creating and configuring a Docker Compose file.
+Follow the architectural and metadata conventions in docker/guidelines.md (include description and, when possible, an icon) to enable high‑quality generated docs.

15-20: Grammar and style nits in steps.

Minor fixes: “fall back” (verb), “belongs,” serial commas, and hyphenation.

-- Search for docker compose deployment examples of this application on the homepage and related documentation sites. If none found, fallback to plain docker deployment examples.
-- Based on the application's type, determine which existing category (existing subfolder in docker/ folder) this application belong to. Do not create new category, use the category "tools" for fallback.
-- Based on the patterns in docker/guidelines.md file and the found examples, create a docker-compose file with the name "docker/<category>/<application>.yaml".
-- Ensure the docker-compose file contains a short description of the project and links to the homepage, GitHub page and docker (-compose) setup example (whether it is available).
-- If the installation guide mentions further improvements, e.g. a) use of an optional database instead of a built-in or b) configuration of SSO authentication describe this briefly as TODO in the head section of the compose file.
-- Also mention as TODO if new environment variables needs to be set in .env files. Add these variables to the file "config-example/docker/myhost/.env" if it does not contain them yet.
+- Search for Docker Compose deployment examples on the homepage and related documentation sites. If none are found, fall back to plain Docker examples.
+- Based on the application's type, determine which existing category (subfolder under docker/) the application belongs to. Do not create a new category; use "tools" as a fallback.
+- Based on patterns in docker/guidelines.md and the examples found, create docker/<category>/<application>.yaml.
+- Ensure the compose file contains a brief description of the project and links to the homepage, GitHub page, and any Docker(-Compose) setup example (if available).
+- If the installation guide mentions further improvements (e.g., using an optional external database instead of a built‑in one, or configuring SSO), add TODOs for these in the head section of the compose file.
+- Also add TODOs if new environment variables need to be set in .env files. Add these variables to config-example/docker/myhost/.env if it does not contain them yet.
.vscode/mcp.json (2)

14-15: Reduce secret-scanner noise by masking password in the example URL.

Static analysis flagged the basic-auth example. Masking avoids false positives while keeping the hint useful.

-      "description": "PostgreSQL database URL (e.g. postgres://user:password@localhost:5432/dbname)",
+      "description": "PostgreSQL database URL (e.g. postgres://user:*****@localhost:5432/dbname)",

1-3: Verify whether JSON comments are accepted; use .jsonc or remove comments if needed.

Some strict parsers will reject // comments in .json. VS Code often tolerates JSON-with-comments, but if any tooling reads this as strict JSON, rename to mcp.jsonc or remove the comment.

scripts/task-mcp/find_app_icon.py (4)

95-100: Be consistent: follow redirects and validate content type for default favicon.

Redirects are common for /favicon.ico. Checking for an image content type reduces false positives.

-            favicon_response = requests.head(default_favicon, headers=self.headers, timeout=5)
-            if favicon_response.status_code == 200:
+            favicon_response = requests.head(default_favicon, headers=self.headers, timeout=5, allow_redirects=True)
+            if favicon_response.status_code == 200 and favicon_response.headers.get("Content-Type", "").lower().startswith("image/"):
                 return default_favicon
             return None

61-63: Harden homepage URL normalization (strip/empty guard).

Avoid making requests for empty/whitespace-only inputs; normalize before scheme injection.

-            if not homepage_url.startswith(('http://', 'https://')):
+            if not homepage_url:
+                return None
+            homepage_url = homepage_url.strip()
+            if not homepage_url.startswith(('http://', 'https://')):
                 homepage_url = 'https://' + homepage_url

18-21: Optional: use a Session to reuse connections.

requests.Session() with default headers will reduce latency and overhead across multiple tool invocations.

Example refactor (outside the exact hunk spans for head/get calls):

# at top-level imports
import requests

# in __init__
self.session = requests.Session()
self.session.headers.update(self.headers)

# then replace:
# requests.get(...) -> self.session.get(...)
# requests.head(...) -> self.session.head(...)

101-103: Prefer logging over printing to stderr.

Aligns with the server’s logger and preserves stack context if needed.

-        except Exception as e:
-            print(f"Error finding favicon: {e}", file=sys.stderr)
-            return None
+        except Exception as e:
+            import logging
+            logging.getLogger(__name__).warning("Error finding favicon: %s", e)
+            return None
scripts/task-mcp/server.py (1)

55-60: Add timeouts to subprocess calls to avoid indefinite hangs.

External commands (task/labctl) can hang; timeouts keep the MCP tool responsive.

         result = subprocess.run(
             ["task", "--list-all", "--dir", repository_root_path],
             capture_output=True,
             text=True,
-            check=True
+            check=True,
+            timeout=30
         )
         return subprocess.run(
             ["task", task_name, "--dir", repository_root_path],
             capture_output=True,
             text=True,
-            check=True
+            check=True,
+            timeout=120
         ).stdout.strip()
         result = subprocess.run(
             cmd,
             capture_output=True,
             text=True,
-            check=True
+            check=True,
+            timeout=120
         )

Also applies to: 94-99, 151-157

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these settings in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 32ef1ae and 79d238f.

📒 Files selected for processing (7)
  • .claude/commands/add-compose-service.md (1 hunks)
  • .mcp.json (1 hunks)
  • .vscode/mcp.json (1 hunks)
  • docker/guidelines.md (1 hunks)
  • scripts/task-mcp/find_app_icon.py (1 hunks)
  • scripts/task-mcp/requirements.txt (1 hunks)
  • scripts/task-mcp/server.py (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • .mcp.json
  • scripts/task-mcp/requirements.txt
  • docker/guidelines.md
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-08-06T20:29:29.605Z
Learnt from: CR
PR: bubacoder/infra#0
File: CLAUDE.md:0-0
Timestamp: 2025-08-06T20:29:29.605Z
Learning: Use Docker and Docker Compose for containerized services.

Applied to files:

  • .claude/commands/add-compose-service.md
📚 Learning: 2025-08-06T20:29:29.605Z
Learnt from: CR
PR: bubacoder/infra#0
File: CLAUDE.md:0-0
Timestamp: 2025-08-06T20:29:29.605Z
Learning: Applies to docker/**/*.{yml,yaml} : Docker Compose files for services should be placed under the docker/ directory, organized by service type (e.g., security, media, storage, monitoring).

Applied to files:

  • .claude/commands/add-compose-service.md
🧬 Code Graph Analysis (2)
scripts/task-mcp/server.py (1)
scripts/task-mcp/find_app_icon.py (2)
  • AppIconFinder (8-103)
  • get_app_icon (22-45)
.claude/commands/add-compose-service.md (1)
docs/web/update-docs.py (3)
  • process_docker_compose_file (295-337)
  • process_docker_directory (339-352)
  • process_docker_stack_index (252-260)
🪛 LanguageTool
.claude/commands/add-compose-service.md

[grammar] ~5-~5: There might be a mistake here.
Context: ... Variables APPLICATION_NAME: $ARGUMENTS APPLICATION_HOMEPAGE: $ARGUMENTS ## Ins...

(QB_NEW_EN)


[grammar] ~15-~15: There might be a mistake here.
Context: ...ack to plain docker deployment examples. - Based on the application's type, determi...

(QB_NEW_EN)


[grammar] ~16-~16: There might be a mistake here.
Context: ...der) this application belong to. Do not create new category, use the category "tools" ...

(QB_NEW_EN)


[grammar] ~16-~16: There might be a mistake here.
Context: ..., use the category "tools" for fallback. - Based on the patterns in docker/guidelin...

(QB_NEW_EN)


[grammar] ~17-~17: There might be a mistake here.
Context: ..." for fallback. - Based on the patterns in docker/guidelines.md file and the found...

(QB_NEW_EN)


[style] ~18-~18: Consider using the synonym “brief” (= concise, using a few words, not lasting long) to strengthen your wording.
Context: ...sure the docker-compose file contains a short description of the project and links to...

(QUICK_BRIEF)


[grammar] ~18-~18: There might be a mistake here.
Context: ...setup example (whether it is available). - If the installation guide mentions furth...

(QB_NEW_EN)


[style] ~19-~19: Consider an alternative to strengthen your wording.
Context: ...). - If the installation guide mentions further improvements, e.g. a) use of an optional database in...

(IMPROVEMENTS_REFINEMENTS)


[grammar] ~19-~19: There might be a mistake here.
Context: ...in the head section of the compose file. - Also mention as TODO if new environment ...

(QB_NEW_EN)


[grammar] ~20-~20: There might be a mistake here.
Context: ...ion of the compose file. - Also mention as TODO if new environment variables needs...

(QB_NEW_EN)


[grammar] ~22-~22: There might be a mistake here.
Context: .../`, check if this succeeds.

(QB_NEW_EN)

🪛 Checkov (3.2.334)
.vscode/mcp.json

[MEDIUM] 14-15: Basic Auth Credentials

(CKV_SECRET_4)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build
  • GitHub Check: check
🔇 Additional comments (3)
.claude/commands/add-compose-service.md (2)

13-22: Incorrect — docker/guidelines.md still contains a Traefik Host-rule example

The file still shows an explicit Host rule; the earlier claim that it was removed is incorrect.

  • docker/guidelines.md — lines 63–66: traefik.http.routers.service-name.rule: Host(\service.${MYDOMAIN}`)` (Host rule example present)

Ignore the previous suggestion to change .claude/commands/add-compose-service.md on this basis.

Likely an incorrect or invalid review comment.


5-6: Clarify positional argument mapping in .claude/commands/add-compose-service.md

Both variables currently bind to the same $ARGUMENTS token — make the positional mapping explicit to avoid ambiguity.

  • Location:
    • .claude/commands/add-compose-service.md — lines 5–6

Apply:

-APPLICATION_NAME: $ARGUMENTS
-APPLICATION_HOMEPAGE: $ARGUMENTS
+APPLICATION_NAME: $ARGUMENTS[0]
+APPLICATION_HOMEPAGE: $ARGUMENTS[1]

Note: I searched .claude/commands and found only this file, so there are no other examples to confirm the spec syntax. Please verify that the tooling accepts $ARGUMENTS[0] / $ARGUMENTS[1] or adjust to the project convention.

scripts/task-mcp/server.py (1)

162-173: Tool docstring is clear and parameters are typed — looks good.

Comment thread .vscode/mcp.json
Comment thread scripts/task-mcp/find_app_icon.py
Comment thread scripts/task-mcp/server.py
@bubacoder
bubacoder force-pushed the feature/claude-add-serivce-command branch from 79d238f to 14756ee Compare August 14, 2025 21:43

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

♻️ Duplicate comments (1)
.claude/commands/add-compose-service.md (1)

18-22: Tighten grammar and add essential steps: icon metadata, Traefik routing, and docs inclusion.

  • Replace “head” with “header” and prefer “resolve” over “fix.”
  • Add an explicit step to choose a dashboard icon via the new MCP tool and set icon metadata (used by docs).
  • Remind about Traefik Host rule where applicable.
  • Ensure a README.md exists so the docs generator includes the compose file (per docs/web/update-docs.py logic).

Apply this diff:

 - Ensure the compose file contains a brief description of the project and links to the homepage, GitHub page, and any Docker(-Compose) setup example (if available).
-- If the installation guide mentions further improvements (e.g., using an optional external database instead of a built-in one, or enabling SSO), add TODOs for these in the head section of the compose file.
+- Use the MCP tool "find-app-icon" for APPLICATION_NAME to select a square icon. Add an 'icon' metadata entry in the compose file header so the docs site can display it. For example:
+
+  ```
+  # name: APPLICATION_NAME
+  # description: One-line purpose/summary with key features.
+  # icon: <icon-url-or-token>
+  ```
+
+- If the installation guide mentions further improvements (e.g., using an optional external database instead of a built-in one, or enabling SSO), add TODOs for these in the header section of the compose file.
 - Also add TODOs for any new environment variables required. If necessary, add them to the "config-example/docker/myhost/.env" file.
+- Ensure Traefik routing is configured per docker/guidelines.md. Include a Host(...) rule unless your stack uses a global defaultRule/file-provider that supersedes it.
+- Ensure a README.md exists in docker/<category>/ so the docs generator includes this compose file in the site.
 - After writing the compose file, run: `pre-commit run --files <docker-compose-filename>` and fix any reported issues.
-- Pull the container image(s) with the command `docker/labctl.py service pull <category>/<application>` and verify success.
+- Pull the container image(s) using `docker/labctl.py service pull <category>/<application>` and verify success.
🧹 Nitpick comments (3)
.claude/commands/add-compose-service.md (1)

5-7: Clarify inputs and provide examples to reduce ambiguity.

Make it explicit what each variable represents and include examples to avoid misconfiguration.

Apply this diff to enrich the Variables section without changing how arguments are passed:

 ## Variables

 APPLICATION_NAME: $ARGUMENTS
 APPLICATION_HOMEPAGE: $ARGUMENTS
+
+Notes:
+- APPLICATION_NAME: short human-friendly name (e.g., "Plausible Analytics")
+- APPLICATION_HOMEPAGE: canonical URL to the app’s homepage (e.g., "https://plausible.io")
.vscode/mcp.json (2)

1-1: Drop the JSON line comment or rename file to .jsonc to avoid strict parser failures.

Many linters and tooling expect strict JSON and will error on // comments in .json files. If you want to keep comments, consider renaming to mcp.jsonc. Otherwise, remove the comment line.

-// https://code.visualstudio.com/docs/copilot/chat/mcp-servers
+

12-16: Sanitize the example DSN to avoid secret scanners and false positives.

Static analyzers often flag user:password@ patterns. Use a masked example.

-      "description": "PostgreSQL database URL (e.g. postgres://user:password@localhost:5432/dbname)",
+      "description": "PostgreSQL database URL (e.g. postgres://user:***@localhost:5432/dbname)",
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these settings in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 79d238f and 14756ee.

📒 Files selected for processing (7)
  • .claude/commands/add-compose-service.md (1 hunks)
  • .mcp.json (1 hunks)
  • .vscode/mcp.json (1 hunks)
  • docker/guidelines.md (1 hunks)
  • scripts/task-mcp/find_app_icon.py (1 hunks)
  • scripts/task-mcp/requirements.txt (1 hunks)
  • scripts/task-mcp/server.py (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • scripts/task-mcp/requirements.txt
🚧 Files skipped from review as they are similar to previous changes (4)
  • .mcp.json
  • docker/guidelines.md
  • scripts/task-mcp/server.py
  • scripts/task-mcp/find_app_icon.py
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-08-06T20:29:29.605Z
Learnt from: CR
PR: bubacoder/infra#0
File: CLAUDE.md:0-0
Timestamp: 2025-08-06T20:29:29.605Z
Learning: Applies to docker/**/*.{yml,yaml} : Docker Compose files for services should be placed under the docker/ directory, organized by service type (e.g., security, media, storage, monitoring).

Applied to files:

  • .claude/commands/add-compose-service.md
📚 Learning: 2025-08-06T20:29:29.605Z
Learnt from: CR
PR: bubacoder/infra#0
File: CLAUDE.md:0-0
Timestamp: 2025-08-06T20:29:29.605Z
Learning: Use Docker and Docker Compose for containerized services.

Applied to files:

  • .claude/commands/add-compose-service.md
🧬 Code Graph Analysis (1)
.claude/commands/add-compose-service.md (2)
docs/web/update-docs.py (3)
  • process_docker_compose_file (295-337)
  • process_docker_directory (339-352)
  • process_docker_stack_index (252-260)
docker/labctl.py (1)
  • docker_command (94-133)
🪛 Checkov (3.2.334)
.vscode/mcp.json

[MEDIUM] 14-15: Basic Auth Credentials

(CKV_SECRET_4)

🪛 LanguageTool
.claude/commands/add-compose-service.md

[grammar] ~5-~5: There might be a mistake here.
Context: ... Variables APPLICATION_NAME: $ARGUMENTS APPLICATION_HOMEPAGE: $ARGUMENTS ## Ins...

(QB_NEW_EN)


[grammar] ~18-~18: There might be a mistake here.
Context: ...(-Compose) setup example (if available). - If the installation guide mentions furth...

(QB_NEW_EN)


[style] ~19-~19: Consider an alternative to strengthen your wording.
Context: ...). - If the installation guide mentions further improvements (e.g., using an optional external datab...

(IMPROVEMENTS_REFINEMENTS)


[grammar] ~19-~19: There might be a mistake here.
Context: ...in the head section of the compose file. - Also add TODOs for any new environment v...

(QB_NEW_EN)


[style] ~21-~21: Consider using a different verb for a more formal wording.
Context: ... --files ` and fix any reported issues. - Pull the contain...

(FIX_RESOLVE)


[grammar] ~21-~21: There might be a mistake here.
Context: ...-filename>` and fix any reported issues. - Pull the container image(s) with the com...

(QB_NEW_EN)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build
  • GitHub Check: check
🔇 Additional comments (4)
.claude/commands/add-compose-service.md (2)

16-17: Path/location guidance aligns with repository conventions.

Using docker//.yaml and reusing existing categories (fallback to "tools") matches our established structure.


10-12: Good cross-referencing of the canonical guidelines.

Pointing authors to docker/guidelines.md keeps stacks consistent.

.vscode/mcp.json (2)

20-23: LGTM: homelab-infra server via uv stdio looks correct.

Clear stdio wiring and deterministic entrypoint.


24-28: LGTM: context7 server registration is consistent.

Stdio + npx invocation matches typical MCP server patterns.

Comment thread .vscode/mcp.json
Comment thread .vscode/mcp.json
Comment on lines +37 to +44
"postgres": {
"type": "stdio",
"command": "docker",
"args": ["run", "--rm", "-i", "-e", "POSTGRES_URL", "docker.io/mcp/postgres:latest", "${input:postgresql-database-url}"],
"env": {
"POSTGRES_URL": "${input:postgresql-database-url}"
}
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Avoid leaking the database URL via process args; rely on env-only.

Passing the DSN as a positional argument makes it visible via ps, shell history, and certain logs. You already forward POSTGRES_URL into the container with -e POSTGRES_URL, so the positional arg is redundant. Remove it and keep the env-based wiring.

     "postgres": {
       "type": "stdio",
       "command": "docker",
-      "args": ["run", "--rm", "-i", "-e", "POSTGRES_URL", "docker.io/mcp/postgres:latest", "${input:postgresql-database-url}"],
+      "args": ["run", "--rm", "-i", "-e", "POSTGRES_URL", "docker.io/mcp/postgres:latest"],
       "env": {
         "POSTGRES_URL": "${input:postgresql-database-url}"
       }
     },

Optional hardening:

  • Pin the image to a tag or digest for reproducibility (e.g., docker.io/mcp/postgres:0.x.y or @sha256:...).
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"postgres": {
"type": "stdio",
"command": "docker",
"args": ["run", "--rm", "-i", "-e", "POSTGRES_URL", "docker.io/mcp/postgres:latest", "${input:postgresql-database-url}"],
"env": {
"POSTGRES_URL": "${input:postgresql-database-url}"
}
},
"postgres": {
"type": "stdio",
"command": "docker",
"args": ["run", "--rm", "-i", "-e", "POSTGRES_URL", "docker.io/mcp/postgres:latest"],
"env": {
"POSTGRES_URL": "${input:postgresql-database-url}"
}
},
🤖 Prompt for AI Agents
In .vscode/mcp.json around lines 37 to 44, the PostgreSQL DSN is passed as a
positional docker argument (making it visible in process listings) despite also
being exported via the POSTGRES_URL env var; remove the positional
"${input:postgresql-database-url}" from the args array and rely solely on the
env mapping ("-e" / env field) to supply the DSN to the container, and
optionally pin the image to a fixed tag or digest (e.g.,
docker.io/mcp/postgres:0.x.y or @sha256:...) for reproducibility.

Comment thread .vscode/mcp.json
@bubacoder
bubacoder merged commit 900f638 into main Aug 15, 2025
4 checks passed
@bubacoder
bubacoder deleted the feature/claude-add-serivce-command branch August 15, 2025 05:18
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