mbarnett2011/google-drive-credentials-mcp
If you are the rightful owner of google-drive-credentials-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
The Google Drive Credentials MCP Server is a tool designed to automate the creation and management of Google Drive API credentials, including OAuth 2.0 clients, API keys, and service accounts.
Google Drive Credentials MCP Server
An MCP (Model Context Protocol) server that provides automated tools for creating and managing Google Drive API credentials, including OAuth 2.0 clients, API keys, and service accounts.
🚀 Features
- OAuth 2.0 Client Creation: Generate web application credentials for frontend JavaScript
- API Key Management: Create restricted API keys for Google Drive API access
- Service Account Setup: Create service accounts for server-side applications
- Project Configuration: Enable required APIs and configure Google Cloud projects
- JavaScript Config Generation: Generate ready-to-use JavaScript configuration files
📦 Installation
Prerequisites
- Node.js 18+
- Google Cloud CLI (
gcloud) installed and authenticated - Google Cloud project with billing enabled
Install Dependencies
cd google-drive-credentials-mcp
npm install
Build the Server
npm run build
Authentication Setup
# Authenticate with Google Cloud
gcloud auth application-default login
# Set your project
gcloud config set project YOUR_PROJECT_ID
🔧 Configuration
Claude Desktop Integration
Add to your Claude Desktop configuration file (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"google-drive-credentials": {
"command": "node",
"args": ["/path/to/google-drive-credentials-mcp/dist/index.js"],
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "/path/to/your/service-account-key.json"
}
}
}
}
🛠️ Available Tools
1. create_oauth_client
Create OAuth 2.0 client credentials for web applications.
Parameters:
projectId(required): Google Cloud project IDclientName: Display name for the OAuth clientauthorizedOrigins: JavaScript origins for your web appredirectUris: OAuth redirect URIs
Example:
{
"projectId": "my-project-123",
"clientName": "My Drive App",
"authorizedOrigins": ["http://localhost:3000", "https://myapp.com"],
"redirectUris": ["https://myapp.com/auth/callback"]
}
2. create_api_key
Create API key for Google Drive API with browser restrictions.
Parameters:
projectId(required): Google Cloud project IDdisplayName: Display name for the API keyallowedReferrers: HTTP referrers allowed to use the key
Example:
{
"projectId": "my-project-123",
"displayName": "Drive API Key",
"allowedReferrers": ["https://myapp.com/*"]
}
3. create_service_account
Create service account for server-side Google Drive API access.
Parameters:
projectId(required): Google Cloud project IDaccountId(required): Unique service account identifierdisplayName: Display name for the service accountcreateKey: Whether to create and return a service account key
Example:
{
"projectId": "my-project-123",
"accountId": "drive-service-bot",
"displayName": "Drive Service Account",
"createKey": true
}
4. setup_project
Enable required APIs and configure Google Cloud project.
Parameters:
projectId(required): Google Cloud project IDenableApis: List of APIs to enable
Example:
{
"projectId": "my-project-123",
"enableApis": [
"drive.googleapis.com",
"apikeys.googleapis.com",
"iam.googleapis.com"
]
}
5. generate_js_config
Generate JavaScript configuration file for Google Drive integration.
Parameters:
clientId(required): OAuth 2.0 client IDapiKey(required): API key for Drive APIprojectId(required): Google Cloud project IDscopes: OAuth scopes required
Example:
{
"clientId": "123456789.apps.googleusercontent.com",
"apiKey": "AIza...",
"projectId": "my-project-123",
"scopes": ["https://www.googleapis.com/auth/drive"]
}
🎯 Quick Start Workflow
-
Set up your project:
setup_project with projectId: "your-project-id" -
Create OAuth credentials:
create_oauth_client with projectId: "your-project-id", clientName: "My Drive App" -
Create API key:
create_api_key with projectId: "your-project-id", displayName: "Drive API Key" -
Generate JavaScript config:
generate_js_config with clientId: "your-client-id", apiKey: "your-api-key", projectId: "your-project-id" -
Test your integration using the generated HTML and JavaScript files
📚 Usage Examples
Frontend JavaScript Integration
The MCP server generates complete JavaScript configurations:
// Generated configuration
const CLIENT_ID = 'your-client-id.apps.googleusercontent.com';
const API_KEY = 'your-api-key';
// OAuth authentication
function handleAuthClick() {
tokenClient.requestAccessToken({prompt: 'consent'});
}
// Load Drive files
async function loadDriveFiles() {
const response = await gapi.client.drive.files.list({
pageSize: 100,
fields: 'files(id, name, mimeType, size, modifiedTime)'
});
console.log('Files:', response.result.files);
}
Server-side Service Account
from google.oauth2 import service_account
from googleapiclient.discovery import build
# Use generated service account key
credentials = service_account.Credentials.from_service_account_file(
'service-account-key.json',
scopes=['https://www.googleapis.com/auth/drive']
)
drive = build('drive', 'v3', credentials=credentials)
🔒 Security Best Practices
- OAuth Client ID: Safe for frontend JavaScript when properly configured
- API Keys: Restrict to specific referrers and APIs only
- Service Account Keys: Never commit to version control, use secure storage
- HTTPS: Required for production OAuth flows
- Monitoring: Regular usage monitoring in Google Cloud Console
🐛 Troubleshooting
Common Issues
Authentication Errors:
- Ensure
gcloud auth application-default loginis completed - Verify billing is enabled on your Google Cloud project
- Check that required APIs are enabled
Permission Errors:
- Ensure you have Project Editor or Owner role
- Some operations may require manual steps in Google Cloud Console
CORS Errors:
- Verify authorized origins match your development/production domains
- Use proper HTTP/HTTPS protocols
Getting Help
- Check the generated instructions in each tool's output
- Review Google Cloud Console for API quotas and errors
- Use
npm run inspectto test tools interactively
📄 License
MIT License - see LICENSE file for details.
🤝 Contributing
Contributions welcome! Please read our contributing guidelines and submit pull requests for any improvements.
Built with ❤️ for the MCP ecosystem