tif-score-mcp

tif-score-mcp

An MCP server that exposes three tools to analyze call transcripts for business intelligence, score leads 0-100 with hot/warm/cold classification, and diagnose n8n workflow errors with root cause analysis and proposed fixes.

Category
访问服务器

README

TIF Score MCP

An MCP (Model Context Protocol) server that exposes three tools to any MCP-compatible client (Claude Desktop, Claude Code, or anything else that speaks MCP):

  • score_conversation — analyzes a call transcript and returns structured business intelligence.
  • get_lead_score — scores a transcript 0-100 and classifies it hot / warm / cold.
  • diagnose_workflow_error — given an n8n workflow's JSON and an error message, returns a root cause and a proposed minimal fix.

This is a port, not a rewrite: the scoring prompt and weighting logic are adapted from a real, working conversation-analysis and lead-scoring pipeline (company and product names generalized for this public repo), and the workflow-diagnosis tool is a scoped-down port of a larger workflow self-healing system's diagnostic reasoning. See docs/BTS.md for a plain-language writeup of the whole process, from planning through finished server.

Demo

Real MCP server, real Claude API calls, real output — no mocked data. Generated by running demo/run-demo.mjs (npm run demo):

Demo: all three tools called over real stdio JSON-RPC, real Claude API responses

A produced walkthrough is also available: demo/promo/tif-score-mcp-promo.mp4 (46s) — why this exists, the three tools, and the same real terminal footage above, narrated.

Tools

score_conversation

Input:

{
  "transcript": "Agent: Thanks for calling...\nCaller: Hi, I need to book...",
  "call_duration": 184,
  "raw_outcome": "completed",
  "source_system": "Retell"
}

Output:

{
  "intent": "booking",
  "sentiment": "positive",
  "urgency": "high",
  "objections": ["price"],
  "outcome": "booked",
  "topics": ["appointment booking", "pricing question"],
  "missed_opportunity": false,
  "follow_up_needed": false,
  "revenue_signal": "high",
  "churn_risk": false,
  "ai_summary": "The caller wanted a same-day appointment and asked about price before booking. They booked a 4pm slot despite the price being a bit higher than expected."
}

get_lead_score

Same input shape as score_conversation, plus an optional repeat_caller boolean (see Known limitation below).

Output:

{
  "score": 75,
  "tier": "hot",
  "signals_used": ["high urgency (+25)", "booking intent (+20)", "booked outcome (+20)", "positive sentiment (+10)"]
}

Scoring weights:

Signal Points
High urgency +25
Booking intent +20
Booked outcome +20
Repeat caller +15
Asked about pricing +10
Positive sentiment +10
Negative or frustrated sentiment -15
Dropped call -10
Low-intent inquiry -10

Score is clamped to 0-100. Bands: 70-100 hot, 40-69 warm, 0-39 cold.

diagnose_workflow_error

Input:

{
  "workflowJson": { "name": "...", "nodes": [...], "connections": {...} },
  "errorMessage": "Cannot read properties of undefined (reading 'toUpperCase')"
}

Output:

{
  "rootCause": "The Code node assumes $json.body.customer always exists, but the webhook can receive a payload without a customer object.",
  "fixSummary": "Add optional chaining so the node doesn't throw when customer is missing.",
  "fixable": true,
  "fixedWorkflow": { "...": "complete corrected workflow JSON" },
  "confidence": "medium",
  "notes": "Verify the caller of this node can tolerate a null email before deploying."
}

Scope note: this tool is a deliberately scoped-down port of a larger, stateful self-healing system. The original dispatches a separate evaluator sub-agent so the fix-generator never grades its own work, retries once on a rejected fix, fetches and writes back to a live n8n instance, and persists memory between runs. None of that fits inside one stateless MCP tool call, so only the diagnostic reasoning was ported: classify the error, propose the smallest possible fix, and admit honestly when a workflow edit can't fix it (expired credentials, rate limits, upstream outages, etc). Treat fixedWorkflow as a starting point for human or separate review, not something to auto-deploy.

Known limitation: repeat_caller

The "repeat caller" signal (+15 points) can't be derived from a transcript's text alone — it requires knowing call history, which this stateless tool doesn't have access to. If you already know this from your own CRM or call log, pass repeat_caller: true explicitly; otherwise it defaults to false and that signal is simply not counted.

Setup

npm install
cp .env.example .env
# edit .env and set ANTHROPIC_API_KEY

Registering with an MCP client

Add this to your .mcp.json (or the equivalent config for your client), using an absolute path since .mcp.json doesn't reliably resolve relative paths across clients:

{
  "mcpServers": {
    "tif-score-mcp": {
      "command": "node",
      "args": ["/absolute/path/to/tif-score-mcp/src/index.js"],
      "env": {
        "ANTHROPIC_API_KEY": "your-key-here"
      }
    }
  }
}

Restart your MCP client afterward so it picks up the new server.

Testing

npm run test:unit    # pure scoring-math tests, no network, no API key needed
npm run test:client  # spawns the real server, calls all three tools over real stdio JSON-RPC — needs ANTHROPIC_API_KEY, makes real (billed) API calls

You can also poke all three tools interactively without writing any code:

npx @modelcontextprotocol/inspector node src/index.js

A model compatibility note

This server defaults to claude-sonnet-4-6 with temperature: 0 for deterministic output. That's a deliberate choice: claude-sonnet-4-6 is the newest model that still accepts the temperature parameter — newer models (Opus 4.7+, Fable 5) reject it outright. If you change TIF_MODEL to a newer model, remove temperature from the calls in src/lib/anthropic.js first, or every tool call will fail.

Security

Never commit real API keys. .env is gitignored from the first commit, and .mcp.json in this repo only ever contains a placeholder — fill in your real key locally, not in version control.

Project layout

See CLAUDE.md for a fuller orientation, LEARNINGS.md for decisions made while building this, and SKILLS.md for which tools/skills this project leaned on.

License

MIT — see LICENSE.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选