Skip to main content
Glama
bc-source-mcp

bc-source-mcp

by glachana

bc-source-mcp

npm license

Serveur MCP (Model Context Protocol) qui expose les sources de Microsoft Dynamics 365 Business Central — toutes versions (BC v23 -> v29), toutes localisations (W1 + 47 pays), avec et sans vNext — a des agents IA comme Claude Code et Claude Desktop.

Vous voulez juste l'installer pour l'utiliser ? Voir INSTALL.md.

Donnees pompees du depot communautaire StefanMaron/MSDyn365BC.Sandbox.Code.History. Le serveur fait un partial clone (~1,6 Go au lieu de 50-100 Go) puis indexe les objets AL dans une base SQLite locale, ce qui permet des lookups a <100 ms.


A quoi ca sert

Pour un agent IA qui code en AL, devoir deviner la signature d'une procedure standard, le nom exact d'un event publisher ou la liste des champs d'une table BC est une cause majeure d'hallucinations. Ce MCP donne a l'agent un acces structure et verifie au code source BC, sans dependre de sa memoire d'entrainement.

Exemples d'usages typiques :

  • Trouver les IntegrationEvent a souscrire dans Approvals Mgmt. en v27

  • Recuperer la definition exacte de la table Customer en localisation FR vs W1

  • Chercher tous les usages d'un motif de code a travers la Base Application

  • Comparer la presence d'un objet entre plusieurs versions

Related MCP server: bcquality-mcp

Les 14 tools exposes

Categorie

Tool

Description

Decouverte

bc_list_branches

Liste les 545 branches du repo upstream

Decouverte

bc_list_versions

Versions BC (23 -> 29, avec ou sans vNext)

Decouverte

bc_list_localizations

47 codes pays + W1

Decouverte

bc_list_apps

Apps top-level d'une branche

Decouverte

bc_list_objects

Objets AL filtres (type / app / pattern) avec pagination

Decouverte

bc_find_object_across_branches

Presence d'un objet a travers les branches indexees

Lookup

bc_get_object

Source AL d'un objet (avec line_start/line_end/include_source pour les gros objets)

Lookup

bc_get_event_publishers

Events publies par un objet (IntegrationEvent, BusinessEvent, InternalEvent)

Lookup

bc_get_procedure

Procedure ciblee avec signature, body, attributes

Recherche

bc_search_code

Recherche regex via ripgrep, scope par app/type (avec timeout de 30s)

Recherche

bc_search_fts

Full-text FTS5 cross-branch, syntaxe FTS5 (tokens, phrases, prefix*) avec snippets

Admin

bc_refresh

Re-fetch + re-index d'une ou toutes les branches

Admin

bc_cache_status

Disk usage + branches indexees

Admin

bc_prune_cache

Suppression selective de worktrees

Note : apres une mise a jour vers une version qui introduit l'index FTS5, les branches deja indexees ne sont pas automatiquement re-indexees. Lancez bc_refresh sur les branches que vous voulez voir apparaitre dans bc_search_fts.

Installation

Voie 1 — via NPM (recommande)

Claude Code :

powershell claude mcp add bc-source-mcp -s user -- npx -y bc-source-mcp

Claude Desktop — editez %APPDATA%\Claude\claude_desktop_config.json :

json { "mcpServers": { "bc-source-mcp": { "command": "npx", "args": ["-y", "bc-source-mcp"] } } }

Le binaire bc-source-mcp est expose par le bin de package.json. npx -y recupere la derniere version a chaque demarrage (cache npm); pour epingler une version, utilisez bc-source-mcp@0.1.0.

Voie 2 — clone GitHub (pour contribuer)

powershell git clone https://github.com/glachana/bc-source-mcp.git cd bc-source-mcp npm install npm run build .\scripts\setup.ps1 -ClaudeCode -ClaudeDesktop

Guide utilisateur complet : INSTALL.md.

Configuration

Variables d'environnement utilisables (toutes optionnelles) :

Variable

Defaut

Description

BC_SOURCE_CACHE_DIR

~/.bc-source-mcp/

Cache local (partial clone + worktrees + SQLite). ~2-5 Go selon les versions indexees.

BC_SOURCE_REPO_URL

StefanMaron/MSDyn365BC.Sandbox.Code.History

URL du repo upstream -- override si vous avez un fork

BC_SOURCE_LOG_LEVEL

info

trace/debug/info/warn/error/fatal

Pour les passer a Claude Code : ajoutez -e KEY=VALUE a la commande claude mcp add. Pour Claude Desktop : ajoutez une cle env a l'entree mcpServers.

