Skip to main content
Glama
PSPDFKit

Nutrient DWS MCP Server

by PSPDFKit

document_signer

Digitally sign PDF files with CMS/PKCS#7 or CAdES signatures, offering visible or invisible options with customizable appearance and positioning.

Instructions

Digitally signs PDF files using Nutrient DWS Sign API. Reads from and writes to file system or sandbox (if enabled).

Signature types: • CMS/PKCS#7 (standard digital signatures) • CAdES (advanced electronic signatures)

Appearance options: • Visible or invisible signatures • Multiple display modes (signature only, description only, or both) • Customizable elements (signer name, reason, location, date) • Support for watermarks and custom graphics

Positioning: • Place on specific page coordinates • Use existing signature form fields

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYesThe path to the file to be signed. Resolves to sandbox path if enabled, otherwise resolves to the local file system.
signatureOptionsNoOptions for creating the digital signature. If not provided, defaults will be used.
watermarkImagePathNoThe path to the watermark image to be used as part of the signature's appearance. Optional. Resolves to sandbox path if enabled, otherwise resolves to the local file system.
graphicImagePathNoThe path to the graphic image to be used as part of the signature's appearance. Optional. Resolves to sandbox path if enabled, otherwise resolves to the local file system.
outputPathYesA path to the output file to. Resolves to sandbox path if enabled, otherwise resolves to the local file system.

Implementation Reference

  • Core handler function that performs the document signing by preparing form data with input file, signature options, optional images, calling the Nutrient DWS Sign API, and handling the response.
    export async function performSignCall( filePath: string, outputFilePath: string, signatureOptions: SignatureOptions = { signatureType: 'cms', flatten: false }, watermarkImagePath?: string, graphicImagePath?: string, ): Promise<CallToolResult> { try { // We resolve the output path first to fail early const resolvedOutputPath = await resolveWriteFilePath(outputFilePath) const formData = new FormData() await addFileToFormData(formData, 'file', filePath) if (signatureOptions) { formData.append('data', JSON.stringify(signatureOptions)) } if (watermarkImagePath) { await addFileToFormData(formData, 'watermark', watermarkImagePath) } if (graphicImagePath) { await addFileToFormData(formData, 'graphic', graphicImagePath) } const response = await callNutrientApi('sign', formData) return handleFileResponse(response, resolvedOutputPath, 'File signed successfully') } catch (e: unknown) { return handleApiError(e) } }
  • Zod schema defining the input arguments for the document_signer tool, including filePath, signatureOptions, optional watermark and graphic images, and outputPath.
    export const SignAPIArgsSchema = z.object({ filePath: z .string() .describe( 'The path to the file to be signed. Resolves to sandbox path if enabled, otherwise resolves to the local file system.', ), signatureOptions: CreateDigitalSignatureSchema.optional().describe( 'Options for creating the digital signature. If not provided, defaults will be used.', ), watermarkImagePath: z .string() .optional() .describe( "The path to the watermark image to be used as part of the signature's appearance. Optional. Resolves to sandbox path if enabled, otherwise resolves to the local file system.", ), graphicImagePath: z .string() .optional() .describe( "The path to the graphic image to be used as part of the signature's appearance. Optional. Resolves to sandbox path if enabled, otherwise resolves to the local file system.", ), outputPath: z .string() .describe( 'A path to the output file to. Resolves to sandbox path if enabled, otherwise resolves to the local file system.', ), })
  • src/index.ts:57-82 (registration)
    Registers the 'document_signer' tool with the MCP server using server.tool(), providing tool name, description, input schema, and thin wrapper handler.
    server.tool( 'document_signer', `Digitally signs PDF files using Nutrient DWS Sign API. Reads from and writes to file system or sandbox (if enabled). Signature types: • CMS/PKCS#7 (standard digital signatures) • CAdES (advanced electronic signatures) Appearance options: • Visible or invisible signatures • Multiple display modes (signature only, description only, or both) • Customizable elements (signer name, reason, location, date) • Support for watermarks and custom graphics Positioning: • Place on specific page coordinates • Use existing signature form fields`, SignAPIArgsSchema.shape, async ({ filePath, signatureOptions, watermarkImagePath, graphicImagePath, outputPath }) => { try { return performSignCall(filePath, outputPath, signatureOptions, watermarkImagePath, graphicImagePath) } catch (error) { return createErrorResponse(`Error: ${error instanceof Error ? error.message : String(error)}`) } }, )

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/PSPDFKit/nutrient-dws-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server