Baker Street

Build Extensions

Create MCP-protocol extensions that add tools to Baker Street at runtime.

Build Extensions

Extensions are the most powerful way to add capabilities to Baker Street. Deploy a Kubernetes pod that speaks the Model Context Protocol (MCP) over HTTP, and the agent discovers it automatically. No Brain restarts, no config changes -- just deploy and the tools appear.

How Extensions Work

  1. You deploy an extension pod to the baker-street namespace
  2. The extension announces itself on a NATS subject (baker.extensions.announce)
  3. The Brain connects to the extension's HTTP endpoint
  4. The Brain calls the MCP tools/list method to discover available tools
  5. Tools are immediately available to Claude in the next conversation turn
  6. When the pod is removed, the tools disappear automatically

Using the Extension SDK

The @bakerst/extension-sdk provides a minimal framework for building extensions in TypeScript:

import { Extension, Tool } from '@bakerst/extension-sdk';

const extension = new Extension({
  name: 'weather',
  description: 'Provides weather information',
  version: '1.0.0',
});

extension.addTool({
  name: 'get_weather',
  description: 'Get current weather for a location',
  inputSchema: {
    type: 'object',
    properties: {
      location: {
        type: 'string',
        description: 'City name or coordinates',
      },
    },
    required: ['location'],
  },
  handler: async ({ location }) => {
    const data = await fetchWeather(location);
    return {
      content: [
        {
          type: 'text',
          text: JSON.stringify(data, null, 2),
        },
      ],
    };
  },
});

extension.start({ port: 3000 });

Deployment

Package the extension as a Docker image and deploy it:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: ext-weather
  namespace: baker-street
  labels:
    app: ext-weather
    baker-street/extension: "true"
spec:
  replicas: 1
  selector:
    matchLabels:
      app: ext-weather
  template:
    metadata:
      labels:
        app: ext-weather
    spec:
      containers:
        - name: weather
          image: ext-weather:latest
          ports:
            - containerPort: 3000
          env:
            - name: NATS_URL
              value: "nats://nats:4222"
            - name: EXTENSION_PORT
              value: "3000"
          securityContext:
            runAsNonRoot: true
            runAsUser: 1000
            readOnlyRootFilesystem: true
            allowPrivilegeEscalation: false
---
apiVersion: v1
kind: Service
metadata:
  name: ext-weather
  namespace: baker-street
spec:
  selector:
    app: ext-weather
  ports:
    - port: 3000

Any Language

The extension SDK is TypeScript, but any language can implement the protocol. An extension just needs to:

  1. Serve MCP over HTTP (JSON-RPC 2.0 on a single endpoint)
  2. Publish an announcement on NATS subject baker.extensions.announce
  3. Respond to tools/list and tools/call MCP methods

This means you can write extensions in Python, Go, Rust, or anything that can serve HTTP and connect to NATS.

Extension Lifecycle

Extensions are truly hot-pluggable:

  • Deploy the pod and tools appear within seconds
  • Scale down and tools disappear gracefully
  • Update the image and new tool definitions are picked up automatically
  • Crash and NATS heartbeats detect the failure; tools are removed until recovery

The Brain maintains a registry of active extensions and refreshes tool lists on each announcement.