> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stackone.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Microsoft 365 Copilot - Make StackOne Available

> Allow your users to connect to work systems with StackOne.

![An IT admin adds StackOne to the Microsoft 365 organization, bringing Linked Accounts from many providers. Each user then connects with their own accounts: an HR manager uses Microsoft 365 Copilot with Workday, Greenhouse and BambooHR, and a sales manager uses Microsoft 365 Copilot with Salesforce, HubSpot and Gmail.](https://mintcdn.com/stackone-60/PxWMQ9IOz3sntjnj/images/ai-platforms/microsoft/microsoft-365-copilot-admin-setup.svg?fit=max\&auto=format\&n=PxWMQ9IOz3sntjnj\&q=85\&s=94adc7701dfddac9e2dae3ce8f507496)

Register StackOne once in Microsoft Agent 365, so a Microsoft 365 admin approves it for the whole tenant and every Copilot Studio agent can use it. Each person signs in to StackOne with their own login and reaches only the systems they've been given access to in StackOne.

> [!NOTE]
>
> Registering your own MCP server in Agent 365 is a Microsoft preview. The steps were tested with Agent 365 CLI 1.1.226. Two steps work around preview gaps: [Find your Agent 365 environment ID](#find-your-agent-365-environment-id) and [Set the refresh URL](#set-the-refresh-url).

## Before you start

In Microsoft 365, you need:

* Someone who can create app registrations and grant admin consent in Microsoft Entra ID.
* An AI Administrator or Global Administrator to approve the server in the Microsoft 365 admin center.
* A Copilot Studio license or the Copilot Studio authors role, to build the agent.
* On the machine you register from: [.NET 8](https://dotnet.microsoft.com/download/dotnet/8.0), the [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) and `python3`.

In StackOne, you need the **Project Admin** role to create an MCP OAuth client, plus:

* A StackOne [project](https://docs.stackone.com/gateway/concepts/organizations-and-projects.md) you are a member of.
* A [connector profile](https://docs.stackone.com/connect/managing-connectors/connector-profiles.md) in the project for each provider the client should reach, with the actions you want exposed enabled.
* (Optional) A [linked account](https://docs.stackone.com/connect/managing-connectors/linking-accounts.md) for each provider. Accounts can also be linked during the consent flow.

## Register StackOne in Agent 365

**1. Install the Agent 365 CLI and sign in**

Install the CLI and sign in to your tenant:

```bash theme={null}
dotnet tool install --global Microsoft.Agents.A365.DevTools.Cli
az login --tenant <your-tenant-id>
```

The first time anyone registers a server in your tenant, a Global Administrator adds the Agent 365 Tools service principal. Without it, registration fails with a consent error:

```bash theme={null}
az ad sp create --id ea9ffc3e-8a23-4a7d-836d-234d7c7565c1
```

**2. Create an MCP OAuth client in StackOne**

1. In StackOne, go to **Project Settings → MCP OAuth Clients** and click **Create OAuth Client**.
2. Set the following:
   * **Name**: for example `Microsoft Agent 365`.
   * **Client type**: `Confidential`.
   * **Redirect URIs**: pick **Microsoft 365 Copilot** under **Common integrations**. The client needs one redirect URI to save, and you replace it after registering.
3. Click **Generate** and store the client ID and secret. The secret is shown only once.

**3. Describe the server**

Save this as `stackone-mcp.json`, with the client ID and secret from the previous step. The server name must start with `ext_` and be at most 20 characters. Agent 365 limits each tool name to 30 characters, and the names must match the ones StackOne serves.

```json stackone-mcp.json theme={null}
{
  "serverName": "ext_StackOne",
  "serverUrl": "https://mcp.stackone.com/mcp",
  "authType": "ExternalOAuth",
  "description": "Search and run actions across your connected SaaS apps via StackOne.",
  "publisherName": "StackOne",
  "tools": [
    { "name": "stackone_list_accounts", "description": "Lists the Linked Accounts this connection can reach." },
    { "name": "stackone_search_actions", "description": "Finds the actions that match a task across the connected systems." },
    { "name": "stackone_execute_action", "description": "Runs an action found with stackone_search_actions." },
    { "name": "stackone_submit_feedback", "description": "Records how well the tools served the task." }
  ],
  "remoteScopes": "mcp offline_access",
  "externalOAuth": {
    "authorizationUrl": "https://idp-api.stackone.com/api/auth/oauth2/authorize",
    "tokenUrl": "https://idp-api.stackone.com/api/auth/oauth2/token",
    "scopes": "mcp offline_access",
    "clientId": "<STACKONE_CLIENT_ID>",
    "clientSecret": "<STACKONE_CLIENT_SECRET>"
  }
}
```

Keep `remoteScopes`. Without it, Agent 365 registers the server with no StackOne sign-in, and every call fails.

**4. Register the server**

Run the command and confirm with `y`:

```bash theme={null}
a365 develop-mcp register-external-mcp-server -f stackone-mcp.json
```

The CLI creates the Entra apps, submits the server for approval and prints a **Redirect URI** for this server, starting `https://global.consent.azure-apim.net/redirect/ext-5f`.

**5. Add the redirect URIs to the StackOne client**

1. In **MCP OAuth Clients**, click **Edit** on your client.
2. Replace the redirect URI with the one the CLI printed.
3. Add a second line with the same URI and `tc-` inserted after `/redirect/`, as in `https://global.consent.azure-apim.net/redirect/tc-ext-5f…`. Agent 365 uses both.
4. Click **Save**.

## Find your Agent 365 environment ID

Agent 365 keeps the connectors it creates in a hidden Power Platform environment, and the refresh URL fix in the next section needs its ID. Microsoft shows the ID only once a server is approved, so on a tenant with no approved server, approve a throwaway test server first. You need the ID once per tenant.

**1. Register a test server**

Save a copy of `stackone-mcp.json` as `stackone-test.json`. Change `serverName` to a new name, such as `ext_StackOneTest`, set `authType` to `NoAuth`, and delete `remoteScopes` and `externalOAuth`. Register it:

```bash theme={null}
a365 develop-mcp register-external-mcp-server -f stackone-test.json
```

**2. Approve the test server**

Review and approve it as in the first two steps of [Approve StackOne](#approve-stackone).

**3. Read the ID from the setup link**

1. In Copilot Studio, add the test server to an agent, as in the **Use the Agent 365 server** tab of [Agent Builder Setup](https://docs.stackone.com/ai-platforms/microsoft/copilot-studio/agent-builder-setup.md#add-stackone-to-the-agent), and save the agent. Use only that one server on the agent.
2. Open **Preview**, turn on **Debug mode** and ask the agent anything.
3. Open the output of the **Initialize Server** tool. It holds a setup link ending in `environmentName=`. The value after it is your environment ID.
4. Remove the test server from the agent. You can then delete it in the admin center under **Agents** > **Tools** > **Registry**.

## Set the refresh URL

StackOne access tokens last an hour. The connector Agent 365 creates for StackOne has no refresh URL, so each person's connection stops working after an hour unless you set one. Do this after registering and before approving, because Agent 365 locks the connector at approval.

**1. Fill in the script**

Save the script below as `set-refresh-url.sh` and fill in your environment ID, server name and StackOne client secret.

**2. Run it**

```bash theme={null}
bash set-refresh-url.sh
```

It prints `Refresh URL set. You can now approve the server.`

> [accordion] set-refresh-url.sh
>
> ```bash set-refresh-url.sh theme={null}
> #!/usr/bin/env bash
> # Sets the refresh URL on the connector Agent 365 creates for StackOne.
> # Run it AFTER registering and BEFORE an admin approves the server.
> set -euo pipefail
>
> ENV_ID="<AGENT365_ENVIRONMENT_ID>"
> SERVER="<SERVER_NAME>"                 # for example ext_StackOne
> CLIENT_SECRET="<STACKONE_CLIENT_SECRET>"
>
> API="https://api.powerapps.com/providers/Microsoft.PowerApps/apis"
> QUERY="api-version=2016-11-01&\$filter=environment%20eq%20%27${ENV_ID}%27"
> TOKEN=$(az account get-access-token --resource https://service.powerapps.com/ \
>           --query accessToken -o tsv)
>
> # 1. Find the editable connector: shared_ext-5f<name>p-...
> PREFIX="shared_ext-5f$(echo "${SERVER#ext_}" | tr 'A-Z' 'a-z')p-"
> CONNECTOR=$(curl -s -H "Authorization: Bearer $TOKEN" "$API?$QUERY" |
>   PREFIX="$PREFIX" python3 -c '
> import json, os, sys
> names = [a["name"] for a in json.load(sys.stdin)["value"]
>          if a["name"].startswith(os.environ["PREFIX"])]
> print(names[0] if names else "")')
> [ -n "$CONNECTOR" ] || { echo "Connector not found. Check ENV_ID and SERVER."; exit 1; }
> echo "Connector: $CONNECTOR"
>
> # 2. Copy its token URL into the empty refresh URL, and add the client secret
> curl -s -H "Authorization: Bearer $TOKEN" "$API/$CONNECTOR?$QUERY" |
>   CLIENT_SECRET="$CLIENT_SECRET" python3 -c '
> import json, os, sys
> params = json.load(sys.stdin)["properties"]["connectionParameters"]
> oauth = params["token"]["oAuthSettings"]
> custom = {k[0].lower() + k[1:]: v for k, v in oauth["customParameters"].items()}
> custom["refreshUrl"] = {"value": custom["tokenUrl"]["value"]}
> oauth["customParameters"] = custom
> oauth["clientSecret"] = os.environ["CLIENT_SECRET"]
> json.dump({"properties": {"connectionParameters": params}}, open("patch.json", "w"))'
>
> # 3. Save it back
> STATUS=$(curl -s -o /dev/null -w "%{http_code}" -X PATCH \
>   -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
>   "$API/$CONNECTOR?$QUERY" -d @patch.json)
> rm -f patch.json
> [[ "$STATUS" =~ ^20[04]$ ]] && echo "Refresh URL set. You can now approve the server." \
>                       || { echo "Failed (HTTP $STATUS)"; exit 1; }
> ```

## Approve StackOne

**1. Review the request**

1. In the [Microsoft 365 admin center](https://admin.microsoft.com), go to **Agents** > **Tools**, then the **Requests (preview)** tab.
2. Open the StackOne server and check the tools it declares on the **Tools** tab.

![The Tools page in the Microsoft 365 admin center, opened from Agents then Tools, with the Requests (preview) tab listing tool requests and their type, such as MCP Server](https://mintcdn.com/stackone-60/PxWMQ9IOz3sntjnj/images/ai-platforms/microsoft/microsoft-365-admin-center-tools-requests.png?fit=max\&auto=format\&n=PxWMQ9IOz3sntjnj\&q=85\&s=3545609f78dc97049119a53645f718bd)

**2. Approve it**

Select **Approve**, then consent to the Microsoft Entra permissions the server asks for. The server can't be used until that consent is given.

**3. Connect your own StackOne login**

Each person, you included, connects StackOne once through a setup link in Power Apps. Follow **Connect StackOne** in [Organization User Setup](https://docs.stackone.com/ai-platforms/microsoft/microsoft-365-copilot/connect-stackone.md):

Sign in, pick the project and the [linked accounts](https://docs.stackone.com/connect/managing-connectors/linking-accounts.md) the connector should reach, then **Authorize**.

> [accordion] Walk through the consent screen
>
> 1. **Sign in to StackOne.** If you are already signed in to the dashboard you skip straight to the next step.
> 2. **Check where the connection returns.** The line under the client's logo shows where it goes after you approve. If it names localhost or an app on this device, only continue if you started the connection from that client.
> 3. **Select a project.** Select the project you would like to associate the connection with. If you belong to one project, this step is skipped.
> 4. **Select accounts and access.** Select the linked accounts the client can use, and choose how much it can do in each: read, write, full access, or pick individual actions. To link a new account, click **Link account**. When the project has [MCP Events](https://docs.stackone.com/connect/mcp-events.md) on, each account also lists its events, and all of them are granted unless you untick some.
> 5. **(Optional) Load tools when needed.** On by default, and the toggle that puts the connection into [Advanced Tool Search](https://docs.stackone.com/optimize/advanced-tool-search.md). Leave it on for large action sets. Turn it off to hand the agent every selected action up front.
> 6. **Authorize.** Completes the connection; you can return to your client.
>
> ![StackOne authorization screen listing organizations, with a project selected inside one of them](https://mintcdn.com/stackone-60/RgaE_4ZxFuvAQ6gS/images/ai-platforms/oauth-consent-select-project.png?fit=max\&auto=format\&n=RgaE_4ZxFuvAQ6gS\&q=85\&s=69d4694c8ea854c52ec62fc1bbe0825a)
>
> Select a project
>
> ![StackOne authorization screen showing two linked accounts, Linear and Open-Meteo, both selected, above the Load tools when needed toggle](https://mintcdn.com/stackone-60/RgaE_4ZxFuvAQ6gS/images/ai-platforms/oauth-consent-select-accounts.png?fit=max\&auto=format\&n=RgaE_4ZxFuvAQ6gS\&q=85\&s=66ef4eb4d8bf6e5246e5f01ec959c187)
>
> Select accounts
>
> ![An expanded linked account showing individual actions with toggles, descriptions, and category tags](https://mintcdn.com/stackone-60/RgaE_4ZxFuvAQ6gS/images/ai-platforms/oauth-consent-select-actions.png?fit=max\&auto=format\&n=RgaE_4ZxFuvAQ6gS\&q=85\&s=c86b615e0f55cd43236e38142c1ebca5)
>
> Toggle actions
>
> > [!NOTE]
> >
> > If you see a sentence where the **Load tools when needed** toggle should be, an admin has already settled it for the whole project. See [project settings](https://docs.stackone.com/optimize/advanced-tool-search.md#setting-it-for-a-whole-project).

Within about 30 minutes, the server shows in Copilot Studio in every environment in your tenant. To stop every agent from using it, block it under **Agents** > **Tools** > **Registry** in the admin center.

## Add StackOne to an agent

Agent makers add the server from the **Use the Agent 365 server** tab of [Agent Builder Setup](https://docs.stackone.com/ai-platforms/microsoft/copilot-studio/agent-builder-setup.md#add-stackone-to-the-agent).

To make an agent available in Microsoft 365 Copilot, publish it as Microsoft describes in [Connect and configure an agent for Teams and Microsoft Copilot](https://learn.microsoft.com/en-us/microsoft-copilot-studio/publication-add-bot-to-microsoft-teams).

> [accordion] If something goes wrong
>
> **Registration fails partway.** The CLI doesn't remove the Entra apps it already created. Delete them in the Azure portal, then register again.

## Roll it out

StackOne is now available for your users in Microsoft 365 Copilot. Make sure the following is ready before rolling out:

* **Add users.** Invite or provision users via SSO/SCIM. See [Manage Team](https://docs.stackone.com/secure/identity-and-access/manage-team/overview).
* **Create groups.** Organize teams into [groups](https://docs.stackone.com/secure/identity-and-access/roles-and-groups/groups.md) to control which systems each team reaches.
* **Set up connectors.** Define [Connector Profiles](https://docs.stackone.com/connect/managing-connectors/connector-profiles.md) to scope provider actions for specific functions.
* **Link accounts.** Link shared company accounts, or let users link their own accounts. See [Linking Accounts](https://docs.stackone.com/connect/managing-connectors/linking-accounts.md).

Then send users one of the following guides, depending on the product:

> [card] [Microsoft 365 Copilot](https://docs.stackone.com/ai-platforms/microsoft/microsoft-365-copilot/connect-stackone.md)
>
> For people in your organization connecting StackOne in Microsoft 365 Copilot.

> [card] [Copilot Studio](https://docs.stackone.com/ai-platforms/microsoft/copilot-studio/agent-builder-setup.md)
>
> For people building agents in Copilot Studio.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.