Skip to main content
Glama
hung301203

Obsidian & Google Drive MCP Server

by hung301203

Obsidian & Google Drive MCP Server πŸš€

TypeScript Model Context Protocol Node.js License: MIT

An All-in-One remote Model Context Protocol (MCP) server that connects Google Gemini Web, Claude Desktop, Cursor, and other AI clients directly to your Obsidian Vault and personal Google Drive.

Built with dual-transport support (Streamable HTTP + Legacy SSE), RFC 8414 OAuth 2.0 Discovery, and an intelligent Safe File Adoption Engine.


✨ Features

  • 🌐 Dual Protocol Support:

    • Streamable HTTP (MCP 2025 Standard): Direct POST, GET, and DELETE requests with session management for Gemini Web Connected Apps.

    • Legacy SSE: Server-Sent Events with /messages transport for Claude Desktop, Cursor, and older MCP clients.

  • πŸ” OAuth 2.0 Discovery (RFC 8414 & OpenID Connect):

    • Automated discovery endpoints (/.well-known/oauth-authorization-server, /.well-known/openid-configuration, /oauth/authorize, /oauth/token).

    • Seamless authentication handshake without custom plugin configuration.

  • πŸ“ Dual-Token Architecture:

    • Remotely-Save Token (drive.file scope): Reads and writes Obsidian Markdown notes cleanly within your vault directory, ensuring zero sync conflicts with the Obsidian Remotely-Save plugin.

    • Personal Google Drive Token (drive scope): Searches and reads any document, spreadsheet, or file across your entire personal Google Drive.

  • πŸ›‘οΈ Safe File Adoption Engine:

    • Automatically identifies files uploaded manually to Google Drive and converts them so the Obsidian Remotely-Save plugin recognizes and syncs them to your devices.

    • Built-in Mutex locks and streaming memory bounds prevent race conditions and out-of-memory errors.


Related MCP server: Obsidian MCP Server

πŸ› οΈ MCP Tools Included

Tool Name

Scope

Description

obsidian_list_vault

Remotely-Save Vault

Recursively lists all markdown notes and directories inside your Obsidian Vault.

obsidian_read_note

Remotely-Save Vault

Reads the full Markdown content of a specific note (e.g., Inbox/Ideas.md).

obsidian_write_note

Remotely-Save Vault

Creates, overwrites, or appends (append) content to a note in your vault.

obsidian_adopt_manual_files

Dual Scope

Scans and safely adopts manually uploaded Drive files into Obsidian-compatible notes.

gdrive_search_all

Full Google Drive

Searches files and documents across your entire Google Drive by query or name.

gdrive_read_document

Full Google Drive

Reads Google Docs, Sheets, text, or Markdown files from anywhere on Google Drive.


πŸ”‘ Prerequisites: Getting the Obsidian Remotely-Save Token

To enable bidirectional sync between this MCP server and your Obsidian Vault without sync conflicts, this server integrates directly with the remotely-save plugin:

  1. Install Remotely-Save in Obsidian:

    • Open Obsidian β†’ Settings β†’ Community plugins.

    • Search for Remotely Save (GitHub repository) and click Install then Enable.

  2. Authenticate with Google Drive:

    • In Remotely Save settings, select Google Drive as the sync provider.

    • Click Authenticate and complete the Google login to grant permission to your vault directory.

    • Run a manual sync once. Remotely Save will save the token in your vault at .obsidian/plugins/remotely-save/data.json.

  3. Token Usage Modes:

    • Local Mode (Zero-Config):
      If running this server on the same machine as your Obsidian Vault, the server automatically discovers and decodes the token from ~/Documents/<VAULT_NAME>/.obsidian/plugins/remotely-save/data.json. You don't need to copy any tokens!

    • Cloud Mode (Render.com / Docker):
      If deploying to the cloud, run this helper command on your local machine to extract your credentials:

      npm run export:remotely-save

      Then copy the output (OBSIDIAN_CLIENT_ID, OBSIDIAN_CLIENT_SECRET, OBSIDIAN_REFRESH_TOKEN) into your Render Environment Variables or .env file.


πŸš€ Quick Start

1. Clone & Install Dependencies

git clone https://github.com/hung301203/obsidian-gdrive-mcp.git
cd obsidian-gdrive-mcp
npm install

2. Configure Environment Variables

Copy the sample environment file:

cp .env.example .env

Edit .env with your settings:

PORT=3000
MCP_API_KEY=your_secret_mcp_api_key_here
VAULT_FOLDER_NAME=your_obsidian_vault_folder_name # e.g. MyVault or Personal_Notes

# Full Google Drive OAuth credentials (optional for full drive search)
FULL_DRIVE_CLIENT_ID=your_client_id
FULL_DRIVE_CLIENT_SECRET=your_client_secret
FULL_DRIVE_REFRESH_TOKEN=your_refresh_token

Tip: If running locally on a machine with Obsidian installed, the server automatically detects and decodes the Remotely-Save OAuth token from:
~/Documents/<VAULT_NAME>/.obsidian/plugins/remotely-save/data.json

3. Build & Run

# Build TypeScript
npm run build

# Start server
npm start

☁️ Cloud Deployment (Render.com)

Deploy free 24/7 on Render:

  1. Fork or push this repository to your GitHub account.

  2. In Render Dashboard, click New + β†’ Blueprint and connect your repository.

  3. Render will read render.yaml automatically.

  4. Fill in the environment variables when prompted (MCP_API_KEY, VAULT_FOLDER_NAME, etc.).

  5. Once deployed, your public MCP server URL will be:

    https://<your-subdomain>.onrender.com/mcp/<MCP_API_KEY>/sse

πŸ”Œ Connecting to AI Clients

1. Google Gemini Web (gemini.google.com)

  1. Open Gemini Web β†’ Settings β†’ Connected Apps (or click + Custom).

  2. Under MCP server URL, enter:

    https://<your-subdomain>.onrender.com/mcp/<MCP_API_KEY>/sse
  3. Leave Client ID and Client secret blank (the API key is already authenticated in the URL).

  4. Click Connect / Next. Gemini will connect via Streamable HTTP and expose all 6 tools.

2. Claude Desktop

Add the following to your claude_desktop_config.json:

{
  "mcpServers": {
    "obsidian-gdrive": {
      "url": "https://<your-domain>.onrender.com/mcp/<MCP_API_KEY>/sse"
    }
  }
}

3. Cursor & Windsurf

In Cursor/Windsurf MCP Settings:

  • Type: sse

  • URL: https://<your-domain>.onrender.com/mcp/<MCP_API_KEY>/sse


🐳 Docker Deployment

Run with Docker Compose:

docker compose up -d --build

πŸ§ͺ Testing

The test suite covers unit tests, memory limits, SSE heartbeats, and Streamable HTTP protocol compatibility:

npm test

πŸ“„ License

This project is open-source software licensed under the MIT License.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Exposes a folder of Markdown notes (Obsidian vault or plain .md files) to LLM clients like Claude and ChatGPT via Streamable HTTP, with tools for searching, reading, writing, and managing notes directly on the filesystem.
    1,602 npm
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables AI clients like Claude, ChatGPT, and Cursor to search, read, and write back to one cross-model Markdown library of saved articles, videos, PDFs, notes, and conversations. Hosted remote server with OAuth 2.1 or Agent-key auth and read_only, edit, or full permission tiers.
    MIT