KosmoKrator

productivity

Google Docs MCP Integration for LangChain

Connect Google Docs to LangChain through the local KosmoKrator MCP gateway with scoped tools, credentials, and write policy.

7 functions 5 read 2 write Manual OAuth token auth

Connect Google Docs to LangChain

Bridge LangChain agents to local KosmoKrator integration tools through MCP or headless CLI calls.

Use the MCP gateway when the agent should discover tools, or wrap kosmo integrations:call for fixed chains. The gateway is local, scoped to this integration, and starts with --write=deny so LangChain can inspect read-capable tools without receiving write access by default.

Google Docs MCP Config for LangChain

Keep the gateway scoped to the integration and operation class needed by the chain.

{
  "mcpServers": {
    "kosmokrator-google-docs": {
      "type": "stdio",
      "command": "kosmo",
      "args": [
        "mcp:serve",
        "--integration=google-docs",
        "--write=deny"
      ]
    }
  }
}

Run the Gateway Manually

kosmokrator mcp:serve --integration=google-docs --write=deny

Why Use KosmoKrator Here

Scoped tools

Expose only Google Docs instead of a broad multi-service tool list.

Local credentials

Reuse credentials already configured for the KosmoKrator CLI and Lua runtime.

Write policy

Start read-only, then opt into ask or allow for trusted workspaces.

Google Docs Tools Visible to LangChain

LangChain sees stable MCP tool names generated from the Google Docs integration catalog.

MCP toolSource functionTypeDescription
integration__google_docs__gdocs_list_documents google-docs.gdocs_list_documents Read List Google Docs documents visible to the authenticated user. Returns document IDs, names, owners, and modification times. Supports pagination and custom Drive API query filters.
integration__google_docs__gdocs_get_document google-docs.gdocs_get_document Read Get the full content and structure of a Google Docs document by its ID. Returns the document title, body content (paragraphs, text runs), and styling information.
integration__google_docs__gdocs_create_document google-docs.gdocs_create_document Write Create a new Google Docs document with a given title. Returns the document ID and a link to edit the document in the browser.
integration__google_docs__gdocs_batch_update google-docs.gdocs_batch_update Write Send batch update requests to a Google Docs document. Supports inserting text, updating text styles, creating paragraphs, and other document modifications. Each request in the array is a Google Docs API request object.
integration__google_docs__gdocs_list_permissions google-docs.gdocs_list_permissions Read List all permissions (sharing settings) for a Google Docs document. Returns who has access, their roles (owner, writer, reader), and their email addresses.
integration__google_docs__gdocs_get_permission google-docs.gdocs_get_permission Read Get details of a specific permission for a Google Docs document. Returns the permission type, role, and email address for a single permission entry.
integration__google_docs__gdocs_get_current_user google-docs.gdocs_get_current_user Read Get the authenticated Google user's profile information. Returns user ID, email address, display name, and profile picture URL. Use this to verify which Google account is being used.

Related Google Docs Pages