Skip to main content

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.

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.

Metadata

Release files for becda-mcp 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for becda-mcp 0.1.1
File Size Uploaded Provenance Actions
becda_mcp-0.1.1.tar.gz 13.1 kB With provenance Details for becda_mcp-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for becda-mcp 0.1.1
File Interpreter ABI Platform Actions
becda_mcp-0.1.1-py3-none-any.whl Python 3 none any Details for becda_mcp-0.1.1-py3-none-any.whl

Total release size: 28.9 kB

Release files / becda_mcp-0.1.1.tar.gz

Download URL becda_mcp-0.1.1.tar.gz
Size 13.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7275f0c5d8695a231ab8fad326a93f79b7e72d6d98ce14c7c4ef0540242aca37
BLAKE2b-256 checksum
How to use checksums
2464a66eb8d263ea68606459a5178934d97a46a590da95355ca3bad4d51b98a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / becda_mcp-0.1.1-py3-none-any.whl

Download URL becda_mcp-0.1.1-py3-none-any.whl
Size 15.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
03fa805024aaf48a9ece1524842a9e03b51b36f7286660589a40e70ad3145fd1
BLAKE2b-256 checksum
How to use checksums
db5fa1c7e51f9a4435e3581e78e13b5d8fb98b578f5a3f08656bcf8f8cbac316
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Security for becda-mcp 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for becda_mcp-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page