# MCP (Model Context Protocol) Integration This Space is accessible via the Model Context Protocol, allowing integration with MCP clients like Cursor, Claude Desktop, and other compatible tools. ## Configuration ### For Claude Desktop Add the following to your Claude Desktop MCP configuration file: **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json` **Windows:** `%APPDATA%\Claude\claude_desktop_config.json` ```json { "mcpServers": { "flux-texture-lora": { "url": "https://huggingface.co/spaces/gokaygokay/Flux-Seamless-Texture-LoRA/gradio_api/mcp/", "type": "http" } } } ``` ### For Cursor Add to your Cursor MCP configuration: ```json { "mcpServers": { "flux-texture-lora": { "url": "https://huggingface.co/spaces/gokaygokay/Flux-Seamless-Texture-LoRA/gradio_api/mcp/", "type": "http" } } } ``` ## Available Tools ### `generate_texture` Generate a texture image with specified parameters. **Parameters:** - `prompt` (str): Text prompt for generation - `negative_prompt` (str, optional): Negative prompt - `guidance_scale` (float, optional): Guidance scale (default: 7.5) - `num_inference_steps` (int, optional): Number of steps (default: 50) - `seed` (int, optional): Random seed - `width` (int, optional): Image width (default: 1024) - `height` (int, optional): Image height (default: 1024) **Returns:** - `dict`: Contains `success`, `image_path`, `seed`, and `message` ### `generate_batch_textures` Generate multiple textures in batch. **Parameters:** - `prompts` (List[str]): List of prompts - `guidance_scale` (float, optional): Guidance scale - `num_inference_steps` (int, optional): Number of steps **Returns:** - `dict`: Contains `success`, `total`, and `results` list ### `get_presets` Get list of available presets. **Returns:** - `dict`: Contains `presets` list and `details` dictionary ### `get_history` Get generation history. **Parameters:** - `limit` (int, optional): Maximum entries to return (default: 10) **Returns:** - `dict`: Contains `total` and `entries` list ### `download_image` Get information about an image for download. **Parameters:** - `image_path` (str): Path to the image **Returns:** - `dict`: Contains `success`, `image_path`, and `metadata` ## Available Resources ### `presets://` Access preset definitions as JSON. **Example:** ``` presets://wood-texture ``` ### `history://` Access generation history as JSON. **Example:** ``` history://recent ``` ### `examples://` Access example images information. **Example:** ``` examples://list ``` ## Usage Examples ### Using with Claude Desktop 1. Configure MCP in Claude Desktop settings 2. Restart Claude Desktop 3. Ask Claude to generate a texture: ``` Generate a wood texture using the flux-texture-lora tool ``` ### Using with Cursor 1. Configure MCP in Cursor settings 2. Use the MCP tools in your code: ```python # Cursor can now access the MCP tools # to generate textures programmatically ``` ## Troubleshooting ### Connection Issues - Verify the Space URL is correct - Check that the Space is running - Ensure MCP is enabled in the Space configuration ### Tool Errors - Check parameter types and ranges - Verify prompts are not empty - Ensure image dimensions are multiples of 8 ## API Endpoint The MCP endpoint is available at: ``` /gradio_api/mcp/ ``` Full URL: ``` https://huggingface.co/spaces/gokaygokay/Flux-Seamless-Texture-LoRA/gradio_api/mcp/ ```