Google Slides MCP Server
Enables interaction with Google Slides presentations through OAuth2 authentication. Supports creating new slides, adding rectangles, and managing presentation content through natural language commands.
README
Google Slides MCP Server
A Model Context Protocol (MCP) server that provides tools for interacting with Google Slides presentations. This server allows you to create new slides and add rectangles to existing slides.
Features
- Create New Slides: Add blank slides to existing Google Slides presentations
- Add Rectangles: Insert rectangles with dimensions that are 20% of the slide size
- OAuth2 Authentication: Secure authentication flow with Google APIs
- Presentation Management: Get presentation info and list slides
Installation
- Clone or download this repository
- Install dependencies:
npm install
- Build the TypeScript code:
npm run build
Google Cloud Console Setup
Before using this MCP server, you need to set up a Google Cloud project and enable the Google Slides API:
1. Create a Google Cloud Project
- Go to the Google Cloud Console
- Create a new project or select an existing one
- Enable the Google Slides API:
- Go to "APIs & Services" > "Library"
- Search for "Google Slides API"
- Click on it and press "Enable"
2. Create OAuth2 Credentials
- Go to "APIs & Services" > "Credentials"
- Click "Create Credentials" > "OAuth client ID"
- If prompted, configure the OAuth consent screen first:
- Choose "External" user type
- Fill in the required fields (App name, User support email, etc.)
- Add your email to test users
- For the OAuth client ID:
- Choose "Desktop application" as the application type
- Give it a name (e.g., "Google Slides MCP Server")
- Download the credentials JSON file
3. Configure Environment Variables
- Copy
.env.exampleto.env:
cp .env.example .env
- Edit
.envand add your OAuth2 credentials:
GOOGLE_CLIENT_ID=your_client_id_here
GOOGLE_CLIENT_SECRET=your_client_secret_here
GOOGLE_REDIRECT_URI=http://localhost:3000/oauth2callback
Usage
Starting the Server
npm start
Or for development with auto-reload:
npm run dev
Authentication Flow
Before using the Google Slides tools, you need to authenticate:
- Call the
get_auth_urltool to get the OAuth2 authorization URL - Visit the URL in your browser and grant permissions
- Copy the authorization code from the redirect URL
- Call the
authenticatetool with the authorization code
The authentication tokens will be saved locally and reused for future requests.
Available Tools
1. get_auth_url
Get the OAuth2 authorization URL for Google Slides access.
Parameters: None
Example:
{
"name": "get_auth_url",
"arguments": {}
}
2. authenticate
Complete OAuth2 authentication with authorization code.
Parameters:
code(string, required): Authorization code from OAuth2 flow
Example:
{
"name": "authenticate",
"arguments": {
"code": "4/0AX4XfWh..."
}
}
3. create_slide
Create a new slide in a Google Slides presentation.
Parameters:
presentationId(string, required): The ID of the Google Slides presentationinsertionIndex(number, optional): Position where to insert the slide (defaults to 0)
Example:
{
"name": "create_slide",
"arguments": {
"presentationId": "1BxAB07047kHMdtbgoC48KDz3YMgn9_12345678",
"insertionIndex": 1
}
}
4. add_rectangle
Add a rectangle to a slide with 20% of slide dimensions.
Parameters:
presentationId(string, required): The ID of the Google Slides presentationslideId(string, required): The ID of the slide to add the rectangle tox(number, optional): X position of the rectangle (defaults to center)y(number, optional): Y position of the rectangle (defaults to center)width(number, optional): Width of the rectangle (defaults to 20% of slide width)height(number, optional): Height of the rectangle (defaults to 20% of slide height)
Example:
{
"name": "add_rectangle",
"arguments": {
"presentationId": "1BxAB07047kHMdtbgoC48KDz3YMgn9_12345678",
"slideId": "slide_12345"
}
}
5. get_presentation_info
Get information about a Google Slides presentation.
Parameters:
presentationId(string, required): The ID of the Google Slides presentation
Example:
{
"name": "get_presentation_info",
"arguments": {
"presentationId": "1BxAB07047kHMdtbgoC48KDz3YMgn9_12345678"
}
}
6. list_slides
List all slides in a Google Slides presentation.
Parameters:
presentationId(string, required): The ID of the Google Slides presentation
Example:
{
"name": "list_slides",
"arguments": {
"presentationId": "1BxAB07047kHMdtbgoC48KDz3YMgn9_12345678"
}
}
Finding Your Presentation ID
The presentation ID can be found in the Google Slides URL:
https://docs.google.com/presentation/d/PRESENTATION_ID_HERE/edit
For example, in this URL:
https://docs.google.com/presentation/d/1BxAB07047kHMdtbgoC48KDz3YMgn9_abcdefgh/edit
The presentation ID is: 1BxAB07047kHMdtbgoC48KDz3YMgn9_abcdefgh
Common Workflow
-
First time setup:
# Get authorization URL {"name": "get_auth_url", "arguments": {}} # After visiting URL and getting code {"name": "authenticate", "arguments": {"code": "your_auth_code"}} -
Create a new slide:
{"name": "create_slide", "arguments": {"presentationId": "your_presentation_id"}} -
Add a rectangle to the slide:
{"name": "add_rectangle", "arguments": {"presentationId": "your_presentation_id", "slideId": "returned_slide_id"}}
Error Handling
The server provides detailed error messages for common issues:
- Authentication required
- Invalid presentation ID
- Invalid slide ID
- Network connectivity issues
- Google API quota limits
Development
Project Structure
src/
├── index.ts # Main MCP server entry point
├── auth.ts # Google OAuth2 authentication
└── slides.ts # Google Slides API service
dist/ # Compiled JavaScript (after npm run build)
package.json # Project dependencies and scripts
tsconfig.json # TypeScript configuration
.env.example # Environment variables template
Scripts
npm run build- Compile TypeScript to JavaScriptnpm start- Run the compiled servernpm run dev- Run with ts-node for developmentnpm run watch- Watch for changes and recompile
Troubleshooting
Authentication Issues
- Ensure your Google Cloud project has the Google Slides API enabled
- Check that your OAuth2 credentials are correct in the
.envfile - Make sure you're using the correct redirect URI
- Verify that your email is added as a test user if using external OAuth consent
API Errors
- Check that the presentation ID is correct and accessible
- Ensure you have edit permissions for the Google Slides presentation
- Verify that the slide ID exists when adding rectangles
Permission Errors
The server requires the following Google API scopes:
https://www.googleapis.com/auth/presentations- For creating and editing slideshttps://www.googleapis.com/auth/drive.file- For accessing Google Drive files
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。