Skip to main content
Glama

becda-mcp

A read-only MCP server for Becda decision memory. AI reads. Becda learns how you decide.

An AI agent can ask Becda what code a record should get, how sure Becda is, and whether it is safe to process the record automatically. The agent cannot teach, change or delete anything.

Install

pip install becda-mcp
# or run without installing:
uvx becda-mcp

Python 3.10 or newer. The only dependency is the official mcp SDK. The server talks to the Becda API over HTTPS with the Python standard library.

Related MCP server: MCP Knowledge Assistant

Configuration (environment variables only)

Variable

Required

Meaning

BECDA_API_KEY

yes

Your key. Use a read-only key (starts with becda_ro_).

BECDA_TENANT

yes

Your tenant id. Tools take no tenant parameter.

BECDA_BASE_URL

no

Default https://api.becda.com. Change it for a self-hosted setup.

BECDA_SCHEMA

no

Path to a schema JSON file (see below).

BECDA_HASH_SALT

no

Salt for hashed fields. Required if the schema hashes any field.

If the key does not start with becda_ro_, the server prints a warning to stderr and still works. Examples for Claude Desktop and Cursor are in becda_mcp/ornekler/.

Tools

Read-only tools (all work with a becda_ro_... read-only key):

  • becda_predict(fields, text?, item_id?): one record. Runs through the tenant's active Decision Rules (pre-rules and post-rules) and decision memory, returning the structured result (code, confidence, auto_approved, reason, plus rule_* fields when a rule applies) and normalized_fields.

  • becda_predict_batch(records): up to 100 records. Same shape per record.

  • becda_status(): observation counts, cold start flag, alarm, closed codes, and active rule version (when rules are enabled).

  • becda_explain(result): turns a becda_predict result (including rule-triggered outcomes) into a few plain sentences. Runs locally; no server call.

  • becda_rules_summary(): reads the tenant's active company/policy decision rules (pre-rules and post-rules) together with plain-English summaries. Uses no quota.

  • becda_rules_simulate(fields, text?, pre_rules?, post_rules?): dry-runs current or proposed rules against this tenant's real memory with zero quota cost and zero side effects.

  • becda_rules_telemetry(limit?): reads ZDR-safe live decision rule hit counts and recent events (never contains invoice text, supplier names, or amounts). Uses no quota.

  • becda_rules_templates(template_id?): lists Becda's tested rule templates (12 categories, a basic and an advanced one each) and the tenant's own templates saved in the Portal; with template_id it returns one template with its JDM table, required fields, example record and plain-language summary. Agents should start from a template and adapt thresholds instead of writing rules from scratch. Uses no quota.

Draft-only staging tool (requires a full write key; returns 403 read_only_key with becda_ro_...):

  • becda_rules_save_draft(pre_rules?, post_rules?, enabled?): validates a JDM decision table (blocking arbitrary code nodes) and saves it as a DRAFT only. Live traffic is never changed automatically—a person reviews the plain-language summary and publishes it in the Becda Portal (Karar Kuralları). Drafts saved through MCP are labelled "written by an agent" there, and publishing them asks for an extra confirmation.

There are no learn, rollback, forget, close-code, or live rule-publish tools.

Schema file (becda-sema.json)

{
  "fields": {
    "<canonical_name>": {
      "aliases": ["other_name", "..."],   // matched case-insensitively
      "clean": ["strip", "upper"],        // applied in order
      "hash": true                        // optional
    }
  },
  "text_max_chars": 500,                  // text is cut to this length
  "unknown_fields": "error"               // "error" (default) or "pass"
}

Cleaners: strip; upper; lower; digits (keep digits only); number ("20%" becomes "20", "0.20" stays "0.20"; no guessing, anything else is left as is).

An unknown field name returns a tool error that lists the allowed names. Nothing is sent and nothing is dropped silently. Without a schema file, fields pass through with only whitespace stripped, at most 50 fields and 200 characters per value.

An example is in becda_mcp/ornekler/becda-sema.json.

Hashing

With "hash": true, the cleaned value is replaced by "h:" plus the first 16 hex characters of HMAC-SHA256 with BECDA_HASH_SALT as key and the value as message (UTF-8). If the schema asks for a hash and no salt is set, the call fails with a clear error.

The ERP side must use the same salt and the same format when it teaches Becda. If the salts or cleaning rules differ, Becda will not recognise the supplier.

Security model

  • The server runs on your machine over stdio. There is no hosted MCP service.

  • The tenant and key come only from the environment. An agent cannot ask about another tenant.

  • Use a read-only key. The Becda API answers 403 read_only_key for any write with it.

  • Tool descriptions say only what a tool does. Tool output is structured JSON and does not echo document text beyond the normalized fields.

  • The API key never appears in output or logs. Each call has a 15 second timeout.

Why there are no write tools

A write tool would let text inside a document (an invoice, an email) steer the agent into teaching Becda wrong decisions. That is memory poisoning through prompt injection. Becda therefore learns only from decisions a person confirmed in the ERP, using a full-access key that the agent never holds. A design note for an optional, human-approved write path will follow.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      A read-only MCP server that provides AI coding tools with database schema structure (tables, columns, keys, relationships) without exposing row data.
      3
      21 PyPI
      Apache 2.0
    • F
      license
      A
      quality
      D
      maintenance
      A read-only MCP server that enables AI clients to search a knowledge base and retrieve complete source documents via narrow search and fetch tools.
      2
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI clients to run read-only yes/no checks, classifications, and ordered scores with probabilities, supporting triage, routing, sentiment, and lead-fit decisions through hosted or self-hosted MCP tools.
      41 npm
      AGPL 3.0