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

MCP Server

The primedocs MCP server (PrimeDocs.Web.Mcp) is a standalone ASP.NET Core application (.NET 10) that exposes primedocs capabilities to AI agents via the Model Context Protocol. It runs separately from the rest of the primedocs server.

Prerequisites

  • .NET 10 Windows Hosting Bundle (same as the primedocs server).
  • A reachable primedocs IdentityServer instance for OAuth authorisation.
  • A primedocs.config (the same one used by the primedocs server, or one referencing it), see primedocs.config.

Hosting

The MCP server can run under IIS (a web.config is shipped) or be self-hosted (Kestrel). It is recommended to run it behind a reverse proxy — the application honours the X-Forwarded-For and X-Forwarded-Proto headers.

Configuration

The only setting in appsettings.json is the path to the primedocs.config:

{
"primedocs": {
"ConfigFilePath": "C:\\primedocs\\primedocs.config"
}
}

The following values are read from primedocs.config in particular:

  • the IdentityServer URL (authority for JWT bearer and token introspection),
  • the MCP base URL,
  • optional values such as the introspection secret and a proxy configuration.

The datasource is selected per request via the URL segment (see endpoint).

Endpoint and authentication

The MCP endpoint is tenant-specific:

https://<mcp-host>/{dataSourceId}

The server is an OAuth 2.0 protected resource. Clients discover the authorisation parameters via the discovery endpoints:

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

On a 401 the server returns a WWW-Authenticate header with the resource_metadata URL. Access tokens are validated against the IdentityServer via introspection; the MCP scope is required.

For details on the available tools (GetTemplateStructure, GenerateDocument, GetAllTemplates, FindTemplates), see the MCP interface page.