Socket
Book a DemoInstallSign in
Socket

@thinkhive/mcp-explainer

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thinkhive/mcp-explainer

MCP server for ThinkHive Explainer API - AI agent trace analysis and explainability

Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
44
2.33%
Maintainers
1
Weekly downloads
 
Created
Source

@thinkhive/mcp-explainer

MCP (Model Context Protocol) server for the ThinkHive Explainer API. Provides AI agents with access to trace analysis, explainability, and debugging capabilities.

Features

  • 12 powerful tools for trace analysis, pattern detection, and debugging
  • STDIO transport for Claude Code CLI integration
  • HTTP/SSE transport for web clients and external integrations
  • Redis-based rate limiting for production deployments
  • Company isolation for multi-tenant security
  • Comprehensive audit logging for compliance
  • Tier-based feature gates (free, starter, professional, enterprise)

Installation

npm install @thinkhive/mcp-explainer

Quick Start

Claude Code CLI

Add to your Claude Code configuration (~/.claude/claude_desktop_config.json):

{
  "mcpServers": {
    "thinkhive-explainer": {
      "command": "npx",
      "args": ["@thinkhive/mcp-explainer"],
      "env": {
        "THINKHIVE_API_KEY": "thk_your_api_key_here",
        "THINKHIVE_API_URL": "https://demo.thinkhive.ai"
      }
    }
  }
}

Programmatic Usage

import { startStdioServer } from '@thinkhive/mcp-explainer';

// Start STDIO server
await startStdioServer();

HTTP/SSE Transport

import express from 'express';
import { setupHttpTransport } from '@thinkhive/mcp-explainer';

const app = express();
app.use(express.json());

setupHttpTransport({
  app,
  basePath: '/mcp',
});

app.listen(3001, () => {
  console.log('MCP server running on http://localhost:3001');
});

Environment Variables

VariableRequiredDefaultDescription
THINKHIVE_API_KEYYes-Your ThinkHive API key
THINKHIVE_API_URLNohttps://demo.thinkhive.aiThinkHive API URL
REDIS_URLNo-Redis URL for distributed rate limiting

Available Tools

Trace Analysis

ToolDescriptionTier
trace_explainAnalyze a trace and generate detailed explanationFree
trace_searchSearch traces using natural languageStarter+
trace_get_explanationGet stored explanation by trace IDFree
trace_patternsGet failure patterns for an agentStarter+
trace_statsGet statistics for tracesFree
trace_batch_analyzeAnalyze multiple traces at onceStarter+
trace_counterfactualGet "what would work" analysisProfessional+

Cluster Analysis

ToolDescriptionTier
cluster_listList failure clusters for an agentStarter+
cluster_detailsGet cluster details with examplesStarter+

Webhooks

ToolDescriptionTier
webhook_listList configured webhooksProfessional+
webhook_createCreate a new webhookProfessional+
webhook_deleteDelete a webhookProfessional+

Tool Examples

Analyze a Trace

Use the trace_explain tool to analyze this trace:
{
  "id": "trace-123",
  "userMessage": "I want to return my order",
  "agentResponse": "I'll process that refund for you right away!",
  "outcome": "policy_violation"
}

Search for Similar Issues

Use trace_search to find traces where the agent failed to verify customer identity

Get Failure Patterns

Use trace_patterns with agentId "customer-support" and timeRange "7d" to see recent failure patterns

Debug a Recurring Issue

Use the debug_pattern prompt to investigate: "Agent is providing incorrect pricing information"

Available Prompts

PromptDescription
analyze_failureAnalyze a failed trace to identify root cause
compare_tracesCompare two traces to understand differences
debug_patternDebug a recurring failure pattern
improve_agentSuggest improvements for an agent
investigate_issueInvestigate a reported issue

Available Resources

URIDescription
trace://schemaJSON schema for trace objects
trace://outcomesList of trace outcome types
trace://severitiesList of severity levels

API Key Tiers

TierRate LimitFeatures
Free10/minBasic explainability
Starter60/min+ Semantic search, batch analysis, pattern detection
Professional300/min+ Business metrics, webhooks, counterfactual analysis
Enterprise1000/minAll features + dedicated support

Security

  • API Key Authentication: HMAC-SHA256 hashed keys
  • Company Isolation: All queries scoped to authenticated company
  • Rate Limiting: Redis-based sliding window per API key
  • Audit Logging: All tool calls logged for compliance

Advanced Configuration

import { McpExplainerServer } from '@thinkhive/mcp-explainer';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';

const server = new McpExplainerServer({
  name: 'my-explainer',
  version: '1.0.0',
  auth: {
    required: true,
    apiUrl: 'https://api.thinkhive.ai',
    staticApiKey: process.env.THINKHIVE_API_KEY,
  },
  rateLimit: {
    enabled: true,
    redisUrl: process.env.REDIS_URL,
    windowMs: 60000,
    keyPrefix: 'mcp:rate:',
    limits: {
      free: 10,
      starter: 60,
      professional: 300,
      enterprise: 1000,
    },
  },
  audit: {
    enabled: true,
    level: 'info',
    logInput: true,
    logOutput: false,
    maxStringLength: 500,
  },
  features: {
    tools: true,
    resources: true,
    prompts: true,
  },
});

const transport = new StdioServerTransport();
await server.connect(transport);

Contributing

See CONTRIBUTING.md for development guidelines.

License

MIT

Documentation

Keywords

mcp

FAQs

Package last updated on 17 Dec 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts