Skip to main content

Universal MCP server for emotional tone analysis and de-escalation in communications

Project description

Emotional De-escalation MCP Server v2

Universal MCP server for emotional tone analysis and de-escalation using a 5-axis communication style model.

Based on: Mistakes to Avoid When Developing Chatbots for User Support

5-Axis Communication Style Model

Every message is characterized by a style vector — 5 independent axes on a discrete scale from -2 to +2:

Axis -2 -1 0 +1 +2
W Warmth cold, detached cool neutral friendly warm, empathetic
F Formality slang, crude casual balanced professional formal, official
P Playfulness dead serious dry balanced light, witty humorous, ironic
A Assertiveness uncertain, meek tentative balanced confident demanding, forceful
E Expressiveness terse, reserved restrained balanced animated emotional, intense

Style Combinations

Style W F P A E
Sarcasm -2 -1 +2 0 +1
Friendly humor +1 -1 +2 -1 0
Flirtatious +2 -2 +1 -1 +1
Business tone 0 +2 -2 0 -1
Aggression -2 -2 -2 +2 +2
Desperation 0 -1 -2 -1 +2
Passive-aggression -1 0 +1 +1 -1

De-escalation Strategy

Instead of a single coefficient, de-escalation operates per-axis:

Axis Shift Rationale
Warmth +1 Increase empathy
Formality +1 Slightly more professional
Playfulness → 0 Reduce sarcasm risk
Assertiveness -1 Reduce pressure
Expressiveness -1 Calm down intensity

This breaks the positive feedback loop by ensuring the bot's response vector is always shifted toward a more constructive zone.

Tools

emotion_analyze

Analyze a message → emotion + style vector + style label.

{
  "text": "ну конечно, ваш замечательный бот мне так помог, спасибо огромное",
  "language_hint": "ru"
}

Returns:

{
  "emotion": "anger",
  "intensity": 1,
  "style_vector": {"warmth": -2, "formality": -1, "playfulness": 2, "assertiveness": 0, "expressiveness": 1},
  "detected_style": "sarcasm",
  "explanation": "...",
  "triggers": ["ну конечно", "замечательный", "спасибо огромное"]
}

emotion_de_escalate

Rewrite a draft to match a target style vector.

Auto mode (default): analyzes user, applies de-escalation shifts. Override mode: pass target_style explicitly.

{
  "user_message": "what the hell is wrong with the delivery?!",
  "draft_response": "Your order should arrive by April 10.",
  "target_style": {"warmth": 1, "formality": 1, "playfulness": 0, "assertiveness": 0, "expressiveness": 0}
}

emotion_evaluate_dialogue

Evaluate full dialogue → per-message vectors + trend + feedback loop risk.

{
  "messages": [
    {"role": "user", "text": "hello"},
    {"role": "bot", "text": "Hello! How can I help?"},
    {"role": "user", "text": "what the hell is wrong with the delivery?!"},
    {"role": "bot", "text": "Your order #3756 arrives April 10."},
    {"role": "user", "text": "ok I guess I'll wait"}
  ],
  "response_format": "markdown"
}

Returns a table:

# Role Emotion W F P A E Style
1 user neutral 0 -1 0 0 0 casual
2 bot neutral +1 0 0 0 0 friendly
3 user anger -2 -2 -2 +2 +2 aggressive
4 bot neutral 0 +1 -1 0 -1 business
5 user neutral 0 -1 0 -1 0 resigned

Setup

pip install -e .
export ANTHROPIC_API_KEY=sk-ant-...
python server.py

Claude Desktop / Claude Code config

{
  "mcpServers": {
    "emotional-deescalation": {
      "command": "python",
      "args": ["/path/to/emotional-mcp/server.py"],
      "env": {
        "ANTHROPIC_API_KEY": "sk-ant-..."
      }
    }
  }
}

Agent integration

For LLM agents connecting via MCP: see AGENTS.md — a compact instruction file designed to minimize context window usage while providing all necessary tool selection and invocation guidance.

Architecture

MCP Client (Claude Desktop, Claude Code, any MCP host)
    │ stdio
    ▼
emotional_deescalation_mcp
    ├── emotion_analyze        → emotion + style vector W/F/P/A/E
    ├── emotion_de_escalate    → rewrite draft to target vector
    └── emotion_evaluate_dialogue → per-message vectors + dynamics
            │
            ▼
      Anthropic Claude API (analysis backend)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

emotional_deescalation_mcp-0.1.0.tar.gz (68.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

emotional_deescalation_mcp-0.1.0-py3-none-any.whl (77.4 kB view details)

Uploaded Python 3

File details

Details for the file emotional_deescalation_mcp-0.1.0.tar.gz.

File metadata

File hashes

Hashes for emotional_deescalation_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cca572056b7c5046b5906b86dca22c15655eff3a278cb35cff0b2316cf72be71
MD5 5e3ebe3bbbc3908068e48862a8db619f
BLAKE2b-256 1b085c6938a5da26cfa1a2cac1592b95e567b0eb907675b2226b43efdbd077a3

See more details on using hashes here.

File details

Details for the file emotional_deescalation_mcp-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for emotional_deescalation_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 49cabe4ad6363ea998770d4d5173c9f985d097c2247bac6ef4bc189f214f98b7
MD5 a33d9460dfb193a5e147098babf1fdb9
BLAKE2b-256 c72b3abb093118fb90ba60994f2f549c27ee70ad6dbcf02bb57eb8e49d562888

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page