Skip to content

feat(mcp): add config command reporting resolved configuration provenance#335

Open
glorydavid03023 wants to merge 2 commits into
JSONbored:mainfrom
glorydavid03023:feat/mcp-config-command
Open

feat(mcp): add config command reporting resolved configuration provenance#335
glorydavid03023 wants to merge 2 commits into
JSONbored:mainfrom
glorydavid03023:feat/mcp-config-command

Conversation

@glorydavid03023
Copy link
Copy Markdown
Contributor

Summary

Adds a config command to the gittensory-mcp CLI that prints the resolved effective configuration and where each value came from:

$ gittensory-mcp config
API URL: https://gittensory-api.aethereal.dev (default)
Active profile: default (1 configured)
Config file: absent (location: default)
Cache dir: default
Token: not configured
Source upload: disabled (unsupported)

$ gittensory-mcp config --json
{
  "apiUrl": "https://gittensory-api.aethereal.dev",
  "apiUrlSource": "default",
  "activeProfile": "default",
  "profileCount": 1,
  "configured": false,
  "configPathSource": "default",
  "cacheDirSource": "default",
  "tokenConfigured": false,
  "tokenSource": "none",
  "sourceUpload": { "default": false, "supported": false },
  "profile": { ... }
}

Each value is attributed to its source — environment, profile, config (file), or default.

Why this is useful (and not a duplicate of existing commands)

This fills a real diagnostic gap. status reports health/version, doctor runs check-style diagnostics, and whoami shows session identity — but none answer the common question "what configuration is actually in effect, and which source supplied it?" That question comes up whenever an API URL, profile, or config-file location is not being picked up as expected (env vs profile vs global config vs default). config makes that resolution explicit in one place.

Why no linked issue

Additive, low-risk CLI ergonomics only. No public-behavior, auth/session, schema, deploy, or frontend-architecture change, so per CONTRIBUTING this does not require an issue first. Happy to file one if maintainers prefer.

Privacy

Output prints provenance labels only — never token values or local absolute paths — preserving the CLI's existing redaction invariant. A test asserts that neither a configured token nor the config directory path appears in output.

Changes

  • packages/gittensory-mcp/bin/gittensory-mcp.jsconfig dispatch in runCli, configCommand() with resolvedApiUrlSource() / resolvedConfigPathSource() / resolvedTokenSource() helpers, and a help-text usage line.
  • test/unit/mcp-cli.test.ts — cover default resolution, environment overrides (with token/path non-leak assertions), named-profile resolution from the config file, and a global config file reached through a config-path override.
  • packages/gittensory-mcp/README.md — document the command, its sources, and the --json form.

Contract notes

No MCP tool or HTTP/OpenAPI contract changes. Adds a local CLI command surface only; the --json payload is additive and parseable.

Validation

Intended gate (CONTRIBUTING required checks):

npm run build:mcp
npm run test:mcp-pack
npm run typecheck
npm run test:coverage
npm run test:ci

Transparency note: my local authoring environment had no Node runtime available, so I could not execute the gate locally before opening this PR. The change was prepared against the existing CLI dispatch/config-resolution/test patterns and is intended to be validated by CI on this PR (I will also run the full gate locally). I aimed for thorough branch coverage of the new provenance helpers; if any check needs adjustment I'll follow up promptly.

Security / privacy

No auth, cookie, CORS, GitHub App output, identity, or contributor-evidence changes. The command exposes only provenance labels, the public API URL, and the user's own profile state — no tokens, local paths, wallet/hotkey, or scoring context.

…ance

Add a `config` command to the gittensory-mcp CLI that prints the resolved
effective configuration and the source that supplied each value
(environment, profile, config file, or default): the active API URL and
its source, the active profile and profile count, whether a config file is
present and which environment variable steers its location, the cache-dir
source, whether a token is configured and where it came from, and the
source-upload posture.

This fills a real diagnostic gap. `status` reports health and version,
`doctor` runs checks, and `whoami` shows session identity, but none of them
answer "what configuration is actually in effect and which source supplied
it?" — the common question when an API URL or profile is not picked up as
expected.

Output prints provenance labels only: it never includes token values or
local absolute paths, preserving the CLI's redaction invariant. A `--json`
form is provided for tooling.

Tests cover default resolution, environment overrides (with token/path
non-leak assertions), named-profile resolution from the config file, and a
global config file reached through a config-path override.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jun 3, 2026
@github-actions github-actions Bot added the feature New feature or request label Jun 3, 2026
Copy link
Copy Markdown
Owner

@JSONbored JSONbored left a comment

Choose a reason for hiding this comment

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

@glorydavid03023 this is a useful MCP diagnostic command, but it needs validation evidence before merge.

A few notes:

  • Showing config provenance without printing token values or local paths is the right behavior.
  • The --json shape is useful for tooling.
  • The blocker is validation evidence, not the command idea.

Required changes:

  • Run the relevant MCP gate locally or clearly state any environment blocker with exact skipped checks.
  • Keep the token/path redaction assertions in the tests.
  • Make sure README output examples match the final command output.

Validation expected:

  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run typecheck
  • Focused test/unit/mcp-cli.test.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants