SigNoz MCP Context Optimization: Implementing Tool Filtering and Search

Reduced SigNoz MCP context usage by implementing mcp-filter proxy and enabling aggressive tool search, achieving estimated 85%+ token reduction.

SigNoz MCP Context Optimization: Implementing Tool Filtering and Search

Session Date: 2026-01-19 Project: Claude Code Configuration (~/.claude) Focus: Minimize SigNoz MCP context/token usage in Claude Code Session Type: Research and Implementation

Executive Summary

Successfully researched and implemented multiple strategies to reduce SigNoz MCP server context usage in Claude Code. The SigNoz MCP provides 26 tools consuming an estimated 15,000-20,000 tokens at session start. Through implementing mcp-filter proxy filtering and enabling aggressive tool search thresholds, achieved an estimated 85%+ reduction in context consumption.

The solution involved installing mcp-filter as a proxy wrapper around the SigNoz MCP server, blocking the three heaviest tools (signoz_create_dashboard, signoz_update_dashboard, signoz_execute_builder_query) which alone account for ~11,500 tokens. Combined with ENABLE_TOOL_SEARCH=auto:5, tools are now loaded on-demand rather than preloaded.

Key Metrics: | Metric | Value | |——–|——-| | Total SigNoz Tools | 26 | | Tools Blocked | 3 (heaviest) | | Estimated Token Savings | ~11,500 tokens | | Tool Search Threshold | 5% (aggressive) | | Output Token Limit | 15,000 | | Breaking Changes | 0 |

Problem Statement

The SigNoz MCP server was contributing significant context overhead to Claude Code sessions:

  1. Large Tool Schemas: Dashboard creation/update tools have deeply nested widget schemas (~5,000+ tokens each)
  2. Preloaded Definitions: All 26 tools loaded at session start regardless of need
  3. Verbose Responses: MCP tool outputs could consume excessive context

Impact Before: ~20,000 tokens consumed by SigNoz MCP alone at session initialization.

Research Phase

Agent Selection Journey

Initially attempted to use lead-research-assistant agent, which didn’t exist in the available agents. After installing the skill from the awesome-claude-skills marketplace, discovered it was designed for sales lead generation, not technical research.

Resolution: Used webscraping-research-analyst agent for comprehensive technical research on MCP context optimization strategies.

Key Research Findings

1. MCP Tool Search (Built-in Solution)

  • Enabled by default as of January 2026
  • Dynamically loads tools on-demand via MCPSearch
  • Achieves 85% reduction when tools exceed threshold
  • Configurable threshold: ENABLE_TOOL_SEARCH=auto:N where N is percentage

2. Third-Party Proxy Tools

ToolDescriptionToken Reduction
mcp-filterPython-based proxy with allow/deny patterns72-91%
mcproxyNode.js proxy with auto-config generationVariable
Portkey filterSemantic embedding-based selectionVariable

3. SigNoz Tool Analysis

CategoryToolsSchema Size
Metrics4Low (~150-200 tokens each)
Alerts3Low-Medium
Dashboards4Very High (~5,000+ for create/update)
Services2Medium
Logs7Low-Medium
Traces6Medium-High
Query Builder1High (~1,500 tokens)

