falai-mcp-tools


Namefalai-mcp-tools JSON
Version 0.2.2 PyPI version JSON
download
home_pageNone
SummaryFastMCP server exposing fal.ai model APIs
upload_time2025-10-07 17:54:31
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseNone
keywords mcp fal.ai ai model api server
VCS
bugtrack_url
requirements fastmcp fal-client httpx
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # falai-mcp-server

A FastMCP server that exposes core fal.ai model API operations (model catalogue, search, schema retrieval, inference, queue management, CDN uploads). The server can run locally over STDIO or remotely via the Streamable HTTP transport, and now ships with Docker support for easier deployment.

<video controls width="1920" height="512" src="https://github.com/user-attachments/assets/f8cfb202-3d69-4395-959d-76b2a11181e7">Your browser does not support the video tag.</video>

## Quick Start

### PyPI Installation (Recommended)

```bash
pip install falai-mcp-tools
```

After installation, you can run the server with:

```bash
falai-mcp
```

### Manual Installation

1. Clone the repository:
   ```bash
   git clone https://github.com/berkbirkan/falai-mcp.git
   cd falai-mcp
   ```

2. Create and activate a virtual environment:
   ```bash
   python3 -m venv .venv
   source .venv/bin/activate  # On Windows: .venv\Scripts\activate
   ```

3. Install the project in editable mode:
   ```bash
   pip install -e .
   ```

## Requirements

- Python 3.10 or newer
- A fal.ai API key: either `FAL_KEY` or the `FAL_KEY_ID`/`FAL_KEY_SECRET` pair
- Docker (optional, only if you prefer containerized execution)

## Configuration

Environment variables (prefixed with `FALAI_`) control runtime behaviour:

| Variable | Description |
| --- | --- |
| `FAL_KEY` or `FAL_KEY_ID`/`FAL_KEY_SECRET` | fal.ai credentials (required for live API calls) |
| `FALAI_ALLOWED_MODELS` | Comma-separated list of explicit model IDs to expose |
| `FALAI_MODEL_KEYWORDS` | Comma-separated keywords to pre-filter models when no explicit list is provided |
| `FALAI_REQUEST_TIMEOUT` | HTTP timeout (seconds) for fal.ai requests (default: `120`) |
| `FALAI_ENABLE_HTTP` | Set to `true` to run the server with the Streamable HTTP transport |
| `FALAI_HTTP_HOST` / `FALAI_HTTP_PORT` | Bind address and port when HTTP transport is enabled (defaults: `0.0.0.0` / `8080`) |

If you prefer a `.env` file, place it next to the project root (or mount it into the container) and load it before running the server.

> Clients can override credentials and model filters per MCP session through the `configure` tool. Environment variables supply defaults when the client does not set overrides.

## Usage

### Local STDIO usage

1. Ensure your virtual environment is active and credentials are exported:
   ```bash
   export FAL_KEY=sk_live_...
   ```

2. Run the server with the default STDIO transport:
   ```bash
   falai-mcp
   ```

3. Leave the process running; configure your MCP client (Claude, Cursor, etc.) to launch this command via STDIO (see the client integration section).

### Remote HTTP usage

1. Export credentials and enable the HTTP transport:
   ```bash
   export FAL_KEY=sk_live_...
   export FALAI_ENABLE_HTTP=true
   export FALAI_HTTP_PORT=8080  # optional override
   ```

2. Start the server so it listens on the configured host/port:
   ```bash
   falai-mcp
   ```

3. Confirm the HTTP transport is reachable (for example with `curl -I http://localhost:8080/mcp/`). Clients should connect to `http://<host>:<port>/mcp/`.

### Docker Usage

1. Build the container image:
   ```bash
   docker build -t falai-mcp .
   ```

2. Run the container with HTTP enabled and publish the port:
   ```bash
   docker run \
     --rm \
     -e FAL_KEY=sk_live_... \
     -e FALAI_ENABLE_HTTP=true \
     -e FALAI_HTTP_PORT=8080 \
     -p 8080:8080 \
     falai-mcp
   ```

3. The MCP endpoint is now available at `http://localhost:8080/mcp/`.

## Client integrations

Below are example configurations for popular MCP clients. Adjust paths, environment variables, and identifiers to match your setup.

### Claude Desktop

