comfortool / README.md
Sandra Sanchez
Adapt script to make first 3 working mcp tools
4f79b3e

A newer version of the Gradio SDK is available: 6.12.0

Upgrade
metadata
title: Comfortool
emoji: 🐨
colorFrom: blue
colorTo: green
sdk: gradio
app_file: app.py
pinned: false
tags:
  - building-mcp-track-consumer
  - building-mcp-track-creative

Comfortool

Autism-friendly social stories with calming illustrations

Comfortool is a Gradio application and MCP server that generates personalized social stories and calming illustrations for autistic children. It uses OpenAI's LLMs and generative AI to help children understand and navigate everyday scenarios in a supportive, accessible way.

Structure

  • app.py: Main Gradio web interface. Handles user input through an intuitive UI, orchestrates story generation, and displays stories with illustrations and audio.
  • server.py: FastMCP server exposing three tools for Claude Desktop integration:
    • adapt_story: Adapts a scenario to a simple, autism-friendly story using GPT-4o-mini.
    • translate_story: Translates the story to the requested language with cultural and grammatical adaptation.
    • list_scenarios: Lists all available scenario templates.
  • mcp_server/templates/: JSON templates for different scenarios (dentist, first day at school, haircut, etc.).
  • generated_images/: Directory for storing AI-generated illustrations.
  • temp/: Temporary directory for storing generated audio files.

Features

Web Interface (Gradio)

  • Select from 10+ pre-defined scenarios (dentist, haircut, first day at school, etc.).
  • Generate simple, autism-friendly social stories adapted to:
    • Child's age, gender, and preferred character name
    • Cultural context and sensory sensitivities
  • Choose a creative illustration "vibe" or style (comic, kawaii, pastel, realistic, minimalist, watercolor, etc.) to personalize the visual experience.
  • Translate stories to any language or regional variety (Spanish from Spain, Mexican Spanish, etc.).
  • Generate calming illustrations using GPT-image-1 with customizable artistic styles.
  • Listen to the story with adaptive TTS (OpenAI voices selected intelligently by LLM based on character attributes).

Claude Desktop Integration (MCP)

  • MCP server built with FastMCP for seamless integration with Claude Desktop.
  • First version with three stable MCP tools accessible from Claude:
    • adapt_story: Create autism-friendly stories from any scenario description.
    • translate_story: Translate and culturally adapt stories with proper grammatical gender.
    • list_scenarios: Discover available scenario templates.
  • Extensible architecture for adding new tools and capabilities.

How to Use

Using the Web Interface

  1. Select a scenario from the dropdown menu (e.g., "Going to the dentist", "First day at school").

  2. Customize the story with your preferences:

    • Child's age
    • Child's gender (affects pronouns and story adaptation)
    • Comfort animal (supports main character in story)
    • Target language (Spanish from Spain, Mexican Spanish, English, etc.)
    • Illustration style/vibe (comic, kawaii, pastel, realistic, minimalist, watercolor)
  3. Click "Generate Story" to create your personalized social story.

  4. Explore variations: You can click the button multiple times with different settings to get:

    • Different illustration styles for the same story
    • Alternative story adaptations
    • Various character names or ages
    • Different languages or cultural contexts
  5. Review the output:

    • Read the adapted story text
    • View the calming illustration
    • Listen to the audio narration

Using with Claude Desktop (MCP)

Once configured, you can ask Claude to:

  • "Create an autism-friendly story about going to the dentist for a 6-year-old girl named Sofia"
  • "Translate this story to Mexican Spanish and adapt it culturally"
  • "What scenarios are available in Comfortool?"

Social Value & Potential Use

Comfortool empowers autistic children and their families by providing:

  • Personalized, accessible stories for daily challenges.
  • Visual and auditory support for understanding social situations.
  • Creative expression through customizable illustration styles, making stories more engaging and relatable.
  • Cultural and linguistic adaptation for diverse communities.
  • A gentle, supportive experience designed for neurodiversity.

Potential uses include:

  • Home and school support for children with autism.
  • Therapy and intervention tools for professionals.
  • Inclusive content for multicultural and multilingual families.

Next Steps & Future Directions

  • Add more scenarios and details for common challenges.
  • Improve illustration prompts for more diversity and realism.
  • Improve voice selection and pronunciation in raget language variation.
  • Integrate pictogram/comic summary for non-readers.
  • Gamification and motivational features.
  • Collect feedback from families and professionals.

Demo & Submission

How to run locally

Web Interface

# Install dependencies
uv sync

# Run Gradio app
uv run app.py

MCP Server (Claude Desktop Integration)

# Install FastMCP
uv add fastmcp

# Install MCP server in Claude Desktop
fastmcp install claude-desktop server.py

# Or manually configure in Claude Desktop config:
# ~/.config/Claude/claude_desktop_config.json (Linux/macOS)
# %APPDATA%/Claude/claude_desktop_config.json (Windows)

Example configuration:

{
  "mcpServers": {
    "comfortool": {
      "command": "/Users/your-username/.local/bin/uv",
      "args": [
        "--directory",
        "/path/to/comfortool",
        "run",
        "fastmcp",
        "run",
        "server.py"
      ]
    }
  }
}

Environment Variables

Create a .env file with:

OPENAI_API_KEY=your_openai_api_key

How to deploy

Push your code to Hugging Face Spaces and configure your secrets (e.g., OPENAI_API_KEY).


For more details, see the Spaces configuration reference