Exposing the DB24 MCP server through IIS
The DB24 MCP server runs as the Windows service DB24.Mcp and listens on http://localhost:52441. To make it reachable from other machines (for example AI clients such as Claude), you put an IIS site in front of it. IIS receives the requests, can terminate TLS, and forwards everything to the service.
This page covers:
- Setting up the IIS MCP site
- Adding TLS (HTTPS)
- Opening the firewall
1. Set up the IIS MCP site
Download Install-Db24McpSite.ps1 to the server and run it:
# Default: host name = this server's name, port 52442, firewall rule created .\Install-Db24McpSite.ps1
If Windows blocks the downloaded file, unblock it first:
Unblock-File .\Install-Db24McpSite.ps1
Parameters
| Parameter | Default | Description |
|---|---|---|
-HostName | Server name ($env:COMPUTERNAME) | Host name the site answers to. Clients must use exactly this name in the URL. Use '' to accept any host name. |
-Port | 52442 | TCP port of the site. |
-AddFirewallRule | $true | Creates an inbound Windows Firewall rule for the port. Use -AddFirewallRule $false to skip. |
-CertificateThumbprint | (none) | Binds the site with HTTPS using this certificate. See section 2. |
-FirewallRemoteAddress | Any | Limits which addresses may connect, e.g. '10.0.0.0/8','203.0.113.10'. |
-BackendUrl | http://localhost:52441 | Where the DB24.Mcp service listens. |
-Force | off | Removes and recreates the site if it already exists. Use it to change settings. |
Examples
# Public DNS name, own port .\Install-Db24McpSite.ps1 -HostName mcp.contoso.com -Port 52442 # Change an existing installation (recreates the site) .\Install-Db24McpSite.ps1 -HostName mcp.contoso.com -Force # Manage the firewall yourself .\Install-Db24McpSite.ps1 -AddFirewallRule $false
What the script does
- Checks that IIS, URL Rewrite and ARR are installed and that DB24.Mcp is reachable.
- Turns on the ARR proxy at server level, sets the response buffer to
0, and raises the proxy timeout to at least 5 minutes. MCP streams responses, so buffering and short timeouts break it. - Creates
C:\inetpub\wwwroot\db24-mcp\web.configwith the reverse-proxy rule. - Creates the application pool
db24-mcp(No Managed Code, no idle timeout). - Creates and starts the IIS site
db24-mcpwith the bindinghttp://<HostName>:<Port>, orhttps://when a certificate is given. - Creates the firewall rule
DB24-MCP-TCP-<Port>(unless-AddFirewallRule $false).
Manual setup (without the script)
-
In IIS Manager, select the server node, then Application Request Routing Cache → Server Proxy Settings. Check Enable proxy, set Response buffer threshold to
0and Time-out to300seconds, then click Apply. -
Create the folder
C:\inetpub\wwwroot\db24-mcpwith thisweb.config:<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="DB24 MCP reverse proxy" stopProcessing="true"> <match url="(.*)" /> <action type="Rewrite" url="http://localhost:52441/{R:1}" /> </rule> </rules> </rewrite> <urlCompression doStaticCompression="false" doDynamicCompression="false" /> </system.webServer> </configuration> -
Add an application pool named
db24-mcpwith .NET CLR version = No Managed Code. -
Add a website named
db24-mcpthat uses this folder and app pool, with binding typehttp, port52442and the server's host name.
Verify
From another machine:
Test-NetConnection <HostName> -Port 52442 Invoke-WebRequest http://<HostName>:52442/ -UseBasicParsing
Any HTTP response (even a 4xx) from the DB24 MCP server means the proxy works.
2. Add TLS (HTTPS)
Use HTTPS whenever the MCP server is reachable from outside your internal network. Most MCP clients require it.
2.1 Get a certificate
The certificate's subject or SAN must contain the exact host name clients use (the -HostName value). Pick one:
| Option | When to use |
|---|---|
| Certificate from your internal CA / IT department | Clients are inside your domain |
| Public certificate (commercial CA, or Let's Encrypt via win-acme) | Clients connect over the internet, e.g. cloud AI services |
| Self-signed | Testing only. Clients will not trust it. |
Import a .pfx into the computer's certificate store:
Import-PfxCertificate -FilePath C:\certs\mcp.contoso.com.pfx ` -CertStoreLocation Cert:\LocalMachine\My ` -Password (Read-Host -AsSecureString "PFX password")
Find the thumbprint:
Get-ChildItem Cert:\LocalMachine\My | Where-Object { $_.HasPrivateKey -and $_.NotAfter -gt (Get-Date) } | Format-Table Thumbprint, Subject, NotAfter, @{n='DnsNames';e={$_.DnsNameList -join ', '}}
Testing only: create a self-signed certificate:
New-SelfSignedCertificate -DnsName mcp.contoso.com -CertStoreLocation Cert:\LocalMachine\My
2.2 Bind the certificate
Re-run the script with the thumbprint. The site then uses HTTPS on the same port, and the HTTP binding is replaced:
.\Install-Db24McpSite.ps1 -HostName mcp.contoso.com -Port 52442 ` -CertificateThumbprint '<THUMBPRINT>' -Force
The script checks that the certificate exists, has a private key and hasn't expired, and warns if the host name isn't in the certificate. With a host name, the binding uses SNI.
Manual alternative: in IIS Manager, select the site db24-mcp, then Bindings… → Add. Set Type https, port 52442, host name mcp.contoso.com, check Require Server Name Indication, select the certificate, and remove the http binding.
2.3 Renewal
IIS binds the certificate by thumbprint. When you renew it:
- win-acme updates the IIS binding automatically.
- Manual renewal: import the new certificate, then re-run the script with the new thumbprint and
-Force, or change the binding in IIS Manager.
Verify
Invoke-WebRequest https://mcp.contoso.com:52442/ -UseBasicParsing
A certificate error means the name or trust chain doesn't match. Check that the client uses the host name from the certificate, not the IP address.
3. Open the firewall
By default the script creates this inbound rule:
| Name | Protocol / port | Profiles | Remote addresses |
|---|---|---|---|
DB24-MCP-TCP-<Port> | TCP 52442 | All | Any (or -FirewallRemoteAddress) |
Restrict access if you know where clients connect from:
.\Install-Db24McpSite.ps1 -FirewallRemoteAddress '10.0.0.0/8','203.0.113.10' -Force
Manual rule (if you ran the script with -AddFirewallRule $false):
New-NetFirewallRule -Name DB24-MCP-TCP-52442 -DisplayName "DB24 MCP (TCP 52442)" ` -Direction Inbound -Protocol TCP -LocalPort 52442 -Action Allow -Profile Any
Check the rule:
Get-NetFirewallRule -Name DB24-MCP-TCP-* | Format-Table Name, Enabled, Profile
⚠️ Only open the IIS port (52442). Do not open port 52441: that is the DB24.Mcp service itself, unencrypted and without IIS in front. It should only be reachable from the server.
Also remember any firewall outside the server: a network firewall, a cloud security group (Azure NSG, AWS security group), or port forwarding on the router. TCP 52442 must be allowed there too.
Troubleshooting
| Symptom | Cause / fix |
|---|---|
| HTTP 404 or the wrong site answers | The host name in the URL doesn't match the site binding. Use the -HostName value, or reinstall with -HostName ''. |
| HTTP 500.19 | URL Rewrite isn't installed, or the app pool can't read web.config. Re-run the script. |
| HTTP 502.3 / 502.4 | IIS can't reach DB24.Mcp. Check Get-Service DB24.Mcp and Test-NetConnection localhost -Port 52441. |
HTTP 503 with Server: Kestrel | The request reached the DB24.Mcp service, which answered 503. Check the service's configuration and logs. |
| HTTP 503 from IIS | The db24-mcp app pool is stopped. Start it in IIS Manager or run Start-WebAppPool db24-mcp. |
| Streaming responses hang or arrive all at once | ARR response buffering. Make sure Server Proxy Settings → Response buffer threshold is 0 (the script sets this). |
| Timeout from another machine, but it works locally | Firewall. See section 3, including network and cloud firewalls. |
| Certificate warning | The certificate doesn't contain the host name, or the client doesn't trust the CA. |
Uninstall
Remove-Website db24-mcp Remove-WebAppPool db24-mcp Get-NetFirewallRule -Name DB24-MCP-TCP-* | Remove-NetFirewallRule Remove-Item C:\inetpub\wwwroot\db24-mcp -Recurse
