{"_id":"@brdemorin/google-docs-mcp-server","_rev":"3-33b0b91fa5e018334a66927f7ce6f640","name":"@brdemorin/google-docs-mcp-server","dist-tags":{"latest":"0.2.2"},"versions":{"0.2.0":{"name":"@brdemorin/google-docs-mcp-server","version":"0.2.0","keywords":["mcp","google-docs","docs-api","model-context-protocol","ai-assistant","google-api","document-management","document-editing","typescript","collaboration","content-creation","ai-tools","markdown"],"author":{"name":"Brian Morin","email":"brdemorin@yahoo.com"},"license":"MIT","_id":"@brdemorin/google-docs-mcp-server@0.2.0","maintainers":[{"name":"brdemorin","email":"brdemorin@yahoo.com"}],"contributors":[{"url":"original author","name":"lakhvinder singh"}],"homepage":"https://github.com/brdemorin/google-docs-mcp-server#readme","bugs":{"url":"https://github.com/brdemorin/google-docs-mcp-server/issues"},"bin":{"google-docs-mcp-server":"dist/index.js"},"dist":{"shasum":"ff0891e00593964e9e791d9dccfae6a3535a22f5","tarball":"https://registry.npmjs.org/@brdemorin/google-docs-mcp-server/-/google-docs-mcp-server-0.2.0.tgz","fileCount":9,"integrity":"sha512-HgnOJZ1N22sV07dHRf/DaSH6aeoimraNLFVlTb7RImTVAcmcsjcRnAYPdjEVLIHMawWDipz1C8Ec9IHVAmxgcA==","signatures":[{"sig":"MEUCIQCJdHqOjTuc2PiydGj3DRclJTJnnZQuy6byEPlNCSPcBwIgSKDglB0qIeyT2fc3Qddigblw9GRfw+nkmxPV0WiN6PA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":78363},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","gitHead":"fb8a41584c84274d51a89d6782f9fc1850f0dc17","scripts":{"dev":"tsx --watch src/index.ts","build":"tsc","start":"node dist/index.js","stdio":"node dist/index.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"brdemorin","email":"brdemorin@yahoo.com"},"repository":{"url":"git+https://github.com/brdemorin/google-docs-mcp-server.git","type":"git"},"_npmVersion":"10.2.3","description":"A powerful Model Context Protocol (MCP) server implementation for seamless Google Docs API integration, enabling AI assistants to create, read, update, and manage Google Docs with markdown export support","directories":{},"_nodeVersion":"20.10.0","dependencies":{"zod":"^3.24.2","dotenv":"^16.4.7","googleapis":"^133.0.0","@modelcontextprotocol/sdk":"^1.8.0"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.7.0","typescript":"^5.3.3","@types/node":"^20.10.5"},"_npmOperationalInternal":{"tmp":"tmp/google-docs-mcp-server_0.2.0_1766697093066_0.9792725917758727","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@brdemorin/google-docs-mcp-server","version":"0.2.1","keywords":["mcp","google-docs","docs-api","model-context-protocol","ai-assistant","google-api","document-management","document-editing","typescript","collaboration","content-creation","ai-tools","markdown"],"author":{"name":"Brian Morin","email":"brdemorin@yahoo.com"},"license":"MIT","_id":"@brdemorin/google-docs-mcp-server@0.2.1","maintainers":[{"name":"brdemorin","email":"brdemorin@yahoo.com"}],"contributors":[{"url":"original author","name":"lakhvinder singh"}],"homepage":"https://github.com/brdemorin/google-docs-mcp-server#readme","bugs":{"url":"https://github.com/brdemorin/google-docs-mcp-server/issues"},"bin":{"google-docs-mcp-server":"dist/index.js"},"dist":{"shasum":"40037df71093bb635fba99129c225953cb604b7d","tarball":"https://registry.npmjs.org/@brdemorin/google-docs-mcp-server/-/google-docs-mcp-server-0.2.1.tgz","fileCount":9,"integrity":"sha512-qiWn1GenwnrOJK7UEPnr/s7V+SPKmktf+e9CK3aWjuGDIiOYl1ASE02dQD+xgq5jD1ashypXm12ufDQ7aQse5A==","signatures":[{"sig":"MEQCIBEu5hanYn7pbnj2PZl6gfUXaDHFKjeY+vigVe3hZ5SHAiBmwD6Wa65sXPG6nzAkq18iHOWFKWXFQy/AmsanaOWYwA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":80272},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","gitHead":"1bb4a8c05fcb4cbd9220e215a074d83e4395b25e","scripts":{"dev":"tsx --watch src/index.ts","build":"tsc","start":"node dist/index.js","stdio":"node dist/index.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"brdemorin","email":"brdemorin@yahoo.com"},"repository":{"url":"git+https://github.com/brdemorin/google-docs-mcp-server.git","type":"git"},"_npmVersion":"10.2.3","description":"A powerful Model Context Protocol (MCP) server implementation for seamless Google Docs API integration, enabling AI assistants to create, read, update, and manage Google Docs with markdown export support","directories":{},"_nodeVersion":"20.10.0","dependencies":{"zod":"^3.24.2","dotenv":"^16.4.7","googleapis":"^133.0.0","@modelcontextprotocol/sdk":"^1.8.0"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.7.0","typescript":"^5.3.3","@types/node":"^20.10.5"},"_npmOperationalInternal":{"tmp":"tmp/google-docs-mcp-server_0.2.1_1766704145797_0.3531200168380808","host":"s3://npm-registry-packages-npm-production"}},"0.2.2":{"name":"@brdemorin/google-docs-mcp-server","version":"0.2.2","description":"A powerful Model Context Protocol (MCP) server implementation for seamless Google Docs API integration, enabling AI assistants to create, read, update, and manage Google Docs with markdown export support","main":"dist/index.js","bin":{"google-docs-mcp-server":"dist/index.js"},"type":"module","scripts":{"build":"tsc","start":"node dist/index.js","dev":"tsx --watch src/index.ts","stdio":"node dist/index.js","prepublishOnly":"npm run build"},"keywords":["mcp","google-docs","docs-api","model-context-protocol","ai-assistant","google-api","document-management","document-editing","typescript","collaboration","content-creation","ai-tools","markdown"],"author":{"name":"Brian Morin","email":"brdemorin@yahoo.com"},"contributors":[{"name":"lakhvinder singh","url":"original author"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/brdemorin/google-docs-mcp-server.git"},"bugs":{"url":"https://github.com/brdemorin/google-docs-mcp-server/issues"},"homepage":"https://github.com/brdemorin/google-docs-mcp-server#readme","dependencies":{"@modelcontextprotocol/sdk":"^1.8.0","googleapis":"^133.0.0","dotenv":"^16.4.7","zod":"^3.24.2"},"devDependencies":{"@types/node":"^20.10.5","tsx":"^4.7.0","typescript":"^5.3.3"},"_id":"@brdemorin/google-docs-mcp-server@0.2.2","gitHead":"d1fe947d9fe2c98d6222dd95b456308a1a215629","types":"./dist/index.d.ts","_nodeVersion":"20.10.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-MEEcQz3m6jdaVs+fkcDrfr61pBz70CswmGz6GZ7G/OwkUrw5Q8KD873zjzwQ+WxEKqTdd2GlDulMz/I5jWkfeA==","shasum":"8478011d33bf20cef71b41bb1a5c901fa5a72512","tarball":"https://registry.npmjs.org/@brdemorin/google-docs-mcp-server/-/google-docs-mcp-server-0.2.2.tgz","fileCount":9,"unpackedSize":78609,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDmv8Z26q5+mAVYHW4vzOx2k+4hKwx5dQovII9u9zi96wIhAKjIkEdZb0OUGAEG5yB8PdDauh7sDd+Ff9EecaBNHIlW"}]},"_npmUser":{"name":"brdemorin","email":"brdemorin@yahoo.com"},"directories":{},"maintainers":[{"name":"brdemorin","email":"brdemorin@yahoo.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/google-docs-mcp-server_0.2.2_1766712508828_0.4462952520846488"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-25T21:11:32.904Z","modified":"2025-12-26T01:28:29.204Z","0.2.0":"2025-12-25T21:11:33.230Z","0.2.1":"2025-12-25T23:09:05.956Z","0.2.2":"2025-12-26T01:28:29.007Z"},"bugs":{"url":"https://github.com/brdemorin/google-docs-mcp-server/issues"},"author":{"name":"Brian Morin","email":"brdemorin@yahoo.com"},"license":"MIT","homepage":"https://github.com/brdemorin/google-docs-mcp-server#readme","keywords":["mcp","google-docs","docs-api","model-context-protocol","ai-assistant","google-api","document-management","document-editing","typescript","collaboration","content-creation","ai-tools","markdown"],"repository":{"type":"git","url":"git+https://github.com/brdemorin/google-docs-mcp-server.git"},"description":"A powerful Model Context Protocol (MCP) server implementation for seamless Google Docs API integration, enabling AI assistants to create, read, update, and manage Google Docs with markdown export support","contributors":[{"name":"lakhvinder singh","url":"original author"}],"maintainers":[{"name":"brdemorin","email":"brdemorin@yahoo.com"}],"readme":"# Google Docs MCP Server\n\n[![npm version](https://img.shields.io/npm/v/@brdemorin/google-docs-mcp-server.svg)](https://www.npmjs.com/package/@brdemorin/google-docs-mcp-server)\n\n> **Fork of [lkm1developer/google-docs-mcp-server](https://github.com/lkm1developer/google-docs-mcp-server)**\n>\n> This fork adds **Markdown export** functionality using Google's native conversion.\n\nA powerful Model Context Protocol (MCP) server implementation for seamless Google Docs API integration, enabling AI assistants to create, read, update, and manage Google Docs.\n\n## Recommended Production Configuration\n\n**Full server start command via STDIO:**\n```bash\nnpx -y @brdemorin/google-docs-mcp-server\n```\n\n**Environment Variables:**\n```\nGOOGLE_CLOUD_PROJECT_ID=your-project-id\nGOOGLE_APPLICATION_CREDENTIALS=path/to/your-service-account-key.json\n```\n\n**MCP Config:**\n```json\n{\n  \"mcpServers\": {\n    \"google-docs\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@brdemorin/google-docs-mcp-server\"],\n      \"env\": {\n        \"GOOGLE_CLOUD_PROJECT_ID\": \"your-project-id\",\n        \"GOOGLE_APPLICATION_CREDENTIALS\": \"path/to/your-service-account-key.json\"\n      }\n    }\n  }\n}\n```\n\n## What's New in This Fork\n\n- **`google_docs_to_markdown`** - Export any Google Doc to Markdown format using Google's native conversion (not custom parsing)\n\n## Features\n\n- **Export documents to Markdown** (new in this fork)\n- Create new Google Docs with custom titles and content\n- Retrieve document content and metadata\n- Update existing documents with new content\n- List all accessible documents\n- Delete documents\n- Export documents to different formats (PDF, plain text, etc.)\n- Share documents with specific users\n- Search for documents by title or content\n- Verify connection and credentials\n\n## Prerequisites\n\n- Node.js 18 or higher\n- A Google Cloud project with the Google Docs API enabled\n- Authentication credentials (API key, service account, or OAuth2)\n\n## Installation\n\n### Option 1: npm (Recommended)\n\n```bash\nnpx -y @brdemorin/google-docs-mcp-server\n```\n\n### Option 2: From Source\n\n1. Clone this repository:\n   ```bash\n   git clone https://github.com/brdemorin/google-docs-mcp-server.git\n   cd google-docs-mcp-server\n   ```\n\n2. Install dependencies:\n   ```bash\n   npm install\n   ```\n\n3. Create a `.env` file with your Google Cloud credentials:\n   ```\n   # Required\n   GOOGLE_CLOUD_PROJECT_ID=your-project-id\n   \n   # Choose one authentication method:\n   \n   # Option 1A: Service Account with file path (recommended for production)\n   GOOGLE_APPLICATION_CREDENTIALS=path/to/your-service-account-key.json\n   \n   # Option 1B: Service Account with JSON content directly\n   # Useful for environments where you can't create files\n   GOOGLE_APPLICATION_CREDENTIALS_JSON={\"type\":\"service_account\",\"project_id\":\"...\",\"private_key\":\"...\",\"client_email\":\"...\"}\n   \n   # Option 2: API Key (simpler for development)\n   GOOGLE_API_KEY=your-api-key\n   \n   # Option 3: OAuth2 (required for user-specific operations)\n   client_id=your-oauth-client-id\n   client_secret=your-oauth-client-secret\n   refresh_token=your-oauth-refresh-token\n   ```\n\n## Authentication Setup\n\n### Service Account Authentication\n\n1. Go to the [Google Cloud Console](https://console.cloud.google.com/)\n2. Create a new project or select an existing one\n3. Enable the **Google Docs API** and **Google Drive API**:\n   - Go to \"APIs & Services\" > \"Library\"\n   - Search for \"Google Docs API\" and click \"Enable\"\n   - Search for \"Google Drive API\" and click \"Enable\"\n4. Go to \"IAM & Admin\" > \"Service Accounts\"\n5. Create a new service account\n6. Create and download a JSON key for the service account\n7. Set the path to this JSON file in your environment as `GOOGLE_APPLICATION_CREDENTIALS`\n8. **Important: Share your Google Drive folder/documents with the service account:**\n   - Find the service account email in the JSON key file (looks like `your-service-account@your-project.iam.gserviceaccount.com`)\n   - Go to Google Drive and right-click the folder or document you want to access\n   - Click \"Share\" and add the service account email address\n   - Set permission to **Editor** (required for create/update operations)\n\n### OAuth2 Authentication\n\nFor operations that require user consent (like creating/editing documents):\n\n1. Go to the [Google Cloud Console](https://console.cloud.google.com/)\n2. Create a new project or select an existing one\n3. Enable the Google Docs API and Google Drive API\n4. Go to \"APIs & Services\" > \"Credentials\"\n5. Create OAuth client ID credentials (Web application type)\n6. Add authorized redirect URIs (e.g., http://localhost:3000/oauth2callback)\n7. Note your Client ID and Client Secret\n8. Use the following script to get a refresh token:\n\n```javascript\n// get-refresh-token.js\nconst { google } = require('googleapis');\nconst http = require('http');\nconst url = require('url');\nconst open = require('open');\nconst destroyer = require('server-destroy');\n\nasync function getRefreshToken() {\n  const oauth2Client = new google.auth.OAuth2(\n    'YOUR_CLIENT_ID',\n    'YOUR_CLIENT_SECRET',\n    'http://localhost:3000/oauth2callback'\n  );\n\n  const scopes = [\n    'https://www.googleapis.com/auth/documents',\n    'https://www.googleapis.com/auth/drive'\n  ];\n\n  const authorizeUrl = oauth2Client.generateAuthUrl({\n    access_type: 'offline',\n    scope: scopes,\n    prompt: 'consent'\n  });\n\n  console.log('Opening browser for authorization...');\n  open(authorizeUrl);\n\n  return new Promise((resolve, reject) => {\n    const server = http.createServer(async (req, res) => {\n      try {\n        const queryParams = url.parse(req.url, true).query;\n        \n        if (queryParams.code) {\n          res.end('Authentication successful! You can close this window.');\n          server.destroy();\n          \n          const { tokens } = await oauth2Client.getToken(queryParams.code);\n          console.log('\\nRefresh Token:', tokens.refresh_token);\n          console.log('\\nAdd this refresh token to your .env file as refresh_token');\n          \n          resolve(tokens.refresh_token);\n        }\n      } catch (e) {\n        reject(e);\n      }\n    }).listen(3000);\n    \n    destroyer(server);\n  });\n}\n\ngetRefreshToken().catch(console.error);\n```\n\nRun this script with:\n```bash\nnpm install googleapis open server-destroy\nnode get-refresh-token.js\n```\n\n## Building and Running\n\n1. Build the project:\n   ```bash\n   npm run build\n   ```\n\n2. Test your connection:\n   ```bash\n   npx tsx src/test-connection.ts\n   ```\n\n3. Run the server:\n   ```bash\n   npm start\n   ```\n\n   Or with specific credentials:\n   ```bash\n   npm start -- --GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json --GOOGLE_CLOUD_PROJECT_ID=your-project-id\n   \n   # Or with JSON content directly:\n   npm start -- --GOOGLE_APPLICATION_CREDENTIALS_JSON='{\"type\":\"service_account\",\"project_id\":\"...\"}' --GOOGLE_CLOUD_PROJECT_ID=your-project-id\n   ```\n\n4. Run the SSE server with authentication:\n   ```bash\n   npx mcp-proxy-auth node dist/index.js\n   ```\n\n### Implementing Authentication in SSE Server\n\nThe SSE server uses the [mcp-proxy-auth](https://www.npmjs.com/package/mcp-proxy-auth) package for authentication. To implement authentication:\n\n1. Install the package:\n   ```bash\n   npm install mcp-proxy-auth\n   ```\n\n2. Set the `AUTH_SERVER_URL` environment variable to point to your API key verification endpoint:\n   ```bash\n   export AUTH_SERVER_URL=https://your-auth-server.com/verify\n   ```\n\n3. Run the SSE server with authentication:\n   ```bash\n   npx mcp-proxy-auth node dist/index.js\n   ```\n\n4. The SSE URL will be available at:\n   ```\n   localhost:8080/sse?apiKey=apikey\n   ```\n\n   Replace `apikey` with your actual API key for authentication.\n\nThe `mcp-proxy-auth` package acts as a proxy that:\n- Intercepts requests to your SSE server\n- Verifies API keys against your authentication server\n- Only allows authenticated requests to reach your SSE endpoint\n\n### Docker Support\n\nYou can also run the server using Docker:\n\n1. Build the Docker image:\n   ```bash\n   docker build -t google-docs-mcp-server .\n   ```\n\n2. Run the container:\n   ```bash\n   docker run -p 8080:8080 \\\n     -e GOOGLE_CLOUD_PROJECT_ID=your-project-id \\\n     -e GOOGLE_APPLICATION_CREDENTIALS_JSON='{\"type\":\"service_account\",\"project_id\":\"...\"}' \\\n     -e client_id=your-client-id \\\n     -e client_secret=your-client-secret \\\n     -e refresh_token=your-refresh-token \\\n     -e AUTH_SERVER_URL=https://your-auth-server.com/verify \\\n     google-docs-mcp-server\n   ```\n\n## MCP Integration\n\nTo use this server with Claude or other MCP-compatible assistants, add it to your MCP settings:\n\n```json\n{\n  \"mcpServers\": {\n    \"google-docs\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@brdemorin/google-docs-mcp-server\"],\n      \"env\": {\n        \"GOOGLE_CLOUD_PROJECT_ID\": \"your-project-id\",\n        \"GOOGLE_APPLICATION_CREDENTIALS\": \"/path/to/your-service-account-key.json\"\n      }\n    }\n  }\n}\n```\n\nOr with OAuth credentials:\n\n```json\n{\n  \"mcpServers\": {\n    \"google-docs\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@brdemorin/google-docs-mcp-server\"],\n      \"env\": {\n        \"client_id\": \"your-oauth-client-id\",\n        \"client_secret\": \"your-oauth-client-secret\",\n        \"refresh_token\": \"your-oauth-refresh-token\"\n      }\n    }\n  }\n}\n```\n\n## Available Tools\n\n| Tool Name | Description | Required Parameters |\n|-----------|-------------|---------------------|\n| `google_docs_create` | Create a new Google Doc | `title`, `content` (optional) |\n| `google_docs_update` | Update a Google Doc with new content | `documentId`, `content`, `replaceAll` (optional) |\n| `google_docs_list` | List Google Docs accessible to the authenticated user | `pageSize` (optional), `pageToken` (optional) |\n| `google_docs_delete` | Delete a Google Doc | `documentId` |\n| `google_docs_export` | Export a Google Doc to different formats | `documentId`, `mimeType` (optional) |\n| `google_docs_to_markdown` | Export a Google Doc to Markdown format | `documentId`, `markdownOnly` (optional) |\n| `google_docs_share` | Share a Google Doc with specific users | `documentId`, `emailAddress`, `role` (optional) |\n| `google_docs_search` | Search for Google Docs by title or content | `query`, `pageSize` (optional), `pageToken` (optional) |\n| `google_docs_verify_connection` | Verify connection with Google Docs API | None |\n\n## Example Usage\n\nHere are some examples of how to use the tools:\n\n### Create a new document\n\n```json\n{\n  \"name\": \"google_docs_create\",\n  \"arguments\": {\n    \"title\": \"My New Document\",\n    \"content\": \"This is the content of my new document.\"\n  }\n}\n```\n\n### Export to Markdown\n\n```json\n{\n  \"name\": \"google_docs_to_markdown\",\n  \"arguments\": {\n    \"documentId\": \"1Ax7vsdg3_YhKjkl2P0TZ5XYZ123456\"\n  }\n}\n```\n\n### Update a document\n\n```json\n{\n  \"name\": \"google_docs_update\",\n  \"arguments\": {\n    \"documentId\": \"1Ax7vsdg3_YhKjkl2P0TZ5XYZ123456\",\n    \"content\": \"This is the new content.\",\n    \"replaceAll\": true\n  }\n}\n```\n\n### Search for documents\n\n```json\n{\n  \"name\": \"google_docs_search\",\n  \"arguments\": {\n    \"query\": \"meeting notes\",\n    \"pageSize\": 5\n  }\n}\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}