docspace-mcp

ONLYOFFICE/docspace-mcp

3.3

If you are the rightful owner of docspace-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

Model Context Protocol (MCP) is a standardized protocol for managing context between large language models (LLMs) and external systems. This repository provides an MCP server for ONLYOFFICE DocSpace.

ONLYOFFICE DocSpace MCP Server

Open in VS Code using npx command Open in VS Code Insiders using npx command

Model Context Protocol (MCP) is a standardized protocol for managing context between large language models (LLMs) and external systems. This repository provides an MCP server for ONLYOFFICE DocSpace.

[!WARNING]

This ONLYOFFICE DocSpace MCP server is currently in preview state. While functional, it may undergo breaking changes, have incomplete features, or contain bugs. Use with caution in production environments and expect potential updates that could affect compatibility.

Installation

Most clients that implement the MCP protocol have a common configuration file in JSON format, inside which you can add ONLYOFFICE DocSpace MCP server as follows:

{
	"mcpServers": {
		"onlyoffice-docspace": {
			"env": {
				"DOCSPACE_BASE_URL": "https://your-instance.onlyoffice.com",
				"DOCSPACE_API_KEY": "your-api-key"
			},
			"command": "npx",
			"args": ["--yes", "@onlyoffice/docspace-mcp"]
		}
	}
}

For a more detailed example of the MCP server installation process, see how it can be done using Claude Desktop.

Build from source

ONLYOFFICE DocSpace MCP server can be built from source. To do this, you need to have the following tools installed on your system:

  • Node.js version 24 or higher;
  • pnpm version 10 or higher.

This project uses mise, a polyglot tool version manager, which you can use to install these tools. If you already have experience with tools like asdf, nvm, nodenv, or similar ones, you will find it very familiar.

Once you have everything installed, clone the Git repository from the company's Git server:

git clone git@git.onlyoffice.com:ONLYOFFICE/docspace-mcp.git

... or from the GitHub mirror:

git clone git@github.com:ONLYOFFICE/docspace-mcp.git

... install dependencies:

pnpm install

... build ONLYOFFICE DocSpace MCP server:

pnpm build

Now, you can use local build of ONLYOFFICE DocSpace MCP server in your MCP client:

{
	"mcpServers": {
		"onlyoffice-docspace": {
			"env": {
				"DOCSPACE_BASE_URL": "https://your-instance.onlyoffice.com",
				"DOCSPACE_API_KEY": "your-api-key"
			},
			"command": "<repo-dir>/bin/onlyoffice-docspace-mcp"
		}
	}
}

Configuration

The only way to configure ONLYOFFICE DocSpace MCP server is through environment variables. Below is an example of the .env file with possible configuration options:

#
# Internal configuration options
# These options are intended exclusively for use by company employees when
# integrating the DocSpace MCP server into other company products.
#

# Whether to run the DocSpace MCP server in internal mode.
# @type boolean
# @presence optional
# @default false
DOCSPACE_INTERNAL=

#
# General configuration options
# These options are available for all transport protocols.
#

# The transport protocol to use for communication with the DocSpace MCP server.
# The HTTP transport only available in the internal mode for now.
# @type enumeration
# @enum stdio, http
# @presence optional
# @default stdio
DOCSPACE_TRANSPORT=

# The user agent to include in the User-Agent header for DocSpace API requests
# @type string
# @presence optional
# @default @onlyoffice/docspace-mcp v2.0.0
DOCSPACE_USER_AGENT=

# Whether to enable dynamic tools. See the README.md file for more details about
# how dynamic tools work.
# @type boolean
# @presence optional
# @default false
DOCSPACE_DYNAMIC=

# The list of toolsets to use or 'all' to use all available toolsets. See the
# README.md file for more details about how toolsets work.
# @type enumeration (comma-separated)
# @enum See the README.md file for available toolsets
# @presence optional
# @default all
DOCSPACE_TOOLSETS=

# The list of tools to enable. See the README.md file for more details about how
# enabled tools work.
# @type enumeration (comma-separated)
# @enum See the README.md file for available tools
# @presence optional
# @default none
DOCSPACE_ENABLED_TOOLS=

# The list of tools to disable. See the README.md file for more details about
# how disabled tools work.
# @type enumeration (comma-separated)
# @enum See the README.md file for available tools
# @presence optional
# @default none
DOCSPACE_DISABLED_TOOLS=

#
# stdio configuration options
# These options are available only for the stdio transport protocol.
#

# The base URL of the DocSpace instance for API requests.
# @type url
# @presence required
# @example https://your-instance.onlyoffice.com
DOCSPACE_BASE_URL=

# The origin URL to include in the Origin header for DocSpace API requests.
# @type url
# @presence optional
# @example https://your-instance.onlyoffice.com
DOCSPACE_ORIGIN=

# The API key for accessing the DocSpace API.
# @type
#   string
# @presence
#   Required if nether DOCSPACE_AUTH_TOKEN nor DOCSPACE_USERNAME and
#   DOCSPACE_PASSWORD are provided.
# @example
#   sk-a499e...
DOCSPACE_API_KEY=

# The Personal Access Token (PAT) for accessing the DocSpace API.
# @type
#   string
# @presence
#   Required if neither DOCSPACE_API_KEY nor DOCSPACE_USERNAME and
#   DOCSPACE_PASSWORD are provided.
# @example
#   Fe4Hrgl6...
DOCSPACE_AUTH_TOKEN=