Maintenance

Il y a deux choses distinctes a garder a jour :

MAJ du serveur

  • Installation NPM : npm install -g bc-source-mcp@latest (ou retirer le cache npx)

  • Installation depuis Git : .\scripts\update.ps1

Ensuite redemarrez Claude Code/Desktop.

MAJ des donnees BC en cache (sources upstream)

Independamment du code du serveur, vous voulez parfois rafraichir les sources BC en cache pour recuperer les derniers commits upstream (par ex. quand Microsoft publie un nouveau cumulative update).

Dans votre client MCP, demandez a Claude :

Avec bc_refresh, rafraichis l'index de la branche w1-26.

Ou pour toutes les branches indexees :

Avec bc_refresh sans parametre, rafraichis toutes les branches.

Le tool bc_cache_status vous donne a tout moment la taille disque + la liste des branches en cache.

Developpement

powershell npm install npm run build # tsc -> dist/ npm test # vitest npm run inspector # MCP Inspector pour tester en interactif

Tests : 54 unit tests sur les parsers AL (object header, events, procedures) et le branch resolver.

Architecture

Le serveur maintient un cache local sous ~/.bc-source-mcp/ :

~/.bc-source-mcp/ +-- repo/ Partial clone Git unique (--filter=blob:none, ~1,6 Go) +-- worktrees/<branch>/ Worktrees Git checkout-es a la demande +-- index.db SQLite : branches, apps, objects, event_publishers

A la premiere requete sur une branche (ex. w1-26) :

  1. git fetch origin <branch> (blobs telecharges a la demande grace au partial clone)

  2. git worktree add du checkout complet de la branche

  3. Walk recursif de tous les *.al -> parsing header + events -> insert SQLite

  4. Lookups ulterieurs : tout en RAM/SQLite, <100 ms

Branches du repo upstream : 545 (47 localisations x 7 versions, avec ou sans vNext). Sur w1-26 : ~15 000 objets AL et ~22 000 event publishers indexes en ~10 s.

Stack

Contribuer

Issues et PR bienvenues sur https://github.com/glachana/bc-source-mcp.

Le projet utilise Conventional Commits + release-please pour le versioning et la publication npm automatiques. Lire CONTRIBUTING.md avant d'ouvrir une PR.

Roadmap d'ameliorations en cours : IMPROVEMENTS.md.

Licence

MIT (c) 2026 Gabriel Lachana.

Available Tools

14 tools
bc_cache_statusCache disk usage and indexed branchesA
Read-onlyIdempotent

Reports the total disk usage of the bc-source-mcp cache, the number of indexed branches, their object counts, and last fetch/index dates.

Inputs: no named parameters. Returns: cache_root, repo_size_mb, worktrees_size_mb, total_size_mb, +1 more

bc_find_object_across_branchesFind an object across indexed branchesA
Read-onlyIdempotent

Searches for an AL object (by type and exact name) across all branches that have already been indexed in this MCP instance. Use this to compare presence/path of an object across versions or localizations. Does not trigger indexing — call bc_list_apps on a branch first if you want to include it.

Inputs: type (required), name (required), branches. Returns: type, name, total, results

bc_get_event_publishersGet event publishers of an AL objectA
Read-onlyIdempotent

Lists all event publishers ([IntegrationEvent], [BusinessEvent], [InternalEvent]) defined inside a specific AL object. Returns the event name, kind, full procedure signature, attribute, and source line. Useful for finding events to subscribe to.

Inputs: branch (required), source_type (required), source_name (required). Returns: branch, source_type, source_name, total, +1 more

bc_get_objectGet the source of an AL objectA
Read-onlyIdempotent

Returns the AL source of a specific object (table, page, codeunit, report, enum, query, xmlport, or any extension). Identifies the object by branch + type + name (case-insensitive on type, exact on name). Triggers indexing on first use of a branch. Use line_start/line_end to fetch only a slice (1-indexed, inclusive) — useful for large objects (~100k lines). Use include_source=false to skip the source and get only metadata (size, total_lines).

Inputs: branch (required), type (required), name (required), line_start, +2 more. Returns: branch, type, id, name, +8 more

bc_get_procedureGet a specific procedure from an AL objectA
Read-onlyIdempotent

Returns the signature, body, attributes, and modifier of a named procedure within an AL object. Useful when you only need a single procedure rather than the full object source.

Inputs: branch (required), object_type (required), object_name (required), procedure_name (required). Returns: branch, object_type, object_name, path, +1 more

bc_list_appsList apps in a branchA
Read-onlyIdempotent

Lists top-level application folders in a given branch (e.g. "Base Application", "System Application", "Business Foundation"). If the branch has not been indexed yet, this triggers a first-time fetch + sparse-checkout + indexing (can take 1-5 minutes the first time).

Inputs: branch (required). Returns: branch, apps

bc_list_branchesList branchesA
Read-onlyIdempotent

Lists all branches available in the upstream BC sources repository (Stefan Maron mirror). Each branch corresponds to a (localization, version) pair, e.g. "w1-26", "fr-27-vNext". By default, meta/internal branches (main, base, core, serena) are filtered out. Set include_meta=true to include them.

Inputs: include_meta. Returns: total, branches

bc_list_localizationsList supported BC localizationsA
Read-onlyIdempotent

Lists the country/region codes available as branches in the upstream repository, with their human-readable names. "w1" is the worldwide base.

Inputs: no named parameters. Returns: localizations

bc_list_objectsList objects in a branchA
Read-onlyIdempotent

Lists AL objects in a branch, with optional filters by type, app, and name pattern. Use "*" as wildcard in name_pattern (translated to SQL LIKE %). Triggers indexing on first use of a branch.

Inputs: branch (required), type, app, name_pattern, +2 more. Returns: branch, total, offset, limit, +1 more

bc_list_versionsList supported BC versionsA
Read-onlyIdempotent

Lists the Business Central major versions for which sources are available in this MCP. Set include_vnext=true to also list the preview/-vNext variants.

Inputs: include_vnext. Returns: versions

bc_prune_cachePrune cached worktrees and index entriesA

Removes worktrees and index entries for branches not matching the keep filters. Pass keep_branches (explicit allowlist) or keep_versions/keep_localizations to retain only certain version/loc combinations. The partial-clone Git repo itself is never deleted.

Inputs: keep_branches, keep_versions, keep_localizations, dry_run. Returns: removed, kept, freed_mb, dry_run

bc_refreshRefresh branch indexA
Idempotent

Re-fetches a branch from upstream and re-indexes it. If branch is omitted, refreshes every already-indexed branch sequentially.

Inputs: branch. Returns: refreshed, errors

bc_search_codeFull-text search in BC AL source codeA
Read-onlyIdempotent

Searches AL source code in a branch using regular expressions (ripgrep). Returns matching lines with optional context. Filter by object_type (file suffix, e.g. "table" → "*.Table.al") or by app (top-level folder). Triggers indexing on first use of a branch (for the worktree).

Inputs: branch (required), pattern (required), object_type, app, +3 more. Returns: branch, pattern, total_matches, matches, +1 more

bc_search_ftsFull-text search via FTS5 (cross-branch capable)A
Read-onlyIdempotent

Token-based full-text search across indexed AL sources using SQLite FTS5. Faster than bc_search_code (no disk re-scan) and supports cross-branch queries. Use FTS5 syntax: bare terms ("Customer Posting"), phrases (""Sales Header""), boolean (term1 AND term2), prefixes (Cust*). Returns ranked snippets with matched tokens wrapped in <<...>>. For regex patterns, prefer bc_search_code.

Inputs: query (required), branches, app, object_type, +2 more. Returns: query, total, offset, limit, +1 more

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.4/5.0

    Scored across 14 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose. bc_search_code (regex) and bc_search_fts (token-based) are differentiated, as are bc_find_object_across_branches (cross-branch) and bc_list_objects (single-branch listing). No overlapping or ambiguous tools.

    Naming Consistency5/5

    All tools use the consistent prefix 'bc_', followed by a verb like list, get, search, find, prune, refresh. The pattern is uniform (verb_noun or verb_preposition_noun), with bc_cache_status being the only slight deviation but still clear.

    Tool Count5/5

    14 tools is well-scoped for the domain of Business Central source code management. Each tool addresses a specific need (listing, searching, fetching, cache management) without unnecessary redundancy or overload.

    Completeness4/5

    The tool surface covers read-only operations comprehensively: listing branches/versions/localizations/objects/apps, fetching source and procedures, searching, and cache management. A minor gap is lack of a direct diff tool between branches, but the core workflow is fully supported.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Exposes Microsoft BCQuality repository (Business Central development best practices) as structured tools for AI agents, enabling rule discovery, search, and application via MCP protocol.
      10
      14 npm
      1
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Model Context Protocol (MCP) server for Microsoft Dynamics 365 Business Central. Provides AI assistants with direct access to Business Central data through properly formatted API v2.0 calls.
      6
      1,639 npm
      10
      MIT