Module: Reeve

Defined in:
lib/reeve.rb,
lib/reeve/audit.rb,
lib/reeve/errors.rb,
lib/reeve/context.rb,
lib/reeve/testing.rb,
lib/reeve/version.rb,
lib/reeve/decision.rb,
lib/reeve/fast_mcp.rb,
lib/reeve/invocation.rb,
lib/reeve/audit/entry.rb,
lib/reeve/audit/query.rb,
lib/reeve/scope_result.rb,
lib/reeve/authorization.rb,
lib/reeve/configuration.rb,
lib/reeve/audit/recorder.rb,
lib/reeve/audit/redactor.rb,
lib/reeve/testing/checks.rb,
lib/reeve/testing/ledger.rb,
lib/reeve/testing/report.rb,
lib/reeve/testing/result.rb,
lib/reeve/testing/matchers.rb,
lib/reeve/testing/assertions.rb,
lib/reeve/authorization/guard.rb,
lib/reeve/testing/checks/base.rb,
lib/reeve/authorization/scoper.rb,
lib/reeve/authorization/adapter.rb,
lib/reeve/authorization/current.rb,
lib/reeve/testing/matchers/base.rb,
lib/reeve/authorization/registry.rb,
lib/reeve/authorization/authorizer.rb,
lib/reeve/authorization/declaration.rb,
lib/reeve/testing/checks/rule_present.rb,
lib/reeve/authorization/adapters/plain.rb,
lib/reeve/authorization/adapters/pundit.rb,
lib/reeve/testing/checks/audit_coverage.rb,
lib/reeve/testing/checks/guard_declared.rb,
lib/reeve/testing/compliance_assertions.rb,
lib/reeve/testing/checks/redaction_holds.rb,
lib/reeve/testing/checks/contract_version.rb,
lib/reeve/testing/matchers/deny_access_for.rb,
lib/reeve/testing/checks/principal_required.rb,
lib/reeve/testing/matchers/audit_every_call.rb,
lib/reeve/testing/matchers/pass_reeve_check.rb,
lib/reeve/testing/checks/cross_principal_leak.rb,
lib/generators/reeve/install/install_generator.rb,
lib/reeve/integrations/fast_mcp/tool_extension.rb,
lib/reeve/integrations/fast_mcp/context_builder.rb

Overview

Reeve — per-record authorization and an append-only audit ledger for MCP tools.

Defined Under Namespace

Modules: Audit, Authorization, Generators, Guard, Integrations, Testing Classes: AuditWriteError, Configuration, ConfigurationError, Context, Decision, DeniedError, Error, Invocation, ScopeResult

Constant Summary collapse

VERSION =
"0.2.0"
Checks =

The name the contract and every host will type. Reeve::Checks::CrossPrincipalLeak is the public spelling; the file layout under testing/ is an implementation detail.

Testing::Checks

Class Method Summary collapse

Class Method Details

.configObject



144
145
146
# File 'lib/reeve/configuration.rb', line 144

def config
  @config ||= Configuration.new
end

.configure {|config| ... } ⇒ Object

Yields:



148
149
150
151
# File 'lib/reeve/configuration.rb', line 148

def configure
  yield(config)
  config
end

.invoke(tool:, arguments: {}, principal: :unset, agent: nil, metadata: {}, &body) ⇒ Object

The plain interface, and the composition root for every other one. An MCP server adapter builds the Context and calls this; there is no second path into the envelope, which is what makes "was this authorized and recorded?" answerable in one place.

Reeve.invoke(tool: InvoiceSearchTool, arguments: { query: "AC" },
           principal: current_user, agent: { id: "claude-desktop" })


28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/reeve/authorization.rb', line 28

def invoke(tool:, arguments: {}, principal: :unset, agent: nil, metadata: {}, &body)
  context = Context.new(
    tool_name: tool_name_for(tool),
    agent: agent,
    arguments: arguments,
    metadata: 
  )

  declaration = registry.guard_for(context.tool_name)
  adapter = declaration ? Authorization::Adapter.resolve(declaration.policy) : nil

  Authorization::Current.with(context: context, declaration: declaration, adapter: adapter) do
    Invocation.call(
      context,
      registry: registry,
      authorizer: Authorization::Authorizer.new,
      scoper: Authorization::Scoper.new,
      config: configuration_for(principal)
    ) { body ? body.call : run(tool, arguments) }
  end
end

.registryObject

The process-wide registry the DSL writes to.



109
110
111
# File 'lib/reeve/authorization/registry.rb', line 109

def registry
  @registry ||= Authorization::Registry.new
end

.reset_configuration!Object

Public so host test suites can isolate examples from one another.



154
155
156
# File 'lib/reeve/configuration.rb', line 154

def reset_configuration!
  @config = Configuration.new
end

.reset_registry!Object

Public so host test suites can isolate examples from one another.



114
115
116
# File 'lib/reeve/authorization/registry.rb', line 114

def reset_registry!
  registry.reset!
end