Skip to content

feat: make MCP server agent-agnostic#288

Open
GauravSharmaCode wants to merge 1 commit intogemini-cli-extensions:mainfrom
GauravSharmaCode:main
Open

feat: make MCP server agent-agnostic#288
GauravSharmaCode wants to merge 1 commit intogemini-cli-extensions:mainfrom
GauravSharmaCode:main

Conversation

@GauravSharmaCode
Copy link

Summary

This PR makes the Google Workspace MCP server compatible with any MCP-capable AI agent, not just Gemini CLI.

Changes

  • MCP Resources: Added \workspace://context\ and \workspace://skills/*\ resources to the server so resource-capable agents (Claude Desktop, Cline, etc.) can load behavioral guidance on demand
  • Agent instruction files: \CLAUDE.md, .clinerules, .windsurfrules, .cursor/rules/google-workspace.md, .github/copilot-instructions.md\
  • **\AGENT-CONTEXT.md**: Consolidated behavioral guide for non-Gemini agents (no Gemini-specific refs)
  • MCP client configs: .copilot/mcp-config.json\ (GitHub Copilot CLI), .vscode/mcp.json\ (VS Code Copilot)
  • **\docs/mcp-clients.md**: Step-by-step setup guide for Claude Desktop, VS Code Copilot, Cursor, Cline, Continue.dev, and Windsurf
  • README: Updated to mention MCP compatibility and link to client setup guide
  • Tests: Added
    esources.test.ts\ for MCP resource path resolution

What is NOT changed

  • \gemini-extension.json, \commands/, \skills/, \WORKSPACE-Context.md, \GEMINI.md\ — full Gemini CLI backward compatibility maintained

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

@google-cla
Copy link

google-cla bot commented Mar 23, 2026

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
Copy link
Contributor

Summary of Changes

Hello, 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

  • MCP Resources: Implemented workspace://context and workspace://skills/* resources to provide behavioral guidance to compatible AI agents.
  • Agent-Specific Instructions: Introduced dedicated instruction files for various agents, including Claude, Cursor, Cline, Windsurf, and GitHub Copilot.
  • Consolidated Behavioral Guide: Created AGENT-CONTEXT.md as a central, non-Gemini-specific behavioral guide.
  • Client Configurations: Added configuration files for GitHub Copilot CLI and VS Code Copilot to enable MCP server integration.
  • Comprehensive Documentation: Developed docs/mcp-clients.md with step-by-step setup guides for multiple MCP-capable agents.
  • Updated README: Modified the main README to highlight MCP compatibility and direct users to the new client setup guide.
  • Resource Resolution Tests: Added new tests to ensure correct resolution of MCP resource paths.

🧠 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 Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

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

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 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.

"google-workspace": {
"type": "stdio",
"command": "node",
"args": ["workspace-server/dist/index.js"]
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

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"]
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

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"].

{
uri: uri.href,
mimeType: 'text/markdown',
text: readFileSync(contextFilePath, 'utf-8'),
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

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.

Suggested change
text: readFileSync(contextFilePath, 'utf-8'),
text: await readFile(contextFilePath, 'utf-8'),

{
uri: uri.href,
mimeType: 'text/markdown',
text: readFileSync(capturedPath, 'utf-8'),
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

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.

Suggested change
text: readFileSync(capturedPath, 'utf-8'),
text: await readFile(capturedPath, 'utf-8'),

@GauravSharmaCode
Copy link
Author

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

Choose a reason for hiding this comment

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

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'

Choose a reason for hiding this comment

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

Suggested change
node scripts/auth-utils.js login
npm run auth-utils
node scripts/auth-utils.js login

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.

2 participants