Skip to content

feat: robust MCP env var detection, config gen fixes, and submit UX improvements#326

Merged
ShaanNarendran merged 4 commits intomainfrom
feat/mcp-env-detection-and-submit-fixes
Apr 16, 2026
Merged

feat: robust MCP env var detection, config gen fixes, and submit UX improvements#326
ShaanNarendran merged 4 commits intomainfrom
feat/mcp-env-detection-and-submit-fixes

Conversation

@ShaanNarendran
Copy link
Copy Markdown
Contributor

Summary

  • 4-tier env var detection in both CLI analyzer and server validator: server.json manifest → README → .env.example → source code scanning. Adds Go (os.Getenv) and TypeScript (process.env) regex patterns, filters test/internal dirs, and includes an allowlist for user-facing vars behind filtered prefixes (GITHUB_TOKEN, GITHUB_PERSONAL_ACCESS_TOKEN, DOCKER_HOST).
  • Config generation fix for Go/Docker MCP servers: passes docker_image and env vars through the Claude Code agent config path, prompts for Docker image on Go framework submissions, and uses docker_image presence (not framework name) to decide whether to generate docker run commands.
  • Auto-replace pending/rejected listings on re-submit instead of blocking with a 409 conflict. Approved listings remain protected.
  • Clarified env var review prompt during submit so publishers don't mistake the keep/remove/optional action prompt for a value prompt.

Test plan

  • Submit the GitHub MCP server (https://github.com/github/github-mcp-server) — should detect GITHUB_PERSONAL_ACCESS_TOKEN as the only env var
  • Pull with --ide claude-code — config should include docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN=<value> ghcr.io/github/github-mcp-server
  • Re-submit the same MCP name while pending — should replace the old listing, not 409
  • Submit a TypeScript MCP (e.g. Cloudflare) — should find env vars from server.json manifest
  • Submit a Python MCP (e.g. FastMCP-based) — should detect env vars from source code

…ixes

Overhaul env var detection in both CLI analyzer and server validator with
a 4-tier system: server.json manifest → README → .env.example → source
scanning. Adds Go and TypeScript regex patterns, filters test/internal
dirs, and includes an allowlist for user-facing vars behind filtered
prefixes (GITHUB_TOKEN, GITHUB_PERSONAL_ACCESS_TOKEN, DOCKER_HOST).

Fix config generation for Go/Docker MCP servers: pass docker_image and
env vars through the Claude Code agent config path, prompt for Docker
image on Go framework submissions, and use docker_image presence (not
framework name) to decide whether to generate docker run commands.

Signed-off-by: Shaan Narendran <shaannaren06@gmail.com>
Users were blocked by a 409 conflict when re-submitting an MCP with the
same name after a failed or rejected attempt. Now pending and rejected
listings are automatically replaced, while approved listings remain
protected and require the update flow.

Signed-off-by: Shaan Narendran <shaannaren06@gmail.com>
The submit-time prompt "GITHUB_PERSONAL_ACCESS_TOKEN [required]:" was
ambiguous — it looked like it was asking for the actual secret value
when it was really asking for a review action (keep/remove/optional).
Reword to "— keep? [Enter=keep / r=remove / o=optional]" so publishers
don't accidentally paste credentials into a field that discards them.

Signed-off-by: Shaan Narendran <shaannaren06@gmail.com>
@ShaanNarendran
Copy link
Copy Markdown
Contributor Author

I used ai for pr gen cause I was lazy

Fix existing TestConfigGenerator._make_listing mock to set docker_image,
framework, and environment_variables explicitly (avoids MagicMock truthy
bug with the new docker_image check).

Add test_env_detection_and_config.py covering:
- Env var filtering (internal, CI prefix, allowlist, server/CLI parity)
- Test file/directory filtering
- 4-tier detection cascade (server.json, README, .env.example, source)
- _build_run_command with docker_image and env vars
- generate_config for Docker-based listings
- Agent config generator passing docker_image to Claude Code path
- MCP submit auto-replace of pending/rejected listings

Signed-off-by: Shaan Narendran <shaannaren06@gmail.com>
@ShaanNarendran ShaanNarendran merged commit 4db4a17 into main Apr 16, 2026
14 checks 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.

1 participant