Skip to content

MCP (Model Context Protocol) as first-class service type #23

@richardkiene

Description

@richardkiene

Parent Issue

#19 - Multi-language runtime support via base images

Depends On

Overview

Make MCP (Model Context Protocol) servers a first-class service type in Fabricks, with built-in understanding of the protocol, capability restrictions, and tooling.

Motivation

MCP servers are an ideal use case for Fabricks:

  • Security critical: MCP servers have tool execution capabilities
  • Trust problem: Users want to run third-party MCP servers safely
  • WASM sandboxing: Perfect fit for capability-based security

Target User Experience

[info]
name = "my-mcp-server"
type = "mcp"  # New service type

[from]
image = "fabricks.dev/runtimes/python:3.12"

[source]
entrypoint = "server.py"

[capabilities.mcp]
tools = ["read_file", "search"]  # Allowed tool names
resources = ["file://*"]          # Allowed resource patterns
max_context_size = "100KB"        # Limit context window usage

Features

1. MCP-aware service type

New type = "mcp" that understands:

  • JSON-RPC protocol over stdio or HTTP/SSE
  • Tool definitions and invocations
  • Resource access patterns
  • Prompt/context handling

2. Capability restrictions for MCP

Fine-grained control over what an MCP server can do:

[capabilities.mcp]
# Which tools the server can expose
tools = ["read_file", "write_file", "search"]

# Resource URI patterns allowed
resources = [
  "file:///allowed/path/*",
  "https://api.example.com/*"
]

# Limits
max_tool_response_size = "1MB"
max_concurrent_tools = 5

3. MCP protocol proxy

The daemon can optionally proxy MCP traffic to:

  • Audit tool calls
  • Enforce capability restrictions
  • Rate limit requests
  • Log for compliance

4. MCP discovery

  • fabricks mcp list - Show available MCP servers
  • fabricks mcp inspect <service> - Show tools/resources a server provides

5. Integration with Claude/AI clients

Easy connection string generation:

fabricks mcp connect my-mcp-server
# Outputs configuration for Claude Desktop, etc.

Implementation Phases

  1. Basic MCP type: Recognize type = "mcp", treat as HTTP/stdio service
  2. MCP capability model: Add [capabilities.mcp] section
  3. Protocol-aware proxy: Inspect and enforce MCP traffic
  4. Discovery and tooling: CLI commands for MCP management

Example: Running a Third-Party MCP Server

# Clone someone's MCP server
git clone https://github.com/someone/cool-mcp-server
cd cool-mcp-server

# Add a Fabrickfile
fabricks init --type mcp --runtime python

# Build and run with restricted capabilities
fabricks build
fabricks run .

References

Acceptance Criteria

  • type = "mcp" recognized as valid service type
  • [capabilities.mcp] section parsed and validated
  • MCP servers can be built and run
  • Example MCP server in examples/ directory
  • Documentation for running MCP servers in Fabricks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions