Skip to main content

A lightweight, file-based function execution engine.

Project description

Brimley

Early-stage MCP tooling runtime focused on faster iteration loops.

Status: Brimley is not yet ready for production use. It is aimed at improving the MCP development workflow and is still under active development.

Brimley is an authoring and execution engine for function-based AI tooling. It is focused on reducing the change/test loop during MCP tool development: change code -> reload -> re-test.

Design goals

  • Faster iteration loop: author tools in .py, .sql, .md, and .yaml files and execute them immediately, without a full redeploy cycle.
  • Safer change workflow: discovery is AST-first for Python (no import-time execution during scan), with diagnostics instead of immediate process termination.
  • Live runtime ergonomics: use a thin REPL client attached to a daemon-owned runtime, with optional watch-mode reload.
  • MCP integration path: expose selected functions as MCP tools via FastMCP when needed.
  • Declarative HTTP and CLI integration (0.7+): wrap external APIs and shell commands as first-class Brimley functions using YAML — no boilerplate code required.
  • Managed dependency injection (0.8+): @provider, Depends(), @on_startup/@on_shutdown hooks, and BrimleyContainer with singleton and request scopes — shared resources with proper lifecycle semantics.
  • Operations clarity: built-in reload diagnostics, runtime error surfacing, and explicit daemon lifecycle controls.

Architectural approach

Brimley separates tool authoring/execution semantics from MCP transport hosting:

  • Brimley handles discovery, schemas, argument resolution, execution, reload policy, and diagnostics.
  • FastMCP (optional) handles MCP server transport.

Keeping function logic separate from transport makes it reusable across local REPL workflows, dedicated MCP serving, and host-embedded deployments.

Quick Start

1) Install

poetry install

Optional MCP support:

poetry install -E fastmcp

2) Add brimley.yaml

brimley:
  app_name: "Brimley App"

config:
  support_email: "support@example.com"

state:
  request_count: 0

databases:
  default:
    connector: sqlite
    url: "sqlite:///./data.db"

auto_reload:
  enabled: true

mcp:
  embedded: true
  host: 127.0.0.1
  port: 8000

3) Add a Python function (calc.py)

from brimley import function

@function(mcpType="tool")
def calculate_tax(amount: float, rate: float = 8.25) -> float:
    return round(amount * (rate / 100.0), 2)

4) Run REPL

PYTHONPATH=src poetry run brimley repl --root .

5) Invoke once from CLI

PYTHONPATH=src poetry run brimley invoke calculate_tax --root . --input "{amount: 100, rate: 8.25}"

Core CLI Commands

  • brimley repl --root . [--mcp|--no-mcp] [--watch|--no-watch]
  • brimley repl --root . --shutdown-daemon
  • brimley mcp-serve --root . [--watch|--no-watch] [--host HOST] [--port PORT]
  • brimley invoke <function_name> --root . --input "{...}"
  • brimley build --root . [--output PATH]
  • brimley validate --root . [--format text|json] [--fail-on warning|error] [--output PATH]
  • brimley schema-convert --in schema.yaml --out fieldspec.yaml [--allow-lossy]

MCP Integration

Mark a function as an MCP tool:

  • Python: @function(mcpType="tool")
  • SQL/Template/API/CLI frontmatter:
mcp:
  type: tool

API and CLI functions defined in .yaml files are first-class MCP tools. See API Functions and CLI Functions.

Then serve tools with:

PYTHONPATH=src poetry run brimley mcp-serve --root .

Runtime Model (0.8 architecture baseline)

  • REPL uses a thin client attached to a daemon-owned runtime.
  • Daemon owns state, watcher lifecycle, and embedded MCP hosting.
  • /detach leaves daemon running; /quit (or --shutdown-daemon) terminates daemon session.
  • Reload is partitioned and diagnostics-driven; schema-shape tool changes require MCP client reconnect.

Documentation Map

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

brimley-0.8.1.tar.gz (91.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

brimley-0.8.1-py3-none-any.whl (115.3 kB view details)

Uploaded Python 3

File details

Details for the file brimley-0.8.1.tar.gz.

File metadata

  • Download URL: brimley-0.8.1.tar.gz
  • Upload date:
  • Size: 91.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for brimley-0.8.1.tar.gz
Algorithm Hash digest
SHA256 2c8df1cd3fe3ba273eee5aae8d9a3db2760943ab28e02ddd6a864073a4138fe9
MD5 50d98bc3491f12c1e0fa2fc8ca85288b
BLAKE2b-256 64d0704458a970a3acc1ba23951822e4285350cfd4f002347087b370a081dbd3

See more details on using hashes here.

File details

Details for the file brimley-0.8.1-py3-none-any.whl.

File metadata

  • Download URL: brimley-0.8.1-py3-none-any.whl
  • Upload date:
  • Size: 115.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for brimley-0.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 730c07666232c0a307dc02d99bb6a203ff9fbc443973619c04c3ebcbe16b701e
MD5 459421e14ccecd2e6b5ceff0d270f439
BLAKE2b-256 d9bfc3db429cbcc11209e4d3bca4e70839763c5a6a030a846924ec7931208c40

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page