Connecting External AI Clients to the M42 Professional MCP Server
Connecting External AI Clients to the M42 Professional MCP Server
Introduction
The M42 Professional MCP server exposes platform data and actions to AI clients through the Model Context Protocol (MCP). An external AI client, such as Claude Code or an agent built in Microsoft Copilot Studio, connects to the server over OAuth 2.0. After that, the client can query templates and data cards, and create and update data cards, in natural language, without custom integrations or API scripting.
For example, support staff who work on tickets can ask questions in natural language in Microsoft Teams when the agent is built in Microsoft Copilot Studio.
External MCP is in technical preview
External MCP connections, for Claude Code, Microsoft Copilot Studio, and similar OAuth-based MCP clients, are available as a technical preview for early adopters. The connection requires an authentication configuration in Secure Access (previously known as ESA), as described in this guide.
The setup involves three systems: M42 Professional (the MCP server), Secure Access, which is the OAuth 2.0 identity provider based on Keycloak, and the AI client. This guide has three parts. The general setup covers the steps that are the same for every client: the M42 Professional side and the Secure Access side. Each client section then covers the steps for that client, including the registration of the client's callback URL in Secure Access. Troubleshooting, the data policy note, and related resources follow.
This guide covers external clients only. The built-in AI agents of M42 Professional do not need this setup. For the tool reference and the server settings, see MCP Server.
How the connection works
AI client (Claude Code or Microsoft Copilot Studio)
|
| 1. The user signs in through Secure Access (browser window)
v
Secure Access (Keycloak) <-- the client's callback URL is registered here
|
| 2. Secure Access issues an access token
v
M42 Professional MCP server (https://<your-m42pro-tenant>/itsm/mcp)
|
| 3. M42 Professional checks the token and identifies the user
v
MCP tools: list_templates, describe_template, list_datacards,
create_datacard, update_datacard
|
| 4. Results are returned to the AI client
v
AI client answers the user
Invalid parameter: redirect_uri error.Prerequisites
| What | Where to get it |
|---|---|
| M42 Professional instance with MCP support | M42 Professional 2026.2 or later. The MCP endpoint is https://<your-m42pro-tenant>/itsm/mcp
|
| Secure Access administration access, with a suitable realm configured | The Secure Access administration console at https://<your-m42pro-tenant>/auth
|
| Microsoft Copilot Studio environment (Copilot Studio only) | Microsoft Power Platform with a Copilot Studio license |
General setup (all clients)
Complete these three steps once for the tenant and the client you connect. The client-specific sections below refer back to them.
Step 1 — Create the MCP client scopes and the audience mapper
In the Keycloak admin console of Secure Access, create three client scopes with these names: mcp:read, mcp:create, and mcp:update. M42 Professional checks the scope names in the access token, so they must match exactly.
| Client scope | Allows |
|---|---|
mcp:read |
The tools list_templates, describe_template, and list_datacards. |
mcp:create |
The tool create_datacard. This scope also grants read access. |
mcp:update |
The tool update_datacard. This scope also grants read access. |
Create a mapper of audience type mcp-audience and add it to the scopes. The mapper adds the MCP server URL, https://<your-m42pro-tenant>/itsm/mcp, to the audience of the access token. M42 Professional accepts only tokens that carry this audience.
M42 Professional accepts a token that carries at least one of the three scopes. When you add the scopes to the client, set the type of each scope to Default, so that every token of the client carries that access. The scopes then do not depend on what the client requests.
Step 2 — Create the OAuth client
In the Keycloak admin console, go to Clients and select Create client. Use these settings:
| Field | Value |
|---|---|
| Client type | OpenID Connect |
| Client ID | A name you choose, for example m42pro-mcp-copilot. You enter this value again in the settings of the client (client-specific). |
| Client authentication |
On (confidential client). This is needed so that the user signs in to M42 Professional with their own credentials. |
| Authorization | Off |
| Standard flow | Enabled |
| Direct access grants | Off |
| Implicit flow | Off |
| Service account roles | Off |
| OIDC CIBA Grant | Off |
After you create the client:
- Open the Credentials tab and note the Client secret. You enter it in the client's settings (client-specific).
- Open the Client scopes tab and add
mcp:read,mcp:create, andmcp:updateto the client with the type Default. - Leave Valid redirect URIs empty for now. You add the callback URL of the client in its own section.
Step 3 — Configure the M42 Professional settings (optional but recommended)
The MCP server is enabled by default. Adjust the settings in the M42 Professional Admin UI under System Settings, in the MCP server property group.
Setting names, defaults, and availability can change between M42 Professional versions. The values on this page apply to M42 Professional 2026.2.
Access control
| Property | Default | Purpose |
|---|---|---|
mcp.enabled |
true |
Turns the MCP endpoint on or off. Set it to false to disable the endpoint without a restart. Requests to the endpoint then receive a 503 response. |
mcp.concurrency.limit |
6 |
Maximum number of MCP tool calls that run at the same time. This protects the shared database and thread pools. Calls beyond the limit are rejected immediately with a "server busy" error. |
mcp.oauth.additional.scopes.supported |
offline_access |
Additional OAuth scopes that the MCP server advertises to clients, next to the MCP scopes. The default exists because Claude Code always requests offline_access. M42 Professional does not enforce these scopes. Only Secure Access acts on them. |
Content filtering
effieai and workflow modules, and a preset list of notification and self-service classes are excluded. Classes that end in local_user_creation are excluded as well. You can exclude more:| Property | Default | What it excludes |
|---|---|---|
mcp.excluded.module.codes |
effieai,workflow |
Entire modules, in addition to the system module. Wildcards (* and ?) are supported. |
mcp.excluded.template.codes |
Empty | Specific template codes. Wildcards are supported. |
mcp.excluded.class.codes |
A preset list of notification and self-service classes | Classes whose attributes are hidden. Matching is case sensitive. Wildcards are supported. |
mcp.excluded.attribute.codes |
Empty | Specific attribute codes. Wildcards are supported. |
Performance
| Property | Default | Purpose |
|---|---|---|
mcp.datacard.list.search.timeout |
30 seconds |
Time limit for the database query behind list_datacards. The value 0 means no time limit. |
Client-specific setup: Claude Code
Complete the general setup first. Then follow these steps to connect Claude Code.
Technical preview
Connecting Claude Code to the M42 Professional MCP server is a technical preview. Setup steps, settings, and behavior can change between versions.
- The user must exist in M42 Professional. M42 Professional resolves the username in the access token to a user.
- The tenant's Apache must allow
/itsm/mcpthrough. Until it does, requests do not reach M42 Professional.
Step 1 — Register the callback URL in Secure Access
In the Keycloak admin console of Secure Access, go to Clients, select the client you created in general step 2, and open Settings.
- In Valid redirect URIs, add
http://localhost:8080/callback. Claude Code uses a local callback URL of the formhttp://localhost:PORT/callbackand picks a random port unless you fix it. The next step fixes the port to 8080, so that it matches this entry. You can use another free port, as long as the redirect URI and the command use the same one. - In Web origins, add
+. - Save.
The URL must be an exact match. Keycloak is case-sensitive and does not tolerate trailing slash differences or any other variation.
Step 2 — Add the server to Claude Code
Run this command in a terminal, and replace the placeholders with your values. Use the client ID from general step 2.
claude mcp add --transport http --client-id <your-client-id> --client-secret --callback-port 8080 <your-custom-mcp-name> https://<your-m42pro-tenant>/itsm/mcpClaude Code asks for the client secret and hides what you type. Enter the client secret from general step 2. You can set the client secret only when you add the server. To change it, remove the server with claude mcp remove <your-custom-mcp-name> and add it again.
The options of the claude mcp add command are described in the Claude Code documentation.
Step 3 — Sign in and consent
In Claude Code, run /mcp and select the server to start the sign-in. Claude Code opens a browser window for the Secure Access sign-in and consent screen. Sign in with the M42 Professional user account. M42 Professional advertises the read, create, and update scopes together, so a sign-in can grant all three. A write-capable sign-in is still limited to the permissions of that user.
Client-specific setup: Microsoft Copilot Studio
Complete the general setup first. Then follow these steps to add the server to a Copilot Studio agent.
Technical preview
Connecting Microsoft Copilot Studio to the M42 Professional MCP server is a technical preview. Setup steps, settings, and behavior can change between versions.
Step 1 — Add the MCP server in Copilot Studio
Follow the official Microsoft guide for the Copilot Studio UI steps: Connect your agent to an existing MCP server — Microsoft LearnUse Option 1: MCP onboarding wizard (recommended). The tables below tell you which values to enter for M42 Professional.
Enter these server details:
| Copilot Studio field | Value for M42 Professional |
|---|---|
| Server name | For example M42 Professional
|
| Server description | For example Provides tools for querying, creating, and updating M42 Professional service management data cards and templates
|
| Server URL | https://<your-m42pro-tenant>/itsm/mcp |
| Authentication type | OAuth 2.0 |
| OAuth 2.0 type | Manual |
Enter these OAuth 2.0 manual settings:
| Copilot Studio field | Value |
|---|---|
| Client ID | The client ID you set in general step 2 |
| Client secret | The client secret from general step 2 |
| Authorization URL | https://<your-m42pro-tenant>/auth/realms/<realm>/protocol/openid-connect/auth |
| Token URL | https://<your-m42pro-tenant>/auth/realms/<realm>/protocol/openid-connect/token |
| Refresh URL | https://<your-m42pro-tenant>/auth/realms/<realm>/protocol/openid-connect/token |
| Scopes |
mcp:read mcp:create mcp:update. Leave out mcp:create or mcp:update if the agent must not create or update data cards. M42 Professional rejects tokens that carry none of mcp:read, mcp:create, or mcp:update. |
Do not enter or override the Redirect URL or Callback URL field manually. Copilot Studio generates this value. Overriding it causes a redirect URI mismatch.
After you select Create, Copilot Studio displays a callback URL (also called the redirect URL). Copy this URL for the next step.
Step 2 — Register the callback URL in Secure Access
If you skip this step, or do it incorrectly, the sign-in fails withInvalid parameter: redirect_uri.
In the Keycloak admin console of Secure Access, go to Clients, select m42pro-mcp-copilot (or the client ID you chose), and open Settings.
- In Valid redirect URIs, paste the exact callback URL copied from Copilot Studio.
- In Web origins, add
+. - Save.
The URL must be an exact match. Keycloak is case-sensitive and does not tolerate trailing slash differences or any other variation.
Step 3 — Complete the connection in Copilot Studio
Continue in Microsoft Learn: Create a new connection and add the MCP server to your agent
Select Create a new connection. When prompted, sign in with an M42 Professional user account, and then select Add to agent.
The agent then has access to the tools of the M42 Professional MCP server: list_templates, describe_template, list_datacards, create_datacard, and update_datacard. The create and update tools work only when the sign-in grants the matching write scope. For what each tool does, see MCP Server.
Troubleshooting
General (all clients)
| Symptom | Cause | Fix |
|---|---|---|
401 Unauthorized on tool calls |
The OAuth token is invalid or expired | Check the client ID, client secret, and token URL in the client settings. Then sign in again. |
| The agent sees no tools | The MCP handshake failed | Open https://<your-m42pro-tenant>/itsm/mcp in a browser. The endpoint answers with a 401 Unauthorized response when it is reachable, because the request has no access token. If you see a sign-in page or a 404 instead, the request does not reach the M42 Professional MCP server. Check the Apache setting for /itsm/mcp and the setting mcp.enabled. |
503 MCP server disabled |
mcp.enabled is set to false |
Set mcp.enabled to true in the System Settings |
503 MCP server not available |
The MCP server is not available | Check the application logs for the log type M42_INTELLIGENCE for the reason. |
| The "server busy" error on tool calls | More tool calls than mcp.concurrency.limit are running at the same time |
Retry the call after a short wait. If the load is expected, increase mcp.concurrency.limit. |
| The agent returns garbled characters | Character encoding mismatch in the request | M42 Professional reads request bodies as UTF-8. Check that the client encodes the request as UTF-8. |
| Template not found | The template is excluded, or the template code is incorrect | Run list_templates first to confirm the available template codes. |
Claude Code
| Symptom | Cause | Fix |
|---|---|---|
invalid_scope that names offline_access during sign-in |
Claude Code always requests offline_access to get a refresh token. The authorization request is rejected if the client does not allow this scope. |
Make sure the client in Secure Access allows the offline_access scope next to the MCP scopes. M42 Professional advertises this scope through the setting mcp.oauth.additional.scopes.supported, which defaults to offline_access. |
| Sign-in succeeds, but every call returns 401 | The token has no preferred_username claim. This happens when the client requests an explicit scope list, which drops the realm default scopes. Those scopes normally carry the username. |
Add a username mapper directly to the MCP scopes in Secure Access. |
Streamable HTTP error: Unexpected content type: text/html;charset=utf-8 |
The request reached a sign-in page instead of the MCP server | Make sure the tenant's Apache allows /itsm/mcp (see Before you begin). |
Microsoft Copilot Studio
| Symptom | Cause | Fix |
|---|---|---|
Invalid parameter: redirect_uri |
Secure Access does not have the Copilot Studio callback URL | Copy the exact callback URL from Copilot Studio into Valid redirect URIs in Secure Access (Step 2 of the Copilot Studio section). |
Data policy note
Access to MCP servers in Copilot Studio goes through Power Platform connectors. If your organization has a data loss prevention (DLP) policy that restricts connectors, it also applies to the M42 Professional MCP connection.
Related resources
| Resource | Link |
|---|---|
| MCP Server: tools, scalability, and settings reference | MCP Server |
| Microsoft: Connect agent to existing MCP server | https://learn.microsoft.com/en-us/microsoft-copilot-studio/mcp-add-existing-server-to-agent |
| Microsoft: MCP overview for Copilot Studio | https://learn.microsoft.com/en-us/microsoft-copilot-studio/mcp-overview |
| Secure Access administration console | https://<your-m42pro-tenant>/auth |
Table of Contents