Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions samples/BcMCPProxy/Models/ConfigOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
6 changes: 4 additions & 2 deletions samples/BcMCPProxy/Runtime/MCPServerProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, string>
{
{ "Company", HttpUtility.UrlDecode(this.configOptions.Company) },
{ "TenantId", this.configOptions.TenantId },
{ "EnvironmentName", this.configOptions.Environment },
{ "Company", HttpUtility.UrlDecode(this.configOptions.Company) },
{ "X-Client-Application", "BcMCPProxy" }
}
};
Expand Down
4 changes: 2 additions & 2 deletions samples/BcMCPProxyPython/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |

Expand Down
4 changes: 2 additions & 2 deletions samples/BcMCPProxyPython/bc_mcp_proxy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions samples/BcMCPProxyPython/bc_mcp_proxy/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion samples/BcMCPProxyPython/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down