diff --git a/samples/BcMCPProxy/Models/ConfigOptions.cs b/samples/BcMCPProxy/Models/ConfigOptions.cs index f76f4cf1..36a2b22c 100644 --- a/samples/BcMCPProxy/Models/ConfigOptions.cs +++ b/samples/BcMCPProxy/Models/ConfigOptions.cs @@ -16,9 +16,9 @@ public class ConfigOptions public string ClientId { get; set; } = "3acde393-18cc-4b12-803c-4c85fa111c21"; - public string TokenScope { get; set; } = "https://api.businesscentral.dynamics.com/.default"; + public string TokenScope { get; set; } = "https://mcp.businesscentral.dynamics.com/.default"; - public string Url { get; set; } = "https://api.businesscentral.dynamics.com"; + public string Url { get; set; } = "https://mcp.businesscentral.dynamics.com"; public string Environment { get; set; } = "Production"; diff --git a/samples/BcMCPProxy/Runtime/MCPServerProxy.cs b/samples/BcMCPProxy/Runtime/MCPServerProxy.cs index cfd2cf00..410dead6 100644 --- a/samples/BcMCPProxy/Runtime/MCPServerProxy.cs +++ b/samples/BcMCPProxy/Runtime/MCPServerProxy.cs @@ -43,11 +43,13 @@ public async Task RunAsync() var transportOptions = new HttpClientTransportOptions { Name = "Test Server", - Endpoint = new Uri(this.configOptions.Url.TrimEnd('/') + "/v2.0/" + this.configOptions.Environment + "/mcp"), + Endpoint = new Uri(this.configOptions.Url.TrimEnd('/')), TransportMode = HttpTransportMode.StreamableHttp, AdditionalHeaders = new Dictionary { - { "Company", HttpUtility.UrlDecode(this.configOptions.Company) }, + { "TenantId", this.configOptions.TenantId }, + { "EnvironmentName", this.configOptions.Environment }, + { "Company", HttpUtility.UrlDecode(this.configOptions.Company) }, { "X-Client-Application", "BcMCPProxy" } } }; diff --git a/samples/BcMCPProxyPython/README.md b/samples/BcMCPProxyPython/README.md index 8dbeaac8..e716266c 100644 --- a/samples/BcMCPProxyPython/README.md +++ b/samples/BcMCPProxyPython/README.md @@ -94,8 +94,8 @@ Example interactions: | Company | `--Company` | `BC_COMPANY` | Business Central company name | Yes | | Configuration Name | `--ConfigurationName` | `BC_CONFIGURATION_NAME` | Name of the Business Central configuration | No | | Custom Auth Header | `--CustomAuthHeader` | `BC_CUSTOM_AUTH_HEADER` | Pre-issued bearer token (skips device flow) | No | -| Base URL | `--BaseUrl` | `BC_BASE_URL` | Base API URL (default: `https://api.businesscentral.dynamics.com`) | No | -| Token Scope | `--TokenScope` | `BC_TOKEN_SCOPE` | OAuth scope (default: `https://api.businesscentral.dynamics.com/.default`) | No | +| Base URL | `--BaseUrl` | `BC_BASE_URL` | MCP server URL (default: `https://mcp.businesscentral.dynamics.com`) | No | +| Token Scope | `--TokenScope` | `BC_TOKEN_SCOPE` | OAuth scope (default: `https://mcp.businesscentral.dynamics.com/.default`) | No | | Log Level | `--LogLevel` | `BC_LOG_LEVEL` | Logging level (default: `INFO`) | No | | Debug | `--Debug` | `BC_DEBUG=1` | Enable verbose logging | No | diff --git a/samples/BcMCPProxyPython/bc_mcp_proxy/config.py b/samples/BcMCPProxyPython/bc_mcp_proxy/config.py index 2ff3c6f4..f9f8998a 100644 --- a/samples/BcMCPProxyPython/bc_mcp_proxy/config.py +++ b/samples/BcMCPProxyPython/bc_mcp_proxy/config.py @@ -14,8 +14,8 @@ class ProxyConfig: tenant_id: Optional[str] = None client_id: Optional[str] = None - token_scope: str = "https://api.businesscentral.dynamics.com/.default" - base_url: str = "https://api.businesscentral.dynamics.com" + token_scope: str = "https://mcp.businesscentral.dynamics.com/.default" + base_url: str = "https://mcp.businesscentral.dynamics.com" environment: str = "Production" company: Optional[str] = None configuration_name: Optional[str] = None diff --git a/samples/BcMCPProxyPython/bc_mcp_proxy/proxy.py b/samples/BcMCPProxyPython/bc_mcp_proxy/proxy.py index 23c4aa50..df414468 100644 --- a/samples/BcMCPProxyPython/bc_mcp_proxy/proxy.py +++ b/samples/BcMCPProxyPython/bc_mcp_proxy/proxy.py @@ -91,6 +91,10 @@ def _build_transport_headers(config: ProxyConfig) -> dict[str, str]: headers: dict[str, str] = { "X-Client-Application": config.server_name, } + if config.tenant_id: + headers["TenantId"] = config.tenant_id + if config.environment: + headers["EnvironmentName"] = config.environment if config.company: headers["Company"] = unquote(config.company) if config.configuration_name: @@ -99,8 +103,7 @@ def _build_transport_headers(config: ProxyConfig) -> dict[str, str]: def _build_endpoint_url(config: ProxyConfig) -> str: - base = config.base_url.rstrip("/") - return f"{base}/v2.0/{config.environment}/mcp" + return config.base_url.rstrip("/") def run_sync(config: ProxyConfig) -> None: diff --git a/samples/BcMCPProxyPython/pyproject.toml b/samples/BcMCPProxyPython/pyproject.toml index 17cd0b5e..01222049 100644 --- a/samples/BcMCPProxyPython/pyproject.toml +++ b/samples/BcMCPProxyPython/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "bc-mcp-proxy" -version = "0.1.2" +version = "0.1.4" description = "Python-based MCP stdio proxy for Microsoft Dynamics 365 Business Central" readme = "README.md" requires-python = ">=3.10"