AI Configuration Parameters

All the following parameters must be configured in the openkm.properties file. Once configured, the OpenKM service must be restarted for the changes to take effect.

Some functionalities must be enabled in the user's Profiles for them to be available.

From Administration > AI Prompt, prompts can be defined in combination with Creating your own AI prompt plugin.

OpenKM utilizes Spring AI (specifically version 1.1.2 at the time of this documentation). The parameters shown here represent only a subset of those provided by this library. For comprehensive information, please consult the Spring AI documentation:

Currently supported models include: Anthropic Claude, Azure OpenAI, Google Vertex AI Gemini, Ollama (for running local models), and OpenAI. Additional models from the comparison list can be integrated as needed.

You should only activate one AI model at a time.

An active AI model is required for several OpenKM functionalities, including prompts, AI plugins for document processing, RAG (Retrieval-Augmented Generation), and the MCP client.

AI Provider Configuration

The following parameters define which AI model to use for chat and embedding operations.

PropertyTypeDescription

spring.ai.model.chat

String

Specifies the chat model provider.

openai

spring.ai.model.embedding

String

Specifies the embedding model provider.

openai

spring.ai.openai.api-key

String

The API key for authentication.

API KEY

spring.ai.openai.chat.options.model

String

The specific model version to use.

gpt-5-mini

spring.ai.openai.chat.options.temperature

Float

Controls randomness in responses (0.0 to 1.0). Lower values make output more focused and deterministic.

1

MCP Server Configuration

The Model Context Protocol (MCP) Server allows external applications to interact with OpenKM's core functionalities.

PropertyTypeDescription

spring.ai.mcp.server.enabled

Boolean

Enables or disables the MCP server. Set to true to activate the MCP server and restart the service.

false

spring.ai.mcp.server.instructions

String

Instructions and description for the MCP server.

This server provides basic OpenKM application information and tools. OpenKM is a document management system that allows you to manage your documents. You can use this server to interact with OpenKM's core functionalities through the MCP protocol.

spring.ai.mcp.server.request-timeout

Duration

Request timeout duration.

60s

okm.mcp.security.allowed.ips

String

Restricts which IP addresses can access the MCP service. 

Use * to allow all IPs, or specify a specific IP address (e.g., 10.0.0.50) to restrict access.

*

Additional parameters for MCP-specific logging:

To enable detailed logging for the MCP service, add the following parameters to openkm.properties:

  • logging.level.com.openkm.mcp=DEBUG
  • logging.level.com.openkm.config.MCPToolSecurityAspect=DEBUG

MCP Client Configuration

OpenKM includes an MCP (Model Context Protocol) client that allows it to connect to external MCP servers.

Important: Do not enable the Spring AI auto-configuration for the MCP client. The parameter spring.ai.mcp.client.enabled must always be set to false. OpenKM uses manual configuration instead.

PropertyTypeDescription

spring.ai.mcp.client.enabled

Boolean

Spring AI MCP client auto-configuration. 

Must always be false.

false

okm.mcp.manual.client.enabled

Boolean

Enables or disables the manual MCP client configuration.

false

okm.mcp.manual.connections.server1.url

String

URL of the first MCP server to connect to.

http://localhost:8080

okm.mcp.manual.connections.server1.sse-endpoint

String

Server-Sent Events (SSE) endpoint for the MCP server.

/openkm/sse

okm.mcp.manual.connections.server1.token

String

Authentication token for OpenKM. We recommend generating a token with a validity period of one year or more.

The MCP client supports multiple server connections. To add additional servers, use the same parameter pattern with different server identifiers:

  • okm.mcp.manual.connections.server2.url
  • okm.mcp.manual.connections.server2.sse-endpoint
  • okm.mcp.manual.connections.server2.token

RAG (Retrieval-Augmented Generation) Configuration

RAG enhances AI responses by retrieving relevant information from a vector database. OpenKM supports different vector store backends.

MariaDB example configuration

PropertyValue

spring.ai.model.embedding

openai

spring.ai.vectorstore.mariadb.initialize-schema

true

spring.ai.vectorstore.type

mariadb

PostgreSQL example configuration

The PostgreSQL server must have vector support available before enabling this option. This means the server needs the vector extension installed — either by adding the corresponding extension package to an existing PostgreSQL installation, or by using a PostgreSQL Docker image that already includes vector support. Check the documentation for your operating system or Docker distribution for the appropriate installation method.

PropertyValue

spring.ai.model.embedding

openai

spring.ai.vectorstore.pgvector.initialize-schema

true

spring.ai.vectorstore.type

pgvector

spring.ai.vectorstore.similarity.threshold

0.7

Indexing Documents into the RAG

Enabling the RAG through the configuration file is a necessary but not sufficient step. Simply activating it does not cause documents to be automatically vectorized or made available to the Smart Search or Chatbot features. Users must explicitly define which documents, or which areas of the repository, should be indexed in the vector store.

This selective indexing approach is intentional: indexing the entire repository is technically possible, but is generally not recommended, as it may introduce noise into AI responses and increase both storage and processing costs.

Configuring the Feed RAG Automation Rule

OpenKM ships with a built-in automation rule named Feed RAG, designed precisely for this purpose. This rule must be reviewed and activated through the Automation module and works as follows:

  • Event: The rule is triggered by the Document text extraction event, at the post phase, that is, after the text has been successfully extracted from a document.
  • Validation: A PathContains condition determines which documents qualify for indexing. Typically, this is configured with one or more repository folder paths so that only documents stored within those folders are vectorized.
  • Action: The FeedRAG action performs the actual vectorization and stores the document embeddings in the configured vector store.

The most common configuration involves targeting one or several specific folders in the repository, ensuring that only the relevant content is made available to the AI features.

The Feed RAG rule is included with OpenKM by default. Users only need to review and adapt its PathContains validation to match the folders they wish to index.