A reference implementation of an MCP server for Google Tasks, built with the Go MCP SDK.
The server itself does not perform any authentication. It expects an upstream
gateway to authenticate the user and forward a Google OAuth access token (with the
Google Tasks scope) in the standard Authorization: Bearer <token> header. The token
is passed straight through to the Google Tasks API.
| Tool | Description |
|---|---|
search |
Search for tasks by title or notes |
list |
List all tasks across all task lists |
create |
Create a new task |
update |
Update an existing task |
delete |
Delete a task |
clear |
Clear completed tasks from a task list |
| URI Pattern | Description |
|---|---|
gtasks:///{taskId} |
Read detailed task information |
MCP Client ──► Auth Gateway ──► MCP Server ──► Google Tasks API
(issues (forwards
Google Bearer
access token)
token)
The gateway is responsible for the entire OAuth flow, token storage, and refresh. This server only:
- Reads the
Authorization: Bearer <token>header. - Returns
401 Unauthorizedif the header is missing. - Uses the token as a Google OAuth access token when calling the Tasks API.
If Google rejects the token (expired, wrong scope, etc.), the corresponding tool call fails with the error returned by Google.
| Endpoint | Method | Description |
|---|---|---|
/mcp |
POST | MCP Streamable HTTP (requires Bearer access token) |
| Variable | Required | Default | Description |
|---|---|---|---|
PORT |
No | 8080 |
HTTP server port |
go run .docker run --rm -p 8080:8080 \
ghcr.io/agentic-layer/mcp-server-gtasks:latest{
"mcpServers": {
"gtasks": {
"url": "http://localhost:8080/mcp",
"headers": {
"Authorization": "Bearer <google-access-token>"
}
}
}
}In production the gateway injects the Authorization header on behalf of the client.
The token must be a Google OAuth access token with the
https://www.googleapis.com/auth/tasks scope. Pick whichever option is most convenient.
- Open https://developers.google.com/oauthplayground/.
- In Step 1, find Tasks API v1 and select
https://www.googleapis.com/auth/tasks. Click Authorize APIs and complete the Google sign-in. - In Step 2, click Exchange authorization code for tokens.
- Copy the Access token value. It is valid for ~1 hour.
Requires a Google Cloud SDK install and a Google account.
gcloud auth application-default login \
--scopes=https://www.googleapis.com/auth/tasks,openid
gcloud auth application-default print-access-tokenThe printed token is a short-lived Google access token you can pass to the server.
TOKEN="<paste-token-here>"
# Verify the token has the Tasks scope.
curl -s "https://www.googleapis.com/oauth2/v3/tokeninfo?access_token=$TOKEN"
# Hit the MCP endpoint.
curl -i -X POST http://localhost:8080/mcp \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'