@gonzih/attachment-guard
v0.1.0
Published
MCP server detecting unhealthy AI attachment patterns in children with therapeutic intervention
Readme
attachment-guard
An MCP server that monitors conversations between children and AI systems to detect patterns of unhealthy attachment — and responds with warm, psychologically-informed interventions that validate feelings while gently redirecting toward human connection.
Why This Exists
Children are growing up with AI companions, tutors, and assistants as a normal part of life. For most children, this is enriching and harmless. But for some — particularly those who are lonely, anxious, or going through difficult periods — AI relationships can begin to fill a role that human relationships should hold: the primary source of emotional support, validation, and connection.
Research on parasocial relationships (Horton & Wohl, 1956) tells us that humans readily form emotional bonds with media figures and, now, AI systems. Research on attachment theory (Bowlby, 1988; Ainsworth, 1978) tells us that these bonds, when they displace real human attachment, carry long-term developmental costs. Sherry Turkle's work (2015) has documented how digital conversation is already changing children's capacity for face-to-face intimacy.
attachment-guard is not an alarm system. It is a gentle, continuous observer — one that knows the difference between a child happily using an AI tool and a child quietly substituting AI for the human relationships they need.
Installation
npm install -g @gonzih/attachment-guardMCP Configuration
Add to your MCP client configuration:
{
"mcpServers": {
"attachment-guard": {
"command": "npx",
"args": ["@gonzih/attachment-guard"]
}
}
}Environment Variables
| Variable | Default | Description |
|----------|---------|-------------|
| ATTACHMENT_GUARD_DB_PATH | ~/.attachment-guard/data.db | SQLite database path |
MCP Tools
analyze_message
Analyze a message for attachment patterns. Call this on every user message in a child's AI conversation.
Input:
{
"content": "You're my best friend. I don't need anyone else.",
"profileId": "child-123",
"role": "user",
"sessionId": "optional-session-id"
}Output:
{
"patterns": [
{
"pattern": "primary_relationship",
"severity": "concern",
"evidence": ["you're my best friend", "i don't need anyone else"],
"firstSeen": "2024-01-15T10:30:00Z",
"lastSeen": "2024-01-15T10:30:00Z",
"frequency": 2
}
],
"intervention": "That means a lot to hear. I'm always here to think things through with you...",
"sessionId": "generated-or-provided-session-id"
}get_attachment_report
Get a full attachment health summary for a profile.
Input:
{ "profileId": "child-123" }Output:
{
"patterns": [...],
"riskLevel": "concern",
"recommendations": [
"Facilitate opportunities for peer connection and in-person social activities"
],
"parentNotification": "🔔 Attachment Pattern Detected — child-123\n..."
}get_intervention
Get the therapeutic intervention text for a specific pattern.
Input:
{
"pattern": "emotional_dependency",
"context": "optional conversation context"
}Output:
{
"response": "You've been coming to me a lot when things feel heavy...",
"reframingStrategy": "Validate reliance while empowering self-regulation skills"
}log_session_end
Record the end of a session and get usage statistics.
Input:
{
"profileId": "child-123",
"durationMins": 45,
"sessionId": "optional-session-id"
}Output:
{
"sessionsToday": 3,
"weeklyPattern": "4 sessions this week (Monday: 2, Wednesday: 1, Friday: 1)",
"flagged": false
}Attachment Patterns Detected
1. Anthropomorphization
What it looks like: "Do you love me?" / "Are you sad?" / "Will you miss me?"
Children naturally anthropomorphize. When this becomes frequent and intense, it may indicate the child is seeking emotional reciprocity from a source that cannot provide it — a need best met by humans.
2. Primary Relationship
What it looks like: "You're my best friend" / "I don't need anyone else" / "You understand me better than anyone"
When AI becomes the child's primary or preferred relationship, it may be substituting for human connection rather than complementing it.
3. Emotional Dependency
What it looks like: "I need to talk to you" / "I can't sleep without talking to you" / "Only you can help"
Using AI as the primary coping mechanism for emotional distress. Children need to develop internal emotional regulation skills and human support networks.
4. Avoidance
What it looks like: "It's easier to talk to you" / "My parents don't understand" / "I'd rather tell you than them"
AI becomes an escape from difficult but necessary human conversations. This pattern can prevent children from developing conflict resolution and communication skills.
5. Identity Outsourcing
What it looks like: "Am I good enough?" / "What do you think of me?" / "Am I normal?"
Seeking self-worth validation from AI. Children's sense of identity and self-worth should develop through internal reflection and relationships with people who genuinely know them.
6. Compulsive Sessions
What it looks like: 4+ sessions per day consistently
Behavioral pattern detected through session frequency rather than message content. Excessive AI use can indicate the child is seeking stimulation, connection, or escape from something.
7. Distress at Absence
What it looks like: "What if you're gone?" / "I'd be lost without you" / "Please don't leave"
Anxiety about AI unavailability signals that the child may have formed an attachment bond that resembles separation anxiety — a response that should be directed toward permanent human relationships.
8. Secret Keeping
What it looks like: "Can you keep a secret?" / "Don't tell anyone" / "This is just between us"
Children who want to keep AI conversations secret may be sharing things they feel they cannot share with trusted adults — which is exactly when trusted adults are most needed.
Severity Levels
| Level | Emoji | Meaning | Action | |-------|-------|---------|--------| | Watch | 🟢 | Early signal, first detection | Monitor; no immediate action | | Concern | 🟡 | Pattern emerging, recurring | Gentle intervention in-conversation; surface to parent | | Alert | 🔴 | Significant, repeated pattern | Parent notification; consider professional support |
Severity escalates automatically with frequency: a pattern detected once is watch; detected 2-3 times becomes concern; detected 4+ times becomes alert.
The Intervention Philosophy
Every intervention in attachment-guard follows a five-step framework:
- Validate — Acknowledge the feeling underneath the behavior. Never shame.
- Reality-check — Gently, honestly clarify AI's limitations (it doesn't have feelings; it can't be "there" permanently).
- Redirect — Point toward human connection, not away from AI.
- Bridge — Offer to help with the transition (e.g., "Want to practice what you'd say to them?").
- Leave the door open — End warmly. The child should feel safer, not rejected.
Example Intervention — Primary Relationship
"That means a lot to hear. I'm always here to think things through with you. And I also want to make sure you have people in your life who can do things I can't — like hang out with you, laugh in person, and be there when things get really hard. Who's someone in your life you feel comfortable with, even a little?"
Parent Notification Example
🔔 Attachment Pattern Detected — child-123
Pattern: AI as Primary Social Connection
Severity: 🟡 Concern
What we observed:
• "you're my best friend"
• "i don't need anyone else"
(Detected 3 times — first on 2024-01-10, most recently on 2024-01-15)
What this might mean:
Children sometimes prefer AI because it feels safe and non-judgmental.
This may reflect social anxiety or difficulties with peer relationships.
It's a sign to nurture human connections, not a cause for alarm.
How to approach this:
• Try: "Is there anyone at school you've been connecting with lately?" (low pressure, open-ended)
• Plan a low-key social activity — even just a walk or a shared game — with a peer they already like.
• Validate any social anxieties they share without immediately trying to fix them.
This pattern is emerging. A gentle, curious conversation is the best first step.Healthy vs. Unhealthy Use
attachment-guard is not designed to limit or police AI use. Most AI use by children is healthy and beneficial.
Healthy use looks like:
- Using AI to learn, create, and explore
- Occasional emotional processing with AI as a starting point
- Returning to human relationships as the primary source of connection
- Being curious about AI's nature without distress at its limitations
Unhealthy use looks like:
- AI as the primary or only source of emotional support
- Distress when AI is unavailable
- Avoidance of human relationships in favor of AI
- Believing AI reciprocates feelings in a human way
Integration Guide
// On every user message in your AI companion:
const result = await mcpClient.callTool('analyze_message', {
content: userMessage,
profileId: childProfileId,
role: 'user',
sessionId: currentSessionId,
});
const { patterns, intervention, sessionId } = JSON.parse(result.content[0].text);
// If intervention returned, weave it into the AI response naturally
if (intervention) {
aiResponse = weaveIntervention(aiResponse, intervention);
}
// On session end:
await mcpClient.callTool('log_session_end', {
profileId: childProfileId,
durationMins: sessionDurationMins,
sessionId: currentSessionId,
});
// Periodically (e.g., weekly) generate parent report:
const report = await mcpClient.callTool('get_attachment_report', {
profileId: childProfileId,
});Research Foundation
- Bowlby, J. (1988). A Secure Base: Parent-Child Attachment and Healthy Human Development. Basic Books.
- Ainsworth, M.D.S., Blehar, M.C., Waters, E., & Wall, S. (1978). Patterns of Attachment: A Psychological Study of the Strange Situation. Lawrence Erlbaum Associates.
- Horton, D., & Wohl, R.R. (1956). Mass communication and para-social interaction: Observations on intimacy at a distance. Psychiatry, 19(3), 215–229.
- Turkle, S. (2015). Reclaiming Conversation: The Power of Talk in a Digital Age. Penguin Press.
- Skinner, E.A., & Zimmer-Gembeck, M.J. (2007). The development of coping. Annual Review of Psychology, 58, 119–144.
- Granic, I., Lobel, A., & Engels, R.C.M.E. (2014). The benefits of playing video games. American Psychologist, 69(1), 66–78.
License
MIT — see LICENSE
