Skip to main content
Version: 4.1 (2026-H2)

MCP

The primedocs MCP server exposes primedocs capabilities to AI agents through the Model Context Protocol (MCP) — for example to Microsoft 365 Copilot or other MCP-capable assistants. Agents can search templates, query their input structure, and generate documents without opening the primedocs UI.

note

Guidance on optimising templates for Microsoft 365 Copilot (PowerPoint, Word, Outlook, Excel) now lives under Best Practices › Microsoft 365 Copilot. This page describes the MCP server as an interface.

Architecture

The MCP server is a standalone application (PrimeDocs.Web.Mcp) and runs separately from the rest of the primedocs server. It uses a stateless HTTP transport, so no session state is retained.

The MCP endpoint is tenant-specific and carries the datasource id in the path:

POST https://{instanz}/mcp/{datasourceId}

Opening the server's base URL in a browser shows a landing page with server information and the tool catalog (the list of available tools).

Authentication

The server is an OAuth 2.0 protected resource. Authorisation is performed against the primedocs IdentityServer; access tokens are validated server-side via introspection.

MCP clients discover the authorisation parameters automatically through the discovery endpoint defined by the MCP OAuth specification:

GET /.well-known/oauth-protected-resource

The response returns the protected resource, the responsible authorisation server (IdentityServer), and the required scope. On a 401 the server additionally returns a WWW-Authenticate header pointing to the resource metadata. The token is sent as a bearer token in the Authorization header.

Available tools

The server currently exposes the following tools:

ToolPurpose
GetTemplateStructureReturns the template form hierarchy including field types, required flags, and repeatable collections.
GenerateDocumentGenerates a document by creating a Connect Session from structured form values for the selected template.
GetAllTemplatesReturns all templates available to the user.
FindTemplatesFinds templates based on a search query.

A typical agent flow:

  1. Find a template — FindTemplates or GetAllTemplates.
  2. Query the input structure — GetTemplateStructure returns the expected fields.
  3. Generate the document — GenerateDocument with the structured form values.
info

GenerateDocument expects values matching the structure from GetTemplateStructure: JSON objects for object fields, arrays for collection fields, and ISO dates (yyyy-MM-dd) for date fields.

note

Installation and operation of the MCP server (standalone application, reverse proxy, IdentityServer integration) are described in the Installation section.