mcp-server-doccreator
Git-Fg/mcp-server-doccreatorUpdated 25 days ago00

Remote#MCP protocol#document generation#APILicense: NoneLanguage: JavaScript

MCP Server (MCP Protocol Compliant)

Overview

This server is now a standards-compliant Model Context Protocol (MCP) server. It exposes document generation as an MCP tool, allowing integration with AI hosts (e.g., Copilot, Cursor, Claude Desktop) via the MCP protocol.

MCP Features

  • MCP Tool: generateDocument — Generate PDF, DOCX, PPTX, or XLSX files from a prompt.
  • Transport: Stdio (local, default). SSE (network) can be added if needed.
  • Schema Validation: Uses zod for input validation.
  • Extensible: Add more tools/resources/prompts as needed.

Features

  • Document Generation: Create PDF, Word, PowerPoint, and Excel files from AI-driven prompts.
  • Image Embedding & Resizing: Insert and resize images in DOCX and PPTX files.
  • Asynchronous Processing: Queue and process document generation jobs using BullMQ and Redis.
  • Validation: Validate document layout by capturing and analyzing screenshots.
  • API-First: RESTful endpoints for document generation, job status, and result retrieval.
  • Extensible: Modular architecture for easy addition of new file types or tools.

Project Structure

src/
  app.js
  server.js
  config/
  controllers/
  middleware/
  public/
  routes/
  services/
  utils/
  workers/
temp_image/
validation-screenshots/
test-output/

Getting Started

Prerequisites

  • Node.js (v14+ recommended)
  • Redis server

Installation

  1. Clone the repository:
    git clone <repository-url>
    cd mcp-server
    
  2. Install dependencies:
    npm install
    
  3. Set up environment variables:
    • Copy .env.example to .env and fill in the required values.

Running the Server

npm start

Running Tests

npx jest src/services/fileCreation.test.js --runInBand

API Endpoints

  • POST /documents/generate — Request document generation (PDF, DOCX, PPTX, XLSX)
  • GET /documents/generate/status/:jobId — Check job status
  • GET /documents/generate/result/:jobId — Download generated file

File Generation & Validation

  • Supports AI-driven content and layout via Gemini/OpenAI function calling.
  • Image insertion with resizing is available for DOCX and PPTX.
  • Layout validation uses screenshots (mocked or real, see aiFileValidationService).

Example: Image Embedding & Resizing

  • Place images in temp_image/ (e.g., temp_image/blackboard-with-camera-leaf.jpg).
  • Use function calls like:
    { name: 'addImage', arguments: { path: 'temp_image/blackboard-with-camera-leaf.jpg', options: { width: 150, height: 150 } } }
    

Usage

Build and Start

npm run build
npm start

MCP Host Configuration Example (stdio)

Add to your host's mcp.json (e.g., for Cursor, VS Code, Claude Desktop):

{
  "mcpServers": {
    "document-server": {
      "command": "/usr/local/bin/node",
      "args": ["/absolute/path/to/build/index.js"]
    }
  }
}

Debugging with MCP Inspector

You can test this server using the official MCP Inspector:

npx @modelcontextprotocol/inspector node build/index.js

Extending

  • Add more tools/resources in src/index.ts using the MCP SDK.
  • For SSE/network transport, see the MCP SDK docs and the guide.

Security & Best Practices

  • Always validate and sanitize tool/resource inputs.
  • Never expose sensitive data without user consent.
  • For remote/SSE deployments, implement authentication and TLS.

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

MIT


This project now follows the official MCP server standards for Node.js/Typescript.

Installation

Claude
Claude
Cursor
Cursor
Windsurf
Windsurf
Cline
Cline
Witsy
Witsy
Spin AI
Spin AI
Run locally with the following command:
Terminal
Add the following config to your client:
JSON
{
  "mcpServers": {
    "document-server": {
      "env": {},
      "args": [
        "index.js"
      ],
      "command": "node"
    }
  }
}

MCPLink

Seamless access to top MCP servers powering the future of AI integration.

© 2025 MCPLink. All rights reserved.
discordgithubdiscord