FA

Fabric MCP Server for Cline AI Execution

Enable AI-driven task execution with the Fabric MCP server, integrating Fabric patterns into Cline to expose tools and enhance Cline's capabilities.

Quick Install
npx -y @adapoet/fabric-mcp-server

Overview

The Fabric MCP Server is a lightweight Model Context Protocol (MCP) implementation designed to expose tool APIs for Cline-based AI agents. It maps Fabric-style tool patterns into an HTTP/WebSocket-compatible server so that language models and assistants using Cline can discover, invoke, and monitor external tools in a standardized way. The server acts as a bridge between AI execution logic and real-world actions (shell commands, file operations, HTTP calls, custom scripts), enabling safe, auditable tool use from agent prompts.

This server is useful for developers building AI-driven workflows and agent integrations: it centralizes tool registration, enforces simple access controls, and provides a JSON-based protocol for request/response streaming and status updates. Use it to prototype tool-backed agents, attach tools to Cline clients, or orchestrate multi-step tasks where an LLM delegates actions to deterministic tooling.

Features

  • MCP-compatible endpoints for tool discovery and invocation
  • Registerable tool patterns including command, file, and HTTP utilities
  • JSON request/response with support for streaming/partial output
  • Simple token-based authentication and configurable CORS
  • Lightweight Python-based server for local development and deployment
  • Logging and audit trails for executed tool calls
  • Extensible plugin pattern to add custom tool handlers

Installation / Configuration

Prerequisites: Python 3.9+ and a virtual environment. Replace commands with your preferred package manager if needed.

Clone the repository and install dependencies:

git clone https://github.com/adapoet/fabric-mcp-server.git
cd fabric-mcp-server
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Start the server with the provided module entrypoint (default host 127.0.0.1, port 8080):

# run with defaults
python -m fabric_mcp_server

# specify host/port and token
python -m fabric_mcp_server --host 0.0.0.0 --port 8080 --token "your-secret-token"

Configuration can be supplied via a YAML/JSON file or environment variables. Example YAML (config.yaml):

server:
  host: 0.0.0.0
  port: 8080
  cors: ["*"]
  token: "replace-with-secret"

tools:
  - id: shell.exec
    type: shell
    description: Execute shell commands (restricted)
    allow_args: true
  - id: files.read
    type: file
    description: Read files from workspace
    base_path: /workspace

Run with a config file:

python -m fabric_mcp_server --config config.yaml

Docker example (build locally):

docker build -t fabric-mcp-server .
docker run -p 8080:8080 -e MCP_TOKEN=your-secret-token fabric-mcp-server

Available Tools / Resources

The server exposes a discoverable list of registered tools and their schemas. Common built-in resources include:

  • GET /v1/tools — list available tools and metadata
  • POST /v1/execute — invoke a tool (JSON body)
  • GET /v1/execute/{id}/status — check execution status
  • WebSocket /v1/stream/{run_id} — subscribe to streaming output/events
  • GET /health — simple readiness/liveness probe

Typical tool types provided out of the box:

  • shell — execute shell commands with argument sanitization
  • file — read/write operations bounded to a base path
  • http — make outbound HTTP requests (useful for APIs)
  • script — run a registered script/function inside the server process

Authentication is handled by a token header (Authorization: Bearer ) by default.

Use Cases

  1. Agent-driven CI helper

    • A Cline agent inspects a failing test log, determines it needs to run a specific test suite, and calls the shell.exec tool on the MCP server to run tests and stream logs back to the agent for analysis.
    • Example invoke payload:
      {
        "tool_id": "shell.exec",
        "args": ["pytest tests/test_example.py -q"],
        "meta": {"cwd": "/workspace/project"}
      }
      
  2. File-aware code assistant

    • The AI uses files.read to open source files, then files.write or shell.exec to apply patches or run linters. The server enforces base_path boundaries to avoid accidental access outside the workspace.
  3. Orchestration of multi-step tasks

    • An assistant composes multiple tool calls: call an HTTP tool to query an issue tracker, call shell.exec to apply commits, then call a CI trigger endpoint. The MCP server tracks each run and provides status updates through the /v1/execute/{id}/status endpoint and streaming socket.
  4. Safe production integrations

    • Use token-scoped tools and logging to allow AI components limited, auditable access to internal utilities, reducing risk while enabling automation.

Getting started tips

  • Start locally with read-only tools (e.g., files.read) to validate agent behavior before enabling shell/script execution.
  • Use the streaming WebSocket to display partial outputs in real time in your client UI.
  • Keep tool schemas small and explicit; expose only the arguments your agents require.
  • Monitor logs and execution history during early-stage testing to catch unwanted or expensive operations.

For source code, issues, and contributions, see the project on GitHub: https://github.com/adapoet/fabric-mcp-server.