4. Feature Request Status

  • Native tool filtering (Issue #7328) has 182+ upvotes, assigned but not yet implemented
  • Proxy-based filtering is the current community workaround

Implementation Details

Phase 1: Install mcp-filter

Command:

pip install mcp-filter

Installed Dependencies: mcp-filter 0.1.0 with fastmcp, mcp, and related packages.

Phase 2: Update MCP Configuration

File: ~/.claude/.mcp.json

Before:

{
  "mcpServers": {
    "signoz": {
      "command": "/Users/alyshialedlie/.claude/mcp-servers/signoz-mcp-server/bin/signoz-mcp-server",
      "args": [],
      "env": {
        "SIGNOZ_URL": "https://tight-ladybird.us.signoz.cloud",
        "SIGNOZ_API_KEY": "${SIGNOZ_API_KEY}",
        "LOG_LEVEL": "info",
        "GOMEMLIMIT": "50MiB",
        "GOGC": "50"
      }
    }
  }
}

After:

{
  "mcpServers": {
    "signoz": {
      "command": "mcp-filter",
      "args": [
        "run",
        "-t", "stdio",
        "--stdio-command", "/Users/alyshialedlie/.claude/mcp-servers/signoz-mcp-server/bin/signoz-mcp-server",
        "--deny-pattern", "signoz_(create|update)_dashboard",
        "--deny-pattern", "signoz_execute_builder_query",
        "--log-level", "WARNING"
      ],
      "env": {
        "SIGNOZ_URL": "https://tight-ladybird.us.signoz.cloud",
        "SIGNOZ_API_KEY": "${SIGNOZ_API_KEY}",
        "LOG_LEVEL": "info",
        "GOMEMLIMIT": "50MiB",
        "GOGC": "50"
      }
    }
  }
}

Design Decisions:

  • Deny patterns over allow lists: More maintainable as new tools are added
  • Regex patterns: signoz_(create|update)_dashboard catches both in one pattern
  • Log level WARNING: Reduces noise while preserving important messages

Phase 3: Enable Tool Search and Output Limits

File: ~/.claude/config/settings.json

Added Configuration:

{
  "env": {
    "ENABLE_TOOL_SEARCH": "auto:5",
    "MAX_MCP_OUTPUT_TOKENS": "15000"
  }
}

Rationale:

  • auto:5: Triggers tool search when MCP tools exceed 5% of context (more aggressive than default 10%)
  • MAX_MCP_OUTPUT_TOKENS=15000: Prevents verbose tool responses from consuming excessive context

Phase 4: Cleanup

  • Disabled lead-research-assistant@awesome-claude-skills plugin
  • Removed skill from skill-rules.json
  • Deleted skill folder from ~/.claude/skills/

Key Decisions and Trade-offs

Decision 1: mcp-filter vs mcproxy

Choice: mcp-filter (Python-based) Rationale: Simpler CLI interface, regex-based patterns, well-documented Alternative Considered: mcproxy (Node.js), rejected due to additional config file requirement Trade-off: Python dependency vs Node.js dependency (Python already available)

Decision 2: Deny Patterns vs Allow List

Choice: Deny patterns blocking 3 heavy tools Rationale: Future-proof as new SigNoz tools are added; only blocks known heavy tools Alternative Considered: Allow list of ~10 essential tools Trade-off: Less aggressive filtering, but more maintainable

Decision 3: Tool Search Threshold

Choice: 5% threshold (aggressive) Rationale: Maximizes context savings; SigNoz tools alone likely exceed 5% Alternative Considered: Default 10% Trade-off: Slightly slower tool discovery for maximum context savings

Tools Blocked

ToolEstimated TokensReason
signoz_create_dashboard~5,000+Deeply nested widget/query schemas
signoz_update_dashboard~5,000+Same as create
signoz_execute_builder_query~1,500Complex query structure
Total Blocked~11,500 

Tools Retained (23)

All other SigNoz tools remain available:

  • signoz_list_services, signoz_list_alerts, signoz_get_alert
  • signoz_get_error_logs, signoz_search_logs_by_service
  • signoz_search_traces_by_service, signoz_get_trace_details
  • signoz_list_dashboards, signoz_get_dashboard
  • And 14 more utility/query tools

Verification

Configuration Validation

$ npm run validate
✓ skill-rules.json is valid JSON
✓ All 21 skills have matching SKILL.md files and triggers
✓ settings.json is valid JSON
✓ All checks passed!

JSON Validation

$ cat .mcp.json | python3 -c "import json,sys; json.load(sys.stdin)"
✓ .mcp.json is valid JSON

Files Modified

Modified Files

| File | Changes | |——|———| | ~/.claude/.mcp.json | Added mcp-filter wrapper with deny patterns | | ~/.claude/config/settings.json | Added env settings, disabled plugin | | ~/.claude/config/skill-rules.json | Removed lead-research-assistant |

Deleted Files

| File | Reason | |——|——–| | ~/.claude/skills/lead-research-assistant/ | Not needed for technical research |

Note on .mcp.json

The .mcp.json file is gitignored and changes remain local-only. This is appropriate as the file may contain environment-specific paths.

Git Commits

CommitDescription
22b1db4perf(mcp): add tool search and output limits for context optimization

Expected Performance Impact

ScenarioBeforeAfterImprovement
Initial Context Load~20,000 tokens~3,000-5,000 tokens75-85%
With Tool Search Active~20,000 tokens~500 tokens97%+
Dashboard OperationsAvailableBlockedN/A

Limitations

  1. Dashboard Creation Blocked: Cannot create/update dashboards via MCP (must use SigNoz UI)
  2. Query Builder Blocked: Complex queries must use specific tools or UI
  3. Native Filtering Unavailable: Still waiting on Claude Code Issue #7328 for built-in solution

Next Steps

Immediate

  1. ✅ Restart Claude Code to apply changes
  2. Use /context command to verify token reduction

If Dashboard Access Needed

  • Temporarily modify .mcp.json to remove deny patterns
  • Or use SigNoz web UI directly

Future Improvements

  • Monitor Issue #7328 for native tool filtering
  • Consider creating SigNoz guidance skill for tool selection

References

Code Files

  • ~/.claude/.mcp.json - MCP server configuration
  • ~/.claude/config/settings.json - Claude Code settings
  • ~/.claude/config/skill-rules.json - Skill triggers

External Resources

Research Agents Used

  • general-purpose - Initial MCP configuration research
  • webscraping-research-analyst - Comprehensive optimization strategy research