feat: make MCP server agent-agnostic#288
feat: make MCP server agent-agnostic#288GauravSharmaCode wants to merge 1 commit intogemini-cli-extensions:mainfrom
Conversation
|
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. |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the Google Workspace MCP server by making it compatible with a wider range of AI agents beyond just Gemini CLI. It achieves this by exposing behavioral guidance as MCP resources, providing agent-specific instruction files, and offering detailed client configuration documentation. The changes aim to broaden the server's utility and simplify its integration with various development environments and AI tools. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request is a great step towards making the MCP server agent-agnostic. The addition of configuration files for various agents, a consolidated behavioral guide, and extensive documentation is very thorough. My review focuses on a few areas for improvement. I've pointed out that the checked-in agent configuration files use fragile relative paths, which could cause issues for other developers. I've also identified a performance issue in index.ts where synchronous file I/O is used in async handlers, which could block the event loop, and I've provided suggestions to use asynchronous methods instead.
.copilot/mcp-config.json
Outdated
| "google-workspace": { | ||
| "type": "stdio", | ||
| "command": "node", | ||
| "args": ["workspace-server/dist/index.js"] |
There was a problem hiding this comment.
Using a relative path workspace-server/dist/index.js in a checked-in configuration file is problematic. Its resolution depends on the working directory of the Copilot CLI and may not work for all contributors. The project's documentation in docs/mcp-clients.md recommends an absolute path for reliability, which is not suitable for a shared configuration file. Please consider a more robust way to configure this path for different developer setups.
.vscode/mcp.json
Outdated
| "google-workspace": { | ||
| "type": "stdio", | ||
| "command": "node", | ||
| "args": ["workspace-server/dist/index.js"] |
There was a problem hiding this comment.
Using a relative path workspace-server/dist/index.js in a checked-in workspace configuration file is problematic. Its resolution depends on the environment and may not work for all contributors. The project's documentation in docs/mcp-clients.md recommends an absolute path for reliability, which is not suitable for a shared configuration file. Please consider using VS Code's ${workspaceFolder} variable if the MCP extension supports it, e.g., "args": ["${workspaceFolder}/workspace-server/dist/index.js"].
workspace-server/src/index.ts
Outdated
| { | ||
| uri: uri.href, | ||
| mimeType: 'text/markdown', | ||
| text: readFileSync(contextFilePath, 'utf-8'), |
There was a problem hiding this comment.
Using readFileSync here is a synchronous, blocking I/O operation. Since this is inside an async resource handler, it will block the Node.js event loop when this resource is requested, which can degrade server performance. Please use the asynchronous readFile from node:fs/promises instead. You will need to update the imports at the top of the file accordingly.
| text: readFileSync(contextFilePath, 'utf-8'), | |
| text: await readFile(contextFilePath, 'utf-8'), |
workspace-server/src/index.ts
Outdated
| { | ||
| uri: uri.href, | ||
| mimeType: 'text/markdown', | ||
| text: readFileSync(capturedPath, 'utf-8'), |
There was a problem hiding this comment.
Similar to the other resource handler, using readFileSync here is a synchronous, blocking I/O operation that can degrade server performance by blocking the event loop. Please use the asynchronous await readFile(...) from node:fs/promises instead.
| text: readFileSync(capturedPath, 'utf-8'), | |
| text: await readFile(capturedPath, 'utf-8'), |
|
Hi Maintainers, I have signed the CLA. Please review the PR, let me know if you would like me to make any changes to this! |
Add MCP resources and cross-agent guidance so non-Gemini clients can load behavioral context on demand, document client setup across common editors/CLIs, and remove checked-in MCP config files while using async resource file reads for better portability and runtime behavior. Made-with: Cursor
| ``` | ||
| 3. **Authenticate with Google:** | ||
| ```bash | ||
| node scripts/auth-utils.js login |
There was a problem hiding this comment.
This step doesn't seem to work:
~/gemini-cli-extensions_workspace$ node --version
v24.14.0
~/gemini-cli-extensions_workspace$ git status
On branch GauravSharmaCode/main
nothing to commit, working tree clean
~/gemini-cli-extensions_workspace$ node scripts/auth-utils.js login
node:internal/modules/cjs/loader:1459
throw err;
^
Error: Cannot find module '../workspace-server/dist/auth-utils.js'
There was a problem hiding this comment.
| node scripts/auth-utils.js login | |
| npm run auth-utils | |
| node scripts/auth-utils.js login |
Summary
This PR makes the Google Workspace MCP server compatible with any MCP-capable AI agent, not just Gemini CLI.
Changes
esources.test.ts\ for MCP resource path resolution
What is NOT changed
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com