Extensions

Build anything with SystemPrompt extensions: websites, MCP servers, background jobs, CLI tools. You own the binary, you control the code.

When you build with SystemPrompt, you own the binary. Not an account on a hosted service. A real Rust binary that compiles from source code you control, runs on infrastructure you choose, and executes functionality you define.

Extensions are how you add that functionality. Write Rust code that implements API routes, database schemas, background jobs, MCP tools, or custom CLI commands. Compile it into your binary. Deploy it wherever you want.

Extension Domains

Extensions group into four primary domains:

Domain Binary Type Use Case
Library Compiles into main Database, API, jobs, providers
Web Compiles into main Page data, templates, assets
MCP Standalone binary AI agent tools via MCP protocol
CLI Standalone binary Command-line utilities

Library Extensions

Library extensions compile directly into your main binary. They implement the Extension trait and provide:

  • Database schemas and migrations
  • HTTP API routes
  • Background jobs
  • LLM and tool providers
  • Configuration validation

See Library Extensions for details.

Web Extensions

Web extensions handle content rendering and static site generation. They provide:

  • Page data providers (template variables)
  • Component renderers (HTML fragments)
  • Content data providers (enrichment)
  • Template data extenders
  • Page prerenderers (static pages)
  • RSS and sitemap generators
  • Asset declarations

See Web Extensions for details.

MCP Extensions

MCP extensions are standalone binaries that expose tools for AI agents via the Model Context Protocol. They:

  • Run as separate processes
  • Listen on TCP ports
  • Serve tool requests via MCP
  • Enable Claude and other AI clients

See MCP Extensions for details.

CLI Extensions

CLI extensions are standalone binaries for automation:

  • Custom command-line tools
  • External integrations
  • Utility commands
  • Agent-invokable scripts

See CLI Extensions for details.

Documentation Structure

Domains

Core Traits

Web Traits

Lifecycle

Internals

MCP Deep Dives

Quick Start

  1. Choose your extension domain based on use case
  2. Create the extension crate
  3. Implement required traits
  4. Register with register_extension!
  5. Link in the template's src/lib.rs
  6. Build and test

Directory Structure

extensions/
├── web/                    # Library extension
│   ├── Cargo.toml
│   ├── src/
│   │   ├── lib.rs
│   │   ├── extension.rs
│   │   ├── api/
│   │   ├── jobs/
│   │   └── services/
│   └── schema/
├── mcp/
│   └── systemprompt/       # MCP server
│       ├── Cargo.toml
│       └── src/
│           └── main.rs
└── cli/
    └── discord/            # CLI tool
        ├── Cargo.toml
        └── src/
            └── main.rs

Ownership Model

The SystemPrompt template is your project. When you clone it:

  • Release cycle - Upgrade core when you choose
  • Deployment - Run anywhere
  • Modification - Fork, customize, add features
  • Distribution - Ship to customers, embed in products