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.
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:
| Tool | Purpose |
|---|---|
GetTemplateStructure | Returns the template form hierarchy including field types, required flags, and repeatable collections. |
GenerateDocument | Generates a document by creating a Connect Session from structured form values for the selected template. |
GetAllTemplates | Returns all templates available to the user. |
FindTemplates | Finds templates based on a search query. |
A typical agent flow:
- Find a template —
FindTemplatesorGetAllTemplates. - Query the input structure —
GetTemplateStructurereturns the expected fields. - Generate the document —
GenerateDocumentwith the structured form values.
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.
Installation and operation of the MCP server (standalone application, reverse proxy, IdentityServer integration) are described in the Installation section.