Skip to content

feat: add server instructions and document MCP timeout configuration#287

Open
64johnlee wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
64johnlee:add-server-instructions-and-timeout-docs
Open

feat: add server instructions and document MCP timeout configuration#287
64johnlee wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
64johnlee:add-server-instructions-and-timeout-docs

Conversation

@64johnlee

Copy link
Copy Markdown

Summary

Addresses two related usability issues:

  • Closes Add support for server instructions #189 — Adds an instructions string to the McpServer initialization in mcp-server.js. MCP clients that support the 2025-06-18 spec will now receive a brief description of the server's capabilities and a heads-up about deployment duration on first connection.

  • Closes Add example of setting MCP timeout #134 — Adds a step 3 under the Node.js setup guide in README.md explaining how to configure a longer MCP client timeout. Cloud Run deployments trigger a Cloud Build that can take several minutes; the default 60-second timeout in some clients (notably Gemini CLI) causes premature disconnects. The README now clarifies that the build continues on GCP even after a disconnect, and shows the Gemini CLI timeout config with a 5-minute value.

Changes

mcp-server.js — Added instructions field to McpServer options:

instructions:
  'Use this server to deploy and manage applications on Google Cloud Run. ' +
  'Available tools: deploy source code or file contents to Cloud Run, list services, ' +
  'get service details, and retrieve service logs. ' +
  'Note: deployments trigger a Cloud Build and can take several minutes to complete.',

README.md — Added optional step 3 under "Using Node.js":

Cloud Run deployments trigger a Cloud Build, which can take several minutes to complete. If your MCP client disconnects with a timeout error before the build finishes, increase the client timeout. The build continues running on GCP even after a client disconnect.

Test plan

  • Run npm run test:local — existing tests should pass unchanged (no logic modified)
  • Run npx @modelcontextprotocol/inspector node mcp-server.js and verify the instructions field appears in the InitializeResult response
  • Review README rendering to confirm the new step reads clearly

@google-cla

google-cla Bot commented Jun 7, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds server instructions to mcp-server.js and documents how to increase the MCP timeout in README.md. The review feedback suggests wrapping the Gemini CLI configuration snippet in the README with the correct "mcpServers" key to ensure it is valid and copy-pasteable.

Comment thread README.md Outdated
Comment on lines +158 to +162
"cloud-run": {
"command": "npx",
"args": ["-y", "@google-cloud/cloud-run-mcp"],
"timeout": 300000
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

In Gemini CLI, the configuration file ~/.gemini/settings.json is a general settings file where MCP servers must be defined under the "mcpServers" key. Providing the configuration without the "mcpServers" wrapper might lead to invalid configurations or the server not being recognized. Wrapping the configuration in "mcpServers" makes it clear and copy-pasteable.

Suggested change
"cloud-run": {
"command": "npx",
"args": ["-y", "@google-cloud/cloud-run-mcp"],
"timeout": 300000
}
{
"mcpServers": {
"cloud-run": {
"command": "npx",
"args": ["-y", "@google-cloud/cloud-run-mcp"],
"timeout": 300000
}
}
}

@64johnlee

Copy link
Copy Markdown
Author

gcla

2 similar comments
@64johnlee

Copy link
Copy Markdown
Author

gcla

@64johnlee

Copy link
Copy Markdown
Author

gcla

Add an instructions string to the McpServer initialization so MCP clients
receive a description of the server's capabilities on connection (MCP spec
2025-06-18 InitializeResult.instructions, closes GoogleCloudPlatform#189).

Add a step to the Node.js setup guide explaining how to configure a longer
MCP client timeout. Cloud Run deployments trigger a Cloud Build that can take
several minutes; the default 60-second timeout in some clients causes
premature disconnects even though the build continues on GCP (closes GoogleCloudPlatform#134).
@64johnlee 64johnlee force-pushed the add-server-instructions-and-timeout-docs branch from 18061cf to 8409c2e Compare June 7, 2026 14:13
@64johnlee

Copy link
Copy Markdown
Author

gcla

Comment thread mcp-server.js
'Use this server to deploy and manage applications on Google Cloud Run. ' +
'Available tools: deploy source code or file contents to Cloud Run, list services, ' +
'get service details, and retrieve service logs. ' +
'Note: deployments trigger a Cloud Build and can take several minutes to complete.',

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The note is not correct any more. We are moving away from Cloud Build for Nodejs and Python for now, and most of the cases down the line.

The note should be removed.

Comment thread README.md

3. [Optional] Increase the MCP timeout

Cloud Run deployments trigger a Cloud Build, which can take several minutes to

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not true today for Nodejs and Python. And, we are going to remove Cloud Build for other languages as well in the near future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for server instructions Add example of setting MCP timeout

2 participants