dwf-analyzer-mcp

jesamkim/dwf-analyzer-mcp

3.2

If you are the rightful owner of dwf-analyzer-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

A Model Context Protocol (MCP) server for analyzing DWF (Design Web Format) files using Amazon Bedrock's Nova Pro model for visual analysis.

Tools
9
Resources
0
Prompts
0

DWF Analyzer MCP Server

smithery badge

A Model Context Protocol (MCP) server for analyzing DWF (Design Web Format) files using Amazon Bedrock's Nova Pro model for visual analysis.

Features

  • DWF File Parsing: Extract metadata, layers, and object information from DWF files
  • Image Extraction: Extract embedded images from DWF files with format detection and conversion
  • Visual Analysis: Analyze drawings using Amazon Nova Pro multimodal AI model
  • Comprehensive Analysis: Combined metadata extraction, image processing, and visual analysis

Installation

Prerequisites

  • Python 3.12 or higher
  • AWS account with Bedrock access
  • AWS credentials configured

Install from Source

git clone https://github.com/jesamkim/dwf-analyzer-mcp.git
cd dwf-analyzer-mcp
uv install

Using uvx (Recommended)

uvx dwf-analyzer-mcp

Configuration

Environment Variables

Set the following environment variables:

export AWS_ACCESS_KEY_ID="your-access-key"
export AWS_SECRET_ACCESS_KEY="your-secret-key"
export AWS_DEFAULT_REGION="us-west-2"  # Optional, defaults to us-west-2
export LOG_LEVEL="INFO"  # Optional, defaults to INFO

AWS Permissions

Your AWS credentials need the following permissions:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "bedrock:InvokeModel",
                "bedrock:InvokeModelWithResponseStream"
            ],
            "Resource": [
                "arn:aws:bedrock:*::foundation-model/us.anthropic.claude-3-7-sonnet-20250219-v1:0",
                "arn:aws:bedrock:*::foundation-model/us.amazon.nova-pro-v1:0"
            ]
        }
    ]
}

Usage

Running the Server

# Using the installed package (HTTP transport)
dwf-analyzer-mcp

# Using uvx (HTTP transport)
uvx dwf-analyzer-mcp

# Using FastMCP directly (HTTP transport)
fastmcp run dwf_analyzer_mcp.server:mcp --transport streamable-http

# Custom host and port
HOST=0.0.0.0 PORT=8080 dwf-analyzer-mcp

MCP Client Configuration

Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "dwf-analyzer": {
      "url": "http://localhost:8080/mcp",
      "transport": "http",
      "env": {
        "AWS_ACCESS_KEY_ID": "your-access-key",
        "AWS_SECRET_ACCESS_KEY": "your-secret-key",
        "AWS_DEFAULT_REGION": "us-west-2"
      }
    }
  }
}
Cursor IDE

Add an HTTP-type server:

{
  "url": "http://localhost:8080/mcp",
  "transport": "http"
}
Zed Editor

Add to your MCP settings:

{
  "dwf-analyzer": {
    "url": "http://localhost:8080/mcp",
    "transport": "http"
  }
}

Available Tools

Core Analysis Tools

extract_dwf_metadata

Extract metadata and basic information from a DWF file.

Parameters:

  • file_path (string): Path to the DWF file

Returns: Dictionary containing file metadata, layers, and object summary

extract_dwf_images

Extract embedded images from a DWF file.

Parameters:

  • file_path (string): Path to the DWF file
  • output_dir (string, optional): Directory to save extracted images

Returns: Dictionary containing extraction results and image information

analyze_dwf_visual

Perform visual analysis of a DWF file using Amazon Nova Pro.

Parameters:

  • file_path (string): Path to the DWF file
  • focus_area (string): Analysis focus area (general)
  • include_metadata (boolean): Whether to include file metadata in results

Returns: Dictionary containing visual analysis results

analyze_dwf_comprehensive

Perform comprehensive analysis including metadata, images, and visual analysis.

Parameters:

  • file_path (string): Path to the DWF file

Returns: Dictionary containing complete analysis results

System Tools

health_check

Perform a health check of the service.

Returns: Dictionary containing service health status

Available Resources

dwf://analysis/config

Get the current analysis configuration schema.

dwf://analysis/supported-formats

Get information about supported DWF formats and capabilities.

Supported Formats

  • DWF Versions: V00.22, V00.30, V00.55, V06.00
  • Image Formats: PNG, JPEG, BMP, GIF, WEBP
  • Max File Size: 100MB
  • AWS Regions: us-west-2, us-east-1, eu-west-1, ap-southeast-1

Analysis Focus Areas

  • general: Overall drawing analysis

Development

Setup Development Environment

git clone https://github.com/jesamkim/dwf-analyzer-mcp.git
cd dwf-analyzer-mcp
uv install --dev

Running Tests

uv run pytest

Code Formatting

uv run black src tests
uv run ruff check src tests

Type Checking

uv run mypy src

Examples

Basic Usage

# Extract metadata from a DWF file
result = extract_dwf_metadata("/path/to/drawing.dwf")
print(result["metadata"]["header"]["version"])

# Extract images
images = extract_dwf_images("/path/to/drawing.dwf", "/output/directory")
print(f"Extracted {images['extracted_images']} images")

# Perform visual analysis
analysis = analyze_dwf_visual("/path/to/drawing.dwf", focus_area="general")
print(analysis["visual_analysis"])

Comprehensive Analysis

# Perform complete analysis
result = analyze_dwf_comprehensive("/path/to/drawing.dwf")

# Access different parts of the analysis
metadata = result["metadata"]
images = result["image_extraction"]
visual = result["visual_analysis"]

Troubleshooting

Common Issues

  1. AWS Credentials Error

    • Ensure AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are set
    • Verify your AWS account has Bedrock access
  2. Model Access Error

    • Check if Nova Pro model is available in your AWS region
    • Verify your AWS permissions include bedrock:InvokeModel
  3. Image Processing Error

    • Ensure Pillow is installed: pip install pillow
    • Check if the DWF file contains extractable images
  4. File Not Found Error

    • Verify the DWF file path is correct and accessible
    • Check file permissions

Debug Mode

Enable debug logging:

export LOG_LEVEL=DEBUG
dwf-analyzer-mcp

License

This project is licensed under the Apache License 2.0 - see the file for details.

Changelog

v0.2.0

  • BREAKING CHANGE: Migrated from STDIO to Streamable HTTP transport
  • Updated server configuration for HTTP deployment
  • Added uvicorn and starlette dependencies for HTTP server support
  • Updated client configuration examples for HTTP transport
  • Improved scalability and production deployment capabilities

v0.1.0

  • Initial release
  • Basic DWF parsing functionality
  • Image extraction capabilities
  • Amazon Nova Pro integration
  • FastMCP server implementation
  • Comprehensive analysis tools