Claude Desktop keeps its configuration in `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or the equivalent path on your platform.

- **STDIO (local process)**
  ```json
  {
    "mcpServers": {
      "falai-local": {
        "command": "falai-mcp",
        "args": [],
        "env": {
          "FAL_KEY": "sk_live_..."
        }
      }
    }
  }
  ```
  Restart Claude Desktop after saving changes. Claude will spawn `falai-mcp` and communicate over STDIO.

- **Remote HTTP server**
  ```json
  {
    "mcpServers": {
      "falai-remote": {
        "transport": {
          "type": "http",
          "url": "http://localhost:8080/mcp/"
        }
      }
    }
  }
  ```

### Cursor

Cursor reads MCP configuration from `~/.cursor/mcp.json`.

- **STDIO (local process)**
  ```json
  {
    "clients": {
      "falai-local": {
        "command": "falai-mcp",
        "args": [],
        "env": {
          "FAL_KEY": "sk_live_..."
        }
      }
    }
  }
  ```

- **Remote HTTP server**
  ```json
  {
    "clients": {
      "falai-remote": {
        "transport": {
          "type": "http",
          "url": "http://localhost:8080/mcp/"
        }
      }
    }
  }
  ```

After editing `mcp.json`, restart Cursor (or reload MCP connections) to pick up the new configuration.

## Available tools

| Tool | Description |
| --- | --- |
| `configure(api_key=None, allowed_models=None, model_keywords=None)` | Override credentials and access scope for the active session |
| `models(page=None, total=None)` | List available models with optional pagination |
| `search(keywords)` | Search the model catalogue using space-separated keywords |
| `schema(model_id)` | Retrieve the OpenAPI schema for a model |
| `generate(model, parameters, queue=False)` | Run synchronous or queued inference |
| `result(url)` | Fetch the result of a queued request |
| `status(url)` | Check the status (optionally with logs) of a queued request |
| `cancel(url)` | Cancel a queued request |
| `upload(path)` | Upload a local file to fal.ai CDN |

All tools enforce any configured allow-list and respect per-session overrides from the `configure` tool.

## Development

### Building for PyPI

1. Install build tools:
   ```bash
   pip install build twine
   ```

2. Build the package:
   ```bash
   python -m build
   ```

3. Upload to PyPI (test first with TestPyPI):
   ```bash
   # Test upload
   python -m twine upload --repository testpypi dist/*
   
   # Production upload
   python -m twine upload dist/*
   ```

## Notes

- Schema retrieval and queue inspection require valid fal.ai credentials; errors appear as MCP tool errors if credentials are missing or invalid.
- Model discovery falls back to the bundled `fal-client` endpoint catalogue when fal.ai's public APIs are unavailable.
- When running remotely, ensure network access between the client and the MCP server (open firewall ports, configure TLS or reverse proxies if needed).

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "falai-mcp-tools",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "Berk Birkan <berkbirkan@example.com>",
    "keywords": "mcp, fal.ai, ai, model, api, server",
    "author": null,
    "author_email": "Berk Birkan <berkbirkan@example.com>",
    "download_url": "https://files.pythonhosted.org/packages/d1/79/e7552926bad9c2aed99e321d5414f8d71dc68890747f8fdc566121d4a0de/falai_mcp_tools-0.2.2.tar.gz",
    "platform": null,
    "description": "# falai-mcp-server\n\nA FastMCP server that exposes core fal.ai model API operations (model catalogue, search, schema retrieval, inference, queue management, CDN uploads). The server can run locally over STDIO or remotely via the Streamable HTTP transport, and now ships with Docker support for easier deployment.\n\n<video controls width=\"1920\" height=\"512\" src=\"https://github.com/user-attachments/assets/f8cfb202-3d69-4395-959d-76b2a11181e7\">Your browser does not support the video tag.</video>\n\n## Quick Start\n\n### PyPI Installation (Recommended)\n\n```bash\npip install falai-mcp-tools\n```\n\nAfter installation, you can run the server with:\n\n```bash\nfalai-mcp\n```\n\n### Manual Installation\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/berkbirkan/falai-mcp.git\n   cd falai-mcp\n   ```\n\n2. Create and activate a virtual environment:\n   ```bash\n   python3 -m venv .venv\n   source .venv/bin/activate  # On Windows: .venv\\Scripts\\activate\n   ```\n\n3. Install the project in editable mode:\n   ```bash\n   pip install -e .\n   ```\n\n## Requirements\n\n- Python 3.10 or newer\n- A fal.ai API key: either `FAL_KEY` or the `FAL_KEY_ID`/`FAL_KEY_SECRET` pair\n- Docker (optional, only if you prefer containerized execution)\n\n## Configuration\n\nEnvironment variables (prefixed with `FALAI_`) control runtime behaviour:\n\n| Variable | Description |\n| --- | --- |\n| `FAL_KEY` or `FAL_KEY_ID`/`FAL_KEY_SECRET` | fal.ai credentials (required for live API calls) |\n| `FALAI_ALLOWED_MODELS` | Comma-separated list of explicit model IDs to expose |\n| `FALAI_MODEL_KEYWORDS` | Comma-separated keywords to pre-filter models when no explicit list is provided |\n| `FALAI_REQUEST_TIMEOUT` | HTTP timeout (seconds) for fal.ai requests (default: `120`) |\n| `FALAI_ENABLE_HTTP` | Set to `true` to run the server with the Streamable HTTP transport |\n| `FALAI_HTTP_HOST` / `FALAI_HTTP_PORT` | Bind address and port when HTTP transport is enabled (defaults: `0.0.0.0` / `8080`) |\n\nIf you prefer a `.env` file, place it next to the project root (or mount it into the container) and load it before running the server.\n\n> Clients can override credentials and model filters per MCP session through the `configure` tool. Environment variables supply defaults when the client does not set overrides.\n\n## Usage\n\n### Local STDIO usage\n\n1. Ensure your virtual environment is active and credentials are exported:\n   ```bash\n   export FAL_KEY=sk_live_...\n   ```\n\n2. Run the server with the default STDIO transport:\n   ```bash\n   falai-mcp\n   ```\n\n3. Leave the process running; configure your MCP client (Claude, Cursor, etc.) to launch this command via STDIO (see the client integration section).\n\n### Remote HTTP usage\n\n1. Export credentials and enable the HTTP transport:\n   ```bash\n   export FAL_KEY=sk_live_...\n   export FALAI_ENABLE_HTTP=true\n   export FALAI_HTTP_PORT=8080  # optional override\n   ```\n\n2. Start the server so it listens on the configured host/port:\n   ```bash\n   falai-mcp\n   ```\n\n3. Confirm the HTTP transport is reachable (for example with `curl -I http://localhost:8080/mcp/`). Clients should connect to `http://<host>:<port>/mcp/`.\n\n### Docker Usage\n\n1. Build the container image:\n   ```bash\n   docker build -t falai-mcp .\n   ```\n\n2. Run the container with HTTP enabled and publish the port:\n   ```bash\n   docker run \\\n     --rm \\\n     -e FAL_KEY=sk_live_... \\\n     -e FALAI_ENABLE_HTTP=true \\\n     -e FALAI_HTTP_PORT=8080 \\\n     -p 8080:8080 \\\n     falai-mcp\n   ```\n\n3. The MCP endpoint is now available at `http://localhost:8080/mcp/`.\n\n## Client integrations\n\nBelow are example configurations for popular MCP clients. Adjust paths, environment variables, and identifiers to match your setup.\n\n### Claude Desktop\n\nClaude Desktop keeps its configuration in `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or the equivalent path on your platform.\n\n- **STDIO (local process)**\n  ```json\n  {\n    \"mcpServers\": {\n      \"falai-local\": {\n        \"command\": \"falai-mcp\",\n        \"args\": [],\n        \"env\": {\n          \"FAL_KEY\": \"sk_live_...\"\n        }\n      }\n    }\n  }\n  ```\n  Restart Claude Desktop after saving changes. Claude will spawn `falai-mcp` and communicate over STDIO.\n\n- **Remote HTTP server**\n  ```json\n  {\n    \"mcpServers\": {\n      \"falai-remote\": {\n        \"transport\": {\n          \"type\": \"http\",\n          \"url\": \"http://localhost:8080/mcp/\"\n        }\n      }\n    }\n  }\n  ```\n\n### Cursor\n\nCursor reads MCP configuration from `~/.cursor/mcp.json`.\n\n- **STDIO (local process)**\n  ```json\n  {\n    \"clients\": {\n      \"falai-local\": {\n        \"command\": \"falai-mcp\",\n        \"args\": [],\n        \"env\": {\n          \"FAL_KEY\": \"sk_live_...\"\n        }\n      }\n    }\n  }\n  ```\n\n- **Remote HTTP server**\n  ```json\n  {\n    \"clients\": {\n      \"falai-remote\": {\n        \"transport\": {\n          \"type\": \"http\",\n          \"url\": \"http://localhost:8080/mcp/\"\n        }\n      }\n    }\n  }\n  ```\n\nAfter editing `mcp.json`, restart Cursor (or reload MCP connections) to pick up the new configuration.\n\n## Available tools\n\n| Tool | Description |\n| --- | --- |\n| `configure(api_key=None, allowed_models=None, model_keywords=None)` | Override credentials and access scope for the active session |\n| `models(page=None, total=None)` | List available models with optional pagination |\n| `search(keywords)` | Search the model catalogue using space-separated keywords |\n| `schema(model_id)` | Retrieve the OpenAPI schema for a model |\n| `generate(model, parameters, queue=False)` | Run synchronous or queued inference |\n| `result(url)` | Fetch the result of a queued request |\n| `status(url)` | Check the status (optionally with logs) of a queued request |\n| `cancel(url)` | Cancel a queued request |\n| `upload(path)` | Upload a local file to fal.ai CDN |\n\nAll tools enforce any configured allow-list and respect per-session overrides from the `configure` tool.\n\n## Development\n\n### Building for PyPI\n\n1. Install build tools:\n   ```bash\n   pip install build twine\n   ```\n\n2. Build the package:\n   ```bash\n   python -m build\n   ```\n\n3. Upload to PyPI (test first with TestPyPI):\n   ```bash\n   # Test upload\n   python -m twine upload --repository testpypi dist/*\n   \n   # Production upload\n   python -m twine upload dist/*\n   ```\n\n## Notes\n\n- Schema retrieval and queue inspection require valid fal.ai credentials; errors appear as MCP tool errors if credentials are missing or invalid.\n- Model discovery falls back to the bundled `fal-client` endpoint catalogue when fal.ai's public APIs are unavailable.\n- When running remotely, ensure network access between the client and the MCP server (open firewall ports, configure TLS or reverse proxies if needed).\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "FastMCP server exposing fal.ai model APIs",
    "version": "0.2.2",
    "project_urls": {
        "Homepage": "https://github.com/berkbirkan/falai-mcp",
        "Issues": "https://github.com/berkbirkan/falai-mcp/issues",
        "Repository": "https://github.com/berkbirkan/falai-mcp"
    },
    "split_keywords": [
        "mcp",
        " fal.ai",
        " ai",
        " model",
        " api",
        " server"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "dd53bf3ed8852d18fd44156dc004f6598ad02a313cee487edecd8c4a1f7620d4",
                "md5": "a38c3075fbec449a2bee1671697d2af8",
                "sha256": "24b711bf59afe2f08aec5108d0dae56047a2515074fcccd844fba032f35cc777"
            },
            "downloads": -1,
            "filename": "falai_mcp_tools-0.2.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a38c3075fbec449a2bee1671697d2af8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 12806,
            "upload_time": "2025-10-07T17:54:30",
            "upload_time_iso_8601": "2025-10-07T17:54:30.723942Z",
            "url": "https://files.pythonhosted.org/packages/dd/53/bf3ed8852d18fd44156dc004f6598ad02a313cee487edecd8c4a1f7620d4/falai_mcp_tools-0.2.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d179e7552926bad9c2aed99e321d5414f8d71dc68890747f8fdc566121d4a0de",
                "md5": "a971ce77c03182cf78b94a3af48bec01",
                "sha256": "702a510c9bb12cd15103800cac5fd5484f9b67dd4ab67b1ec1f8283e3fdda336"
            },
            "downloads": -1,
            "filename": "falai_mcp_tools-0.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "a971ce77c03182cf78b94a3af48bec01",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 13893,
            "upload_time": "2025-10-07T17:54:31",
            "upload_time_iso_8601": "2025-10-07T17:54:31.937561Z",
            "url": "https://files.pythonhosted.org/packages/d1/79/e7552926bad9c2aed99e321d5414f8d71dc68890747f8fdc566121d4a0de/falai_mcp_tools-0.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-07 17:54:31",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "berkbirkan",
    "github_project": "falai-mcp",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "fastmcp",
            "specs": [
                [
                    ">=",
                    "2.10.0"
                ],
                [
                    "<",
                    "2.12.0"
                ]
            ]
        },
        {
            "name": "fal-client",
            "specs": [
                [
                    ">=",
                    "0.7.0"
                ],
                [
                    "<",
                    "1.0.0"
                ]
            ]
        },
        {
            "name": "httpx",
            "specs": [
                [
                    "==",
                    "0.27.0"
                ]
            ]
        }
    ],
    "lcname": "falai-mcp-tools"
}
        
Elapsed time: 2.64526s