gdocs-mcp 0.5.2 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +18 -15
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -37,7 +37,7 @@ import { DeleteHeaderFooterSchema, deleteHeaderFooter } from './tools/delete-hea
37
37
  import { CreateFootnoteSchema, createFootnote } from './tools/create-footnote.js';
38
38
  import { WriteTableSchema, writeTable } from './tools/write-table.js';
39
39
  import { UpdateTableStyleSchema, updateTableStyle } from './tools/update-table-style.js';
40
- const VERSION = '0.5.2';
40
+ const VERSION = '0.5.3';
41
41
  const QUIET = process.env.GDOCS_MCP_QUIET === '1';
42
42
  const server = new McpServer({
43
43
  name: 'gdocs-mcp',
@@ -45,23 +45,26 @@ const server = new McpServer({
45
45
  });
46
46
  function formatError(err) {
47
47
  if (err instanceof Error) {
48
- const message = err.message;
49
- if (message.includes('404') || (message.includes('not found') && !message.includes('Preset') && !message.includes('preset'))) {
50
- return 'Document not found. Check the document ID and ensure it is shared with your account.';
48
+ // Google API errors carry response.status (GaxiosError shape)
49
+ const status = err.response?.status;
50
+ if (typeof status === 'number') {
51
+ if (status === 404)
52
+ return 'Document not found. Check the document ID and ensure it is shared with your account.';
53
+ if (status === 401)
54
+ return 'Auth expired. Run: npx gdocs-mcp auth';
55
+ if (status === 429)
56
+ return 'Google API quota exceeded. Wait 60 seconds and retry.';
57
+ if (status === 403)
58
+ return 'Permission denied. Ensure the document is shared with your Google account.';
59
+ if (status >= 500)
60
+ return `Google API error (${status}). Retry in a few seconds.`;
51
61
  }
52
- if (message.includes('UNAUTHENTICATED') || message.includes('invalid_grant')) {
53
- return 'Auth expired. Run: npx gdocs-mcp auth';
54
- }
55
- if (message.includes('RATE_LIMIT') || message.includes('429')) {
56
- return 'Google API quota exceeded. Wait 60 seconds and retry.';
57
- }
58
- if (message.includes('PERMISSION_DENIED') || message.includes('403')) {
59
- return 'Permission denied. Ensure the document is shared with your Google account.';
60
- }
61
- if (message.includes('Apps Script API has not been used')) {
62
+ // Apps Script specific (no status code from this API)
63
+ if (err.message.includes('Apps Script API has not been used')) {
62
64
  return 'Apps Script API is not enabled. Enable it at: https://console.cloud.google.com/apis/library/script.googleapis.com';
63
65
  }
64
- return message;
66
+ // All other errors: pass through unchanged
67
+ return err.message;
65
68
  }
66
69
  return String(err);
67
70
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gdocs-mcp",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "Open-source MCP server for Google Docs and Sheets. Self-hosted, local OAuth, no third-party token storage.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",