Skip to main content
Glama
README.md
# ๐Ÿš€ FusionAL โ€” Self-Hosted MCP Governance Gateway

![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)
![Docker](https://img.shields.io/badge/Docker-Ready-blue?logo=docker)
![Python 3.11+](https://img.shields.io/badge/Python-3.11%2B-blue?logo=python)
![MCP Compatible](https://img.shields.io/badge/MCP-Compatible-orange)
[![smithery badge](https://smithery.ai/badge/jrm-fusional/fusional)](https://smithery.ai/servers/jrm-fusional/fusional)

> **Your team connected 10 MCP servers. Now what?**  
> ๐ŸŒ [fusional.dev](https://fusional.dev) โ€ข ๐Ÿ“ง [jrm@fusional.dev](mailto:jrm@fusional.dev) โ€ข ๐Ÿ—“๏ธ [Book a Call](https://calendly.com/jonathanmelton004/30min)

MCP is powerful. Enterprise MCP deployment is a different problem entirely.

Every server you connect loads its full tool manifest into Claude's context window before
processing a single token of your request. At 84 tools across several servers, that's
**15,540 tokens consumed at session start** โ€” before your team has asked anything.
At scale, that's cost, latency, and an audit surface nobody can explain to legal.

FusionAL is a **self-hosted MCP governance gateway** that sits between your AI clients
and your tool servers. One endpoint. Central auth. Tool-level policy enforcement.
Full audit trail. Deployable in a single Docker command โ€” including on Windows,
where MCP has 6 documented failure modes the official docs don't cover.

**Built for teams that have already said yes to MCP and now need to run it safely:**
- **Token control** โ€” filter tool exposure per client so context bloat doesn't scale with your server count
- **Audit-ready operations** โ€” every tool call logged with caller, input, latency, and response status
- **Policy enforcement** โ€” control what tools run, for whom, and under what conditions
- **Windows-hardened** โ€” 6 documented failure modes solved, none of which appear in official MCP docs
- **AI-powered server generation** โ€” describe a tool in plain English, FusionAL builds and registers it
- **Done-for-you option** โ€” we deploy, govern, and manage it for you

> *The question isn't whether to adopt MCP. It's whether your deployment will survive contact with your security team.*

---

## โšก Quick Start (5 Minutes)

### Prerequisites
- Docker Desktop (installed and running)
- Claude Desktop
- Python 3.11+
- Git

### Step 1: Clone & Install

```bash
git clone https://github.com/JRM-FusionAL/FusionAL.git
cd FusionAL

python -m venv venv
source venv/bin/activate        # macOS/Linux
# venv\Scripts\activate         # Windows

pip install -r core/requirements.txt
```

### Step 2: Start FusionAL

```bash
cd core
python -m uvicorn main:app --reload --port 8009
```

Verify it's running:
```bash
curl http://localhost:8009/health
```

### Step 3: Configure Claude Desktop

Find your config file:
- **Windows:** `C:\Users\YourName\AppData\Roaming\Claude\claude_desktop_config.json`
- **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
- **Linux:** `~/.config/Claude/claude_desktop_config.json`


> โš ๏ธ **Windows users:** Do NOT use `%APPDATA%` in the path โ€” Claude Desktop won't expand it.
> Hardcode the full path. Example: `C:\Users\YourName\AppData\Roaming\Claude\claude_desktop_config.json`

Add FusionAL as an MCP server:

```json
{
  "mcpServers": {
    "fusional-gateway": {
      "url": "http://localhost:8009/sse"
    }
  }
}
```

### Step 4: Restart Claude Desktop & Test

Fully quit and reopen Claude Desktop. Open a new chat and try:

> *"Generate a Python MCP server that fetches the current weather for a given city."*

FusionAL will generate, register, and run it automatically.

---

## ๐Ÿณ Docker Deploy

Build and run the full gateway in Docker:

```bash
docker build -t fusional .
docker run -d -p 8089:8009 --name fusional fusional
```

Or with Docker Compose:

```bash
docker compose up -d
```

Gateway available at `http://localhost:8089`.

---

## ๐Ÿ—๏ธ Architecture

```
Claude Desktop / Any MCP Client
         โ”‚
         โ–ผ  (SSE or Streamable HTTP)
  FusionAL Gateway  (:8009)
         โ”‚
   โ”Œโ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”
   โ–ผ            โ–ผ
FastAPI      MCP Transport (/mcp)
REST API     โ”œโ”€โ”€ execute_code
             โ”œโ”€โ”€ generate_and_execute
             โ””โ”€โ”€ generate_mcp_project
         โ”‚
         โ–ผ
  Docker Sandbox Executor
  (network isolated, memory capped)
         โ”‚
         โ–ผ
  MCP Server Registry (JSON)
  โ”œโ”€โ”€ business-intelligence-mcp  (:8101)
  โ”œโ”€โ”€ api-integration-hub        (:8102)
  โ””โ”€โ”€ content-automation-mcp     (:8103)
```

### MCP Tools (via `/mcp`)

| Tool | Description |
|------|-------------|
| `execute_code` | Run Python in an isolated subprocess sandbox |
| `generate_and_execute` | Plain English prompt โ†’ Claude writes it โ†’ runs it |
| `generate_mcp_project` | Describe an MCP server โ†’ Claude builds the full project |

### REST API

| Endpoint | Method | Description |
|----------|--------|-------------|
| `/health` | GET | Health check |
| `/execute` | POST | Execute Python (optional Docker sandbox) |
| `/register` | POST | Register an MCP server in the registry |
| `/catalog` | GET | List all registered servers |
| `/generate` | POST | Generate and launch a new server from a prompt |

---

## ๐Ÿ› ๏ธ Showcase Servers

These servers ship with the [mcp-consulting-kit](https://github.com/JRM-FusionAL/mcp-consulting-kit)
and are pre-registered in the FusionAL gateway:

| Server | Port | Tools |
|--------|------|-------|
| `business-intelligence-mcp` | 8101 | Natural language โ†’ SQL (PostgreSQL, MySQL, SQLite) |
| `api-integration-hub` | 8102 | Slack, GitHub Issues, Stripe customer lookup |
| `content-automation-mcp` | 8103 | Web scraping, link extraction, table parsing, RSS feeds |

Start the full showcase stack:

```bash
cd ../mcp-consulting-kit
docker compose up -d
```

---

## ๐Ÿ”’ Security Model

### Docker Sandbox

Each code execution runs with:
- โœ… Network isolation (`--network none`)
- โœ… Memory limits (default 128 MB, configurable)
- โœ… Process limits (max 64 processes)
- โœ… Read-only filesystem (except `/tmp`)
- โœ… No privilege escalation
- โœ… Non-root user execution

### API Security (optional)

When `mcp-consulting-kit/showcase-servers/common/security.py` is present, the gateway enables:
- API key authentication on `/execute`, `/register`, `/generate`
- Rate limiting
- CORS configuration

---

## ๐ŸชŸ Windows-Specific Fixes

FusionAL documents and solves 6 Windows MCP failure modes not covered in official docs:

1. **The 60-Second Silence** โ€” Claude Desktop times out with zero error. Caused by Docker socket init lag.  
   [Read the fix โ†’](https://dev.to/jonathanmeltonfusional/why-your-mcp-setup-keeps-timing-out-in-60-seconds-and-how-i-fixed-it-on-windows-367a)

2. **The BOM Trap** โ€” Notepad/VS Code injects a byte-order mark into JSON configs, silently breaking MCP.  
   Fix: `[System.IO.File]::WriteAllText(path, content, New-Object System.Text.UTF8Encoding($false))`

3. **The Backslash Trap** โ€” Windows path separators in `claude_desktop_config.json` break startup silently.  
   Use forward slashes or escaped double backslashes.

4. **`%USERPROFILE%` expansion** โ€” Claude Desktop does NOT expand env vars in config paths. Hardcode them.

5. **Docker named pipe failure** โ€” Docker's named pipe transport fails on WSL2. Use `/var/run/docker.sock`.

6. **Registry timeout at 8+ servers** โ€” Claude Desktop hits a timeout threshold on lower-end hardware.  
   Cap your registry at 8 servers on i5/i7 7th gen and below.

---

## ๐Ÿงฐ Building Your Own MCP Server

### Using the AI Builder (via Claude Desktop)

After connecting FusionAL, ask Claude:

> *"Generate an MCP server that queries our PostgreSQL database using natural language."*

FusionAL generates the full project, builds it, and registers it in the gateway automatically.

### Manual Server Structure

```
my-server/
โ”œโ”€โ”€ Dockerfile
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ my_server.py       โ† FastMCP tools go here
โ””โ”€โ”€ .env
```

### Key Rules

1. Use `@mcp.tool()` decorators on async functions
2. Single-line docstrings only (multi-line breaks some MCP clients)
3. Return formatted strings from all tools
4. Default parameters to `""` not `None`
5. Log to `sys.stderr`
6. Run as non-root in Docker

```python
from mcp.server.fastmcp import FastMCP
import sys

mcp = FastMCP("my-server")

@mcp.tool()
async def my_tool(query: str = "") -> str:
    """What this tool does in one line."""
    return f"โœ… Result for: {query}"

if __name__ == "__main__":
    mcp.run(transport='stdio')
```

---

## ๐Ÿ“š Examples

| Example | Path | What it demonstrates |
|---------|------|----------------------|
| Dice Roller | `examples/dice-roller/` | D&D dice (8 tools), dice notation parsing |
| Weather API | `examples/weather-api/` | External API integration, error handling |
| File Utils | `examples/file-utils/` | Safe filesystem access, pagination |

---

## ๐Ÿš€ Done-for-You Consulting

Don't want to self-manage? FusionAL sets up and reviews AI workflows for you:

| Offer | Price | For |
|------|-------|-----|
| **Starter Workflow** | $750 fixed | One AI-assisted workflow for a small owner-run business, up to 2 existing apps |
| **Standard Workflow** | $1,500 fixed | One workflow for a multi-crew service business, up to 3 apps incl. field-service platform |
| **Care** | $300/mo | Small fixes on a FusionAL-built workflow, up to 2 hrs/month |
| **MCP Access Audit** | $2,500 | Read-only review of one live agent/MCP workflow, 5 business days |
| **AI Use Policy Review** | $3,500 | Staff AI-use policy and settings checklist, 5 business days |
| **Agent Ops Retainer** | $2,000/mo | Monthly permission-drift review, up to 8 hrs |

Scope is agreed on a call before payment. Details: [fusional.dev](https://fusional.dev) ยท [jrm@fusional.dev](mailto:jrm@fusional.dev) ยท [Book a 30-min call](https://calendly.com/jonathanmelton004/30min)

---

## ๐Ÿค Contributing

Contributions welcome. Priority areas:
- New example servers
- Windows compatibility fixes
- Documentation improvements
- Test coverage

---

## ๐Ÿ“„ License

MIT โ€” see [LICENSE](LICENSE)

---

## ๐Ÿ™ Credits

- [Anthropic](https://anthropic.com) โ€” Claude AI + MCP protocol
- [FastAPI](https://fastapi.tiangolo.com) โ€” API framework
- [FastMCP](https://github.com/jlowin/fastmcp) โ€” MCP server framework
- [Docker](https://docker.com) โ€” Container infrastructure

---

**Built by a self-taught developer who fixed the MCP problems nobody else documented.**  
๐ŸŒ [fusional.dev](https://fusional.dev) โ€ข โญ Star the repo if it saved you hours

---

## ๐Ÿ™Œ Origin & Inspiration

FusionAL started with a NetworkChuck video.

If you haven't watched [*"you need to learn MCP RIGHT NOW!!"*](https://youtube.com/@NetworkChuck) โ€” go watch it first. Chuck explains the fundamentals better than anyone, and his [docker-mcp-tutorial repo](https://github.com/theNetworkChuck/docker-mcp-tutorial) is the best starting point for understanding how MCP servers work with Docker.

The dice-roller example and quick-start structure in this repo are adapted from that tutorial (MIT licensed).

**Where FusionAL goes further:**

Chuck's tutorial shows you how to build MCP servers manually โ€” edit a prompt template, paste it into Claude, implement the result yourself.

FusionAL removes the human from that loop entirely. Instead of a prompt file you copy-paste, `generate_mcp_project` is a live tool call โ€” Claude describes what it wants built, FusionAL generates it, registers it, and runs it. No clipboard. No manual steps.

More importantly, Chuck's video covers Docker's MCP catalog โ€” 300+ servers you can enable with a click. That's step one. FusionAL is what you need when a CTO asks:

> *"Great โ€” but how do we audit what those tools are doing? How do we enforce policy? How do we make sure this doesn't become a security incident?"*

That's the gap FusionAL was built to fill: governance, auditability, and operational control for teams deploying MCP at scale โ€” especially on Windows, where the catalog alone isn't enough.