Skip to content

MCP: result redaction removes token counts from cost data and hides the token-alert settings #3595

Closed

Description

@integry

Problem

The MCP result redaction drops every object key whose name contains token (packages/api/mcp/adapter.ts, the key filter /(?:token|secret|password|…)/i, with only pr_review_max_context_tokens exempted). That removes ordinary numeric data:

  • get_cost_breakdown {period:"7d", groupBy:["outcome"]} returns rows like {"outcome":"failed","executions":144,"tasks":76,"cost_usd":54.88} with no input_tokens, output_tokens or cache_*_tokens, although the tool description promises input/output/cache tokens per row, "the same rows as GET /api/stats/cost". propr stats cost --json returns them.
  • get_execution_settings returns no token_outlier_* key (token_outlier_multiplier, token_outlier_min_tokens, token_outlier_baseline_runs, …), while find_setting "cost anomaly alert" tells the client to read token_outlier_multiplier with get_execution_settings.

Expected / acceptance criteria

  • Token counts and token-threshold settings (numeric or boolean values under keys such as *_tokens, tokens, token_outlier_*, total_tokens) are returned by MCP tools.
  • Credentials stay redacted: a string value under a key containing token (access tokens, bearer tokens, instance tokens, refresh tokens, tokenHash and similar) is still removed, as are all other key classes in the filter.
  • get_cost_breakdown rows carry the same token columns as GET /api/stats/cost; get_execution_settings includes the token_outlier_* settings.
  • Tests: a table of keys/values that must pass and must be removed, including nested objects and JSON-encoded strings, plus the two tools above.

Implementation

Change the key filter in packages/api/mcp/adapter.ts redact() so that a token-named key is dropped only when its value could be a credential (a string, or a container holding strings), not when it is a number, boolean or null. Do not weaken any other pattern. Replace the one-off pr_review_max_context_tokens exemption with the general rule if it becomes redundant.

Notes

Security-sensitive: when unsure, keep redacting. Do not add an allow-list of specific setting names that has to be maintained by hand unless the general rule cannot be made safe.

Activity

  1. propr-dev commented on Nov 17, 2026

    @propr-dev
    Contributor

    🤖 AI processing has started for this issue using claude agent with claude-opus-5-5 model.

    I'll analyze the problem and work on a solution. This may take a few minutes.

    Processing Details:

    • Agent: claude
    • Model: claude-opus-5-5
    • Branch: 3595/claude-opus-5-5-mcp-result-redaction-remo-20261117-0119-jch
    • Base Branch: 3595-epic-0-9-h9l
    • Worktree: issue-3595-20261117-0119-claude-opus-5-5-jch

    🔍 Track Task Execution

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions