Unstructured API MCP Server

Install Dependencies
  1. Add the MCP CLI package:

    uv add "mcp[cli]"
     
  2. Install additional Python packages:

    uv pip install --upgrade unstructured-client python-dotenv
     
  3. Alternatively, you can use:

    uv sync
     

Set Up Environment Variables

  1. Create a .env file in the root directory.
  2. Add your Unstructured API key:
    UNSTRUCTURED_API_KEY="YOUR_KEY"
     

Running the Server

  1. Use the MCP CLI to run the server:

    mcp run uns_mcp/server.py
     
  2. Alternatively, use:

    uv run uns_mcp/server.py
     

Claude Desktop Integration

  1. Navigate to ~/Library/Application Support/Claude/.

  2. Create a claude_desktop_config.json file.

  3. Add the following configuration:

    {
      "mcpServers": {
      "UNS_MCP": {
      "command": "ABSOLUTE/PATH/TO/.local/bin/uv",
      "args": [
      "--directory",
      "ABSOLUTE/PATH/TO/YOUR-UNS-MCP-REPO/uns_mcp",
      "run",
      "server.py"
      ],
      "env": [
      "UNSTRUCTURED_API_KEY":"<your key>"
      ],
      "disabled": false
      }
      }
     }
     
  4. Restart Claude Desktop.

Debugging Tools

  1. Use the MCP Inspector tool:

    mcp dev uns_mcp/server.py
     
  2. To log request call parameters, set:

    DEBUG_API_REQUESTS=false
     

Running Locally

  1. Run the minimal client:

    uv run python minimal_client/client.py uns_mcp/server.py
     
  2. Or use:

    make local-client
     

Running Locally with HTTP + SSE

  1. In one terminal, run the server:

    uv run python uns_mcp/server.py --host 127.0.0.1 --port 8080
     

    Or use:

    make sse-server
     
  2. In another terminal, run the client:

    uv run python minimal_client/client.py "http://127.0.0.1:8080/sse"
     

    Or use:

    make sse-client
     

Environment Variables for Client Configuration

  • Set the logging level:

    LOG_LEVEL="ERROR"
     
  • Disable tool use confirmation (for development purposes only):

    CONFIRM_TOOL_USE='false'
     
Share this post: