bc-mcp-proxy-daemon
Proxy MCP (Model Context Protocol) para Microsoft Dynamics 365 Business Central con autenticación OAuth2 Client Credentials (service principal / daemon).
Actúa como puente entre clientes MCP stdio (como Claude Code) y el endpoint MCP de Business Central, gestionando automáticamente la obtención y renovación de tokens OAuth2 mediante MSAL.
Requisitos
- Python >= 3.11
- Un App Registration en Azure AD con permisos para Business Central
- Credenciales:
tenant_id,client_id,client_secret
Instalación
pip install bc-mcp-proxy-daemon
Desde el código fuente:
git clone git@github.com:BlackCoronel/bc-mcp-proxy-daemon.git
cd bc-mcp-proxy-daemon
pip install -e .
Configuración
Todos los parámetros se pueden configurar por argumentos CLI o variables de entorno. Los argumentos CLI tienen prioridad sobre las variables de entorno.
Parámetros obligatorios
| CLI | Variable de entorno | Descripción |
|---|---|---|
--TenantId |
BC_TENANT_ID |
Azure AD tenant ID |
--ClientId |
BC_CLIENT_ID |
Application (client) ID del App Registration |
--ClientSecret |
BC_CLIENT_SECRET |
Client secret del App Registration |
Parámetros opcionales
| CLI | Variable de entorno | Default | Descripción |
|---|---|---|---|
--Company |
BC_COMPANY |
— | Nombre de la empresa en BC |
--Environment |
BC_ENVIRONMENT |
Production |
Entorno de BC (Production, Sandbox, etc.) |
--ConfigurationName |
BC_CONFIGURATION_NAME |
— | Nombre de configuración MCP en BC |
--BaseUrl |
BC_BASE_URL |
https://api.businesscentral.dynamics.com |
URL base de la API |
--TokenScope |
BC_TOKEN_SCOPE |
https://api.businesscentral.dynamics.com/.default |
Scope OAuth2 |
--CustomAuthHeader |
BC_CUSTOM_AUTH_HEADER |
— | Token bearer estático (omite OAuth2) |
--ServerName |
BC_SERVER_NAME |
BcMCPProxyPython |
Nombre del servidor MCP local |
--ServerVersion |
BC_SERVER_VERSION |
0.2.0 |
Versión del servidor MCP local |
--Instructions |
BC_INSTRUCTIONS |
— | Instrucciones personalizadas para el servidor MCP |
--HttpTimeoutSeconds |
BC_HTTP_TIMEOUT_SECONDS |
30 |
Timeout para peticiones HTTP |
--SseTimeoutSeconds |
BC_SSE_TIMEOUT_SECONDS |
300 |
Timeout para conexiones SSE |
--LogLevel |
BC_LOG_LEVEL |
INFO |
Nivel de log (DEBUG, INFO, WARNING, ERROR) |
--Debug |
BC_DEBUG |
false |
Activa logs de depuración |
Uso
Ejecución directa
python -m bc_mcp_proxy \
--TenantId "tu-tenant-id" \
--ClientId "tu-client-id" \
--ClientSecret "tu-client-secret" \
--Company "CRONUS España S.A." \
--Environment Production
Con variables de entorno
export BC_TENANT_ID="tu-tenant-id"
export BC_CLIENT_ID="tu-client-id"
export BC_CLIENT_SECRET="tu-client-secret"
export BC_COMPANY="CRONUS España S.A."
export BC_ENVIRONMENT="Production"
python -m bc_mcp_proxy
Integración con Claude Code
Añade el proxy como servidor MCP en tu configuración de Claude Code (.claude/settings.json o similar):
{
"mcpServers": {
"bc": {
"command": "python",
"args": [
"-m", "bc_mcp_proxy",
"--TenantId", "tu-tenant-id",
"--ClientId", "tu-client-id",
"--ClientSecret", "tu-client-secret",
"--Company", "CRONUS España S.A.",
"--Environment", "Production"
]
}
}
}
Arquitectura
Claude Code (stdio) ←→ bc-mcp-proxy (stdio server) ←→ Business Central (Streamable HTTP)
│
MSAL OAuth2
(client credentials)
proxy.py— Servidor MCP stdio que reenvíalist_toolsycall_toolal endpoint remoto de BCauth.py— Proveedores de tokens:MsalClientCredentialsTokenProvider(OAuth2) oStaticTokenProvider(bearer fijo)config.py— Dataclass con toda la configuración del proxy__main__.py— CLI parser y entry point
Dependencias
mcp>= 1.0 — SDK del Model Context Protocolmsal>= 1.28.0 — Microsoft Authentication Libraryhttpx>= 0.27 — Cliente HTTP async
Licencia
MIT
Metadata
Release files for bc-mcp-proxy-daemon 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bc_mcp_proxy_daemon-0.2.0.tar.gz | 8.2 kB | Without provenance | Details for bc_mcp_proxy_daemon-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bc_mcp_proxy_daemon-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for bc_mcp_proxy_daemon-0.2.0-py3-none-any.whl |
Total release size: 17.8 kB
Release files / bc_mcp_proxy_daemon-0.2.0.tar.gz
| Download URL | bc_mcp_proxy_daemon-0.2.0.tar.gz |
|---|---|
| Size | 8.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
07169018b404763d92b6d963a441f3268524826c3c3b286ed51dc84092a21bb1
|
|
BLAKE2b-256 checksum How to use checksums |
e9d0d91b6fc30960626afd05e7a48e8c7478a88bc501a099db881ac5557ebdbf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Release files / bc_mcp_proxy_daemon-0.2.0-py3-none-any.whl
| Download URL | bc_mcp_proxy_daemon-0.2.0-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8e722473d8fa5ec64a2d6838997c9d4612c50c4105477bf813379788a5b9584c
|
|
BLAKE2b-256 checksum How to use checksums |
37462f609e1729cd2222dfe9ddb841ae730f0e5d5d953c9c15e715e3abd59620
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Security for bc-mcp-proxy-daemon 0.2.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.