Integrations
Enables reading, creating, updating, and searching Google Docs documents through the Google Docs API, allowing AI agents to manipulate document content programmatically.
Facilitates interaction with Google Drive for document management, including search functionality and authorization for accessing Google Docs content.
Google Docs MCP Server
This project provides an MCP (Model Context Protocol) server that works with the Google Docs API. It implements an interface for manipulating Google Docs using generative AI.
function
This MCP server provides the following features:
- Read Google Docs documents
- Create a new Google Docs document
- Updating an existing Google Docs document
- Searching Google Docs documents
Technology stack
- Node.js (v14 or higher recommended)
- TypeScript
- @modelcontextprotocol/sdk - Official implementation of the MCP SDK
- Google APIs Node.js Client - Access to Google APIs
Prerequisites
- Node.js (v14 or higher recommended)
- npm or yarn
- Google Cloud Platform project and access credentials
set up
1. Clone or download the project
2. Install dependencies
3. Google Cloud Platform Settings
- Create a project in the Google Cloud Console (or choose an existing project)
- Enable Google Drive API and Google Docs API
- Create an OAuth 2.0 client ID and download credentials
- Place the downloaded credentials file as
credentials.json
in the project root.
4. Preferences
- Create a
.env
file in your project root and set your environment variables there:
Explanation of environment variables:
NODE_ENV
: The application's execution environment (development, production, test)LOG_LEVEL
: Log detail level (ERROR, WARN, INFO, DEBUG, TRACE)LOG_USE_STDERR
: Whether to output logs to standard error output (MCP specification uses standard error output)SERVER_NAME
: MCP server nameSERVER_VERSION
: MCP server versionCREDENTIALS_PATH
: Path to the Google API credentials fileTOKEN_PATH
: Path to store authentication token
- Start the development server and get a token:After execution, an authorization URL will be displayed in the terminal. Access that URL in your browser and log in with your Google account to perform authorization. Copy the authorization code that is displayed after authorization is complete, paste it into the terminal, and press Enter. This operation will generate aCopy
token.json
file, and authentication will be performed automatically from then on.
Build and run
Build
execution
Run as a regular server:
Running in development mode:
Use as an MCP server
This project is a server that complies with the Model Context Protocol (MCP) specification. You can connect to it directly from MCP clients (Cursor, Claude.ai, etc.).
Settings on the MCP client
Setting with Cursor
To use it with Cursor, add the following setting to .cursor/mcp.json
file:
Other MCP clients
Other MCP clients communicate using standard input/output (stdio), so specify the appropriate command depending on your client's configuration.
MCP Tools Provided
read_google_document
Read the contents of a Google Docs document.
Parameters :
documentId
(string): The ID of the Google Docs document to read.
Example usage :
create_google_document
Create a new Google Docs document.
Parameters :
title
(string): The title of the new document.content
(string, optional): The initial content of the document.
Example usage :
update_google_document
Update an existing Google Docs document.
Parameters :
documentId
(string): The ID of the Google Docs document to update.content
(string): The content to add or update.startPosition
(number, optional): The position to start updating.endPosition
(number, optional): The position to end the update at.
Example usage :
search_google_documents
Search for the Google Docs document.
Parameters :
query
(string): The search query.maxResults
(number, optional): The maximum number of results to retrieve (default: 10).
Example usage :
Example of use from a program
Example of using MCP client from TypeScript or JavaScript program:
troubleshooting
If a connection error occurs with Cursor
- Do a full restart of Cursor.
- Please make sure
.cursor/mcp.json
settings are correct. - Manually start the MCP server and check that it works:Verify that when you run this command, you see the message "Google Docs MCP Server started" and that the process continues to run without exiting.Copy
- Check the "MCP Server" section in Cursor's settings and make sure the "google-docs" server is listed.
If you get a Google authentication error
- Make sure the
credentials.json
file is correctly placed in the project root. - If
token.json
file exists, delete it and try authenticating again. - Verify that the Google Drive API and Google Docs API are enabled for your project in the Google Cloud Console.
Extend and Configure
This MCP server is designed with extensibility in mind, allowing you to add new features such as:
src/googleDocsService.ts
- Add new methods to the GoogleDocsService class.src/index.ts
- defines new tools and registers them on the server
Notes
- On first run, you will be prompted for authorization to authenticate with Google. After authorization, a token will be saved to a file and used automatically on subsequent runs.
- Google Cloud Platform charges may apply depending on your usage of the API.
license
This server cannot be installed
local-only server
The server can only run on the client's local machine because it depends on local resources.
A Model Context Protocol server that provides an interface for AI models to interact with Google Docs, enabling reading, creating, updating, and searching Google Documents.
Related MCP Servers
- AsecurityAlicenseAqualityA Model Context Protocol server that enables AI assistants like Claude to interact with Outline document services, supporting document searching, reading, creation, editing, and comment management.Last updated -251PythonMIT License
- AsecurityAlicenseAqualityA Model Context Protocol server that enables AI assistants to interact with Confluence content, supporting operations like retrieving, searching, creating, and updating pages and spaces.Last updated -93TypeScriptMIT License
- AsecurityAlicenseAqualityA Model Context Protocol server implementation that enables AI assistants like Claude to perform Google searches and retrieve web data directly through natural language requests.Last updated -1753TypeScriptMIT License
- -securityAlicense-qualityA Model Context Protocol server that enables AI assistants like Claude to read from, append to, and format text in Google Documents programmatically.Last updated -5TypeScriptMIT License