Skip to content

Add --transport flag support (defaults to stdio)#5

Open
sam-at-luther wants to merge 10 commits intomainfrom
add-transport-flag
Open

Add --transport flag support (defaults to stdio)#5
sam-at-luther wants to merge 10 commits intomainfrom
add-transport-flag

Conversation

@sam-at-luther
Copy link
Member

@sam-at-luther sam-at-luther commented Nov 5, 2025

Add support for --transport flag to match Slack MCP server pattern and improve compatibility with supergateway.

Changes

  • Add --transport flag parsing (defaults to stdio)
  • Maintain backward compatibility (stdio is default)
  • Matches pattern used by other MCP servers like Slack
  • Fix OAuth2 client initialization - Initialize with client_id and client_secret from keyfile
  • Improve error handling - Better error messages and logging for Google API errors
  • Fix query syntax - Support both name contains and fullText contains for comprehensive search

Usage

mcp-server-gdrive                    # Use stdio (default)
mcp-server-gdrive --transport stdio  # Use stdio explicitly

Testing

Tested successfully with Google Drive API:

  • OAuth2 authentication working correctly
  • File search by name and full-text content working
  • Error handling provides detailed error messages

This should help with supergateway integration where explicit transport flags are expected.

Add support for --transport flag to match Slack MCP server pattern.
Defaults to stdio transport for compatibility with supergateway.

Usage:
  mcp-server-gdrive                    # Use stdio (default)
  mcp-server-gdrive --transport stdio  # Use stdio explicitly
  mcp-server-gdrive --transport http   # HTTP transport (not yet implemented)
Wrap drive.files.list() in try-catch to properly handle API errors
and return user-friendly error messages instead of internal errors.
Also add validation for required query parameter.
Extract detailed error information from Google API error responses
to provide more helpful error messages to users.
Log full error object to stderr for debugging purposes to help
identify the structure of Google API errors.
Use process.stderr.write instead of console.error to ensure
error details are flushed immediately and appear in container logs.
Handle both string and object error formats from Google API.
Extract error_description and full response data for better debugging.
The 'fullText' query term may not be supported or may require
special permissions. Using 'name contains' which is a standard
Drive API v3 query term for searching file names.
The OAuth2 client must be initialized with client_id and client_secret
from the keyfile, not just setCredentials with token. This fixes the
'Could not determine client ID from request' error.
Now that OAuth2 is properly initialized, fullText contains works.
Using 'name contains' OR 'fullText contains' to search both
file names and file contents.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant