Structure

MCP servers in Compozy follow a standardized structure that includes server configuration and implementation patterns:

mcp_servers:
  - id: string # Unique identifier for the MCP server
    use: string | object # Server reference (shorthand or detailed)
    command: string # Command to execute the server
    config: object # Server-specific configuration
    env: object # Server-specific environment variables

Basic Usage

MCP servers can be used in two main ways:

mcp_servers:
  - id: telegram
    use: compozy/mcp-servers:telegram@1.0.0
    command: "npx -y @compozy/mcp-telegram"

Each server can be configured using the config property, environment variables, and execution commands:

mcp_servers:
  - id: github
    use: compozy/mcp-servers:github
    command: "npx -y @modelcontextprotocol/server-github"
    config:
      token: "{{ env.GITHUB_TOKEN }}"
    env:
      GITHUB_TOKEN: "your-github-token"

Best Practices

Server Configuration

Define server settings and credentials using the config schema

File Structure

Organize server implementation in separate files with clear configuration

Context Management

Implement proper context and memory handling through schema definitions

Memory System

Use the built-in memory system for state persistence

Task Integration

Integrate servers with tasks using mcp() function

Using MCP Servers in Tasks

MCP servers can be used directly in tasks using the mcp() function:

tasks:
  - id: notify_team
    use: mcp(slack)
    with:
      channel: engineering
      message: "{{ workflow.output.alert }}"

  - id: process_support
    use: mcp(zendesk)
    with:
      ticket_id: "{{ trigger.ticket_id }}"
      status: "in_progress"

References