apps-script-mcp-server
An MCP server that lets Claude read and push Google Apps Script code directly into a script project.
README
apps-script-mcp-server
An MCP server that lets Claude read and push Google Apps Script (.gs, .html,
appsscript.json) code directly into a script project — no more copy-pasting code into
the Apps Script editor by hand.
Built for the Kwara disease surveillance system (KWARAB dashboard), but works with any Apps Script project you have edit access to.
What it can do
| Tool | What it does |
|---|---|
apps_script_get_project_info |
Confirm you're pointed at the right project |
apps_script_get_content |
Read all (or one) file's current source |
apps_script_update_file |
Push/overwrite one file's code (the main "post .gs code" tool) |
apps_script_update_content |
Replace the entire file set atomically |
apps_script_list_versions |
See saved version history |
apps_script_create_version |
Snapshot the current code as a new version |
apps_script_list_deployments |
See existing web app / deployment info |
Important limitation to know up front: pushing code with apps_script_update_file /
apps_script_update_content updates the editable project, the same as typing in the
script editor and saving. It does not automatically update anything already deployed
(e.g. a live web app URL, or triggers bound to a specific deployed version). To go live
with changes, create a version (apps_script_create_version) and then redeploy from the
Apps Script editor — this server doesn't touch deployment publishing, on purpose, since
that's a more consequential action worth doing by hand the first few times.
1. One-time Google Cloud setup (do this first)
You need a Google Cloud project with the Apps Script API enabled and an OAuth client. This takes about 5 minutes.
-
Create or pick a Google Cloud project Go to https://console.cloud.google.com/projectcreate and create a project (any name is fine — e.g. "kwarab-apps-script-mcp"). If you already have a GCP project you use for other Kwara/Ekiti work, you can reuse it.
-
Enable the Apps Script API on the project Go to https://console.cloud.google.com/apis/library/script.googleapis.com, select your project, and click Enable.
-
Configure the OAuth consent screen Go to https://console.cloud.google.com/apis/credentials/consent
- User type: External (unless you have a Google Workspace org, then Internal is fine)
- Fill in app name (e.g. "Apps Script MCP"), your email as support contact
- Scopes: you can skip adding scopes here — the server requests them directly
- Test users: add your own Google account email (required while the app is in "Testing" status, which is fine for personal/internal use)
-
Create an OAuth client Go to https://console.cloud.google.com/apis/credentials
- Click Create Credentials → OAuth client ID
- Application type: Desktop app
- Name it anything (e.g. "Apps Script MCP Desktop")
- Click Create, then Download JSON
-
Save the downloaded file as
credentials.jsonin this project's root folder (same folder as this README). Do not commit or share this file — it identifies your OAuth client (not your personal account, but still keep it private). -
Enable the Apps Script API for your own Google account This is separate from step 2 (that enables the API for the project; this enables it for the Google account that owns/edits the script). Go to https://script.google.com/home/usersettings and turn on "Google Apps Script API".
2. Install and authorize
npm install
npm run build
npm run authorize
npm run authorize opens your browser, asks you to sign in with the Google account that
has access to the Kwara disease surveillance Apps Script project, and asks you to approve
access. After approving, it saves a refresh token to token.json in this folder — you
only need to do this once (re-run it if you ever revoke access or switch Google accounts).
If nothing opens automatically: the terminal will print a URL — copy-paste it into any
browser, approve, and you'll be redirected back to localhost where the script is
listening; the terminal will confirm success.
3. Connect it to Claude
Option A: Local (stdio) — Claude Code / Claude Desktop
Add to your MCP config (e.g. claude_desktop_config.json or your Claude Code MCP settings):
{
"mcpServers": {
"apps-script": {
"command": "node",
"args": ["/absolute/path/to/apps-script-mcp-server/dist/index.js"]
}
}
}
Restart Claude Desktop / Claude Code after adding this. You should see apps-script
listed among connected MCP servers, with tools like apps_script_update_file available.
Option B: Remote (HTTP), e.g. hosted on Render
The server also runs as a standalone HTTP service — set TRANSPORT=http. This is what
render.yaml in this repo configures automatically. See Deploying to Render below.
A remote server is reachable by anyone who has its URL, so every request to /mcp must
include a bearer token matching the MCP_SERVER_TOKEN environment variable you set:
Authorization: Bearer <your MCP_SERVER_TOKEN value>
In Claude's remote MCP connector settings, add the server URL
(https://<your-service>.onrender.com/mcp) and set that header. /healthz is
intentionally unauthenticated so Render's health checks can reach it.
Deploying to Render
This repo includes a render.yaml Blueprint, so Render can create the service with most
settings pre-filled.
- In the Render dashboard: New → Blueprint, connect your GitHub account if you
haven't already, and select this repository. Render will read
render.yaml. - Render will prompt you for the environment variables marked
sync: false:MCP_SERVER_TOKEN— make up a long random string (e.g.openssl rand -hex 32). This is what Claude must send as the bearer token.GOOGLE_OAUTH_CLIENT_ID,GOOGLE_OAUTH_CLIENT_SECRET,GOOGLE_OAUTH_REFRESH_TOKEN— generate these locally first (steps 1–2 above, includingnpm run authorize), then open the resultingtoken.jsonand copyclient_id,client_secret, andrefresh_tokeninto Render's environment variable fields. Render never gets a browser, so this headless-credential path replaces the localnpm run authorizestep.
- Deploy. Once live, the MCP endpoint is
https://<your-service>.onrender.com/mcp. - On the free plan, Render spins the service down after inactivity — the first request after idling will be slow (cold start) while it spins back up.
4. Using it
You'll need the script ID of the Kwara disease surveillance Apps Script project. Find it by opening the project at https://script.google.com, and copying the ID out of the URL:
https://script.google.com/home/projects/<THIS_IS_THE_SCRIPT_ID>/edit
(If the Apps Script is bound to the KWARAB Google Sheet rather than standalone, open the sheet → Extensions → Apps Script to get to the same editor and URL.)
Then, in a Claude conversation with this MCP server connected, you can say things like:
- "Show me the current
Code.gsin script<scriptId>" - "Update the
sendAlertEmailfunction inCode.gsto also CC the DSNO supervisor" - "Push this new
Utils.gsfile with these helper functions: ..." - "Create a new version called 'Add AFP EPID auto-compose logic'"
Security notes
credentials.jsonandtoken.jsonboth grant access to Apps Script projects you can edit. Keep them out of version control (a.gitignoreis included) and don't share them.- The OAuth scopes requested (
script.projects,script.deployments) do not include Gmail, Sheets, or Drive access beyond what's needed to read/write script project content and inspect deployments. - To revoke access at any time: https://myaccount.google.com/permissions → find the OAuth
client name you set in step 4 above → Remove Access. Delete
token.jsonafterward.
Troubleshooting
| Error | Fix |
|---|---|
| "Not authorized yet" | Run npm run authorize |
| 403 permission denied | Confirm the Apps Script API is enabled at script.google.com/home/usersettings for the account you authorized with |
| 404 script not found | Double-check the script ID; confirm the authorized account has at least edit access to that project |
| Browser doesn't open during authorize | Copy the printed URL manually into any browser |
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。