Connecting ONLYOFFICE DocSpace MCP Server to OpenAI using custom headers

Introduction

The ONLYOFFICE DocSpace MCP Server is a tool for managing the interaction with language models tailored to enhance efficiency, to streamline the AI-driven workflows, document and task management and to bring out the full potential of the ONLYOFFICE DocSpace.

The ONLYOFFICE DocSpace MCP Server may be connected to clients that support connection to the MCP servers running on a remote machine.

The public instance is available at https://mcp.onlyoffice.com/mcp for clients that support modern Streamable HTTP transport and at https://mcp.onlyoffice.com/sse for clients that support only the legacy SSE transport. We recommend that you use the Streamable HTTP transport whenever possible.

These instructions demonstate how to connect an MCP Client to a remote MCP Server using custom headers provided such a client allows you to pass custom headers. Use this authentication method if only you cannot use OAuth for some reason since this method is less secure.

To connect ONLYOFFICE DocSpace MCP Server to OpenAI:

  1. Generate your own DocSpace api key. The Custom Headers authentification method is less secure compared to OAuth therefore it's not advisable to use the Owner's or the Room Manager's API keys. To generate an API key, go to your DocSpace. Click the Developer Tools tab in the left panel. Choose the API keys tab on top and click the Create new secret key button. Copy the generated key.
    Generate API keyGenerate API key
  2. Access your OpenAI account and open a new prompt in Chat.
  3. Find Tools option and click the Add button.
    Add toolAdd tool
  4. In the window that opens, click Server in the upper right corner.
    Add serverAdd server
  5. Fill in the required MCP server parameters:
    MCP server parametersMCP server parameters
    • URL:
      https://mcp.onlyoffice.com/mcp
              
    • Label – fill in the name to distinguish the MCP server.
    • Description – give a short desription for the MCP Server to improve the server identificaton. It’s an optional parameter.
    • Authentification – define the authentification method and settings. Choose Custom headers from the drop-down list, and use your DocSpaceAPI key and base URL of your DocSpace portal to connect to. Fill in the fields that open as follows:
      X-Mcp-Base-Url: https://your-instance.onlyoffice.com/
      X-Mcp-Api-Key: sk-a499e...

      X-Mcp-Base-Url - web adress of your Docspace for the MCP Server to connect to the right portal.

      X-Mcp-Api-Key - the DocSpace API key that has been generated as described is Step 1 abovw to authorize the MCP Sever's access to DocSpace.

      MCP server headersMCP server headers
  6. Click Connect and wait for the connection to establish.
  7. As soon as the MCP Server connects, you will see the list of the MCP server tools. Choose the necessary tools or choose all, and click the Add button at the bottom of the list.
    MCP Server toolsMCP Server tools
  8. Use the OpenAI chat with the DocSpace MCP Server tools connected. Give your prompt, click Approve to confirm the list of tools used to respond to your prompt.
    Approve toolsApprove tools

Host ONLYOFFICE DocSpace on your own server or use it in the cloud

Article with the tag:
Browse all tags