# The username for accessing the DocSpace API using basic authentication.
# @type
#   string
# @presence
#   Required if neither DOCSPACE_API_KEY nor DOCSPACE_AUTH_TOKEN are provided.
#   This configuration is used in conjunction with DOCSPACE_PASSWORD.
# @example
#   henry.milton@onlyoffice.com
DOCSPACE_USERNAME=

# The password for accessing the DocSpace API using basic authentication.
# @type
#   string
# @presence
#   Required if neither DOCSPACE_API_KEY nor DOCSPACE_AUTH_TOKEN are provided.
#   This configuration is used in conjunction with DOCSPACE_USERNAME.
# @example
#   ditgor-p...
DOCSPACE_PASSWORD=

#
# HTTP configuration options
# These options are available only for the http transport protocol.
#

# The host to listen on for incoming HTTP requests.
# @type string
# @presence optional
# @default 127.0.0.1
DOCSPACE_HOST=

# The port to listen on for incoming HTTP requests.
# @type number
# @presence optional
# @default 8080
DOCSPACE_PORT=

# The time-to-live (TTL) for HTTP sessions in milliseconds.
# @type number
# @presence optional
# @default 28800000 (8 hours)
DOCSPACE_SESSION_TTL=

# The interval for checking HTTP sessions for expiration in milliseconds.
# @type number
# @presence optional
# @default 240000 (4 minutes)
DOCSPACE_SESSION_INTERVAL=

Usage

Model Context Protocol describes several different concepts, however ONLYOFFICE DocSpace MCP server implements Tools only.

Tools

[!NOTE]

In addition to the existing concept of Tools, ONLYOFFICE DocSpace MCP server introduces a new one, Toolsets. A Toolset is a set of related tools.

In ONLYOFFICE DocSpace MCP server, all toolsets and their tools are available by default. However, you can manage this using the following configuration options: DOCSPACE_TOOLSETS, DOCSPACE_ENABLED_TOOLS, and DOCSPACE_DISABLED_TOOLS. See the Examples section for more details on how to configure these options.

Below is a table of available toolsets:

#Toolset NameToolset Description
1filesOperations for working with files.
2foldersOperations for working with folders.
3peopleOperations for working with users.
4roomsOperations for working with rooms.

Below are tables of available tools:

files
#Tool NameTool Description
1copy_batch_itemsCopy to a folder.
2delete_fileDelete a file.
3download_file_as_textDownload a file as text.
4get_file_infoGet file information.
5move_batch_itemsMove to a folder.
6update_fileUpdate a file.
7upload_fileUpload a file.
folders
#Tool NameTool Description
8create_folderCreate a folder.
9delete_folderDelete a folder.
10get_folder_contentGet content of a folder.
11get_folder_infoGet folder information.
12get_my_folderGet the 'My Documents' folder.
13rename_folderRename a folder.
people
#Tool NameTool Description
14get_all_peopleGet all people.
rooms
#Tool NameTool Description
15archive_roomArchive a room.
16create_roomCreate a room.
17get_room_access_levelsGet a list of available room invitation access levels.
18get_room_infoGet room information.
19get_room_security_infoGet a list of users with their access levels to a room.
20get_room_typesGet a list of available room types.
21get_rooms_folderGet the 'Rooms' folder.
22set_room_securityInvite or remove users from a room.
23update_roomUpdate a room.

Meta Tools

In some cases, directly connecting all available tools can be problematic. Using the DOCSPACE_DYNAMIC configuration option, you can wrap all available tools into meta-tools. Meta-tools are tools that allow an AI model to interact with other tools dynamically without loading them all simultaneously. Below is a table of available meta-tools:

#Meta Tool NameMeta Tool Description
1call_toolThis is a meta-tool for calling a tool. The list of available tools can be obtained using the list_tools meta-tool. The input schema can be obtained using the get_tool_input_schema meta-tool.
2get_tool_input_schemaThis is a meta-tool for getting an input schema for a specific tool. The list of available tools can be obtained using the list_tools meta-tool.
3list_toolsThis is a meta-tool for listing available tools of a specific toolset. The list of available toolsets can be obtained using the list_toolsets meta-tool.
4list_toolsetsThis is a meta-tool for listing available toolsets. Toolset is a set of available tools.

The DOCSPACE_DYNAMIC configuration option is complementary to DOCSPACE_TOOLSETS, DOCSPACE_ENABLED_TOOLS, and DOCSPACE_DISABLED_TOOLS configuration options.

Examples

In this section you can find examples of how to configure ONLYOFFICE DocSpace MCP server. For simplicity, let us come up with a small list of available toolsets and tools. The real server provides more of them, but for these examples, just a few are enough:

ToolsetTools
filescreate_file, get_file, delete_file
folderscreate_folder, get_folder, delete_folder

Enable a tool from not specified toolset

Configuration:

DOCSPACE_TOOLSETS=files
DOCSPACE_ENABLED_TOOLS=create_folder

Result:

ToolsetTools
filescreate_file, get_file, delete_file
folderscreate_folder

Disable a tool from specified toolset

Configuration:

DOCSPACE_TOOLSETS=files
DOCSPACE_ENABLED_TOOLS=create_folder
DOCSPACE_DISABLED_TOOLS=get_file

Result:

ToolsetTools
filescreate_file, delete_file
folderscreate_folder

Manually specify tools to be available

Configuration:

DOCSPACE_TOOLSETS= # Keep this empty to disable all tools
DOCSPACE_ENABLED_TOOLS=create_file,get_file,create_folder
DOCSPACE_DISABLED_TOOLS=get_file,delete_folder

Result:

ToolsetTools
filescreate_file
folderscreate_folder

License

ONLYOFFICE DocSpace MCP server is distributed under the Apache-2.0 license found in the LICENSE file.