This post was generated by an AI agent from an article the account owner published in Japanese on note. The wording is not human-written.
A project that built an MCP server letting Claude Code create, read, write, format, and share Google Sheets directly ran into a practical snag once it was in daily use: any fine-tuning after the AI generated something still required switching to a browser. Fixing a bit of wording, or checking formatting after a spec change, meant opening the spreadsheet in a browser, finding the right cell, editing it, and switching back to VSCode. That back-and-forth became the next problem to solve.
The setup for this second project:
- Previous output:
@beatmaster/google-sheets-mcp(npm package) - New output:
google-sheets-preview(VSCode extension) - Claude Code (VSCode extension)
- Node.js v18
- OS: Windows 11
- TypeScript
First attempt: a new MCP tool
The first idea was to add a sheets_preview tool to the existing MCP server. The approach was simple: fetch the spreadsheet's data and formatting, generate an HTML file, and open it automatically in a browser. To keep token usage down, the HTML itself was never sent back to Claude — only the file path was returned, with a message saying the preview had been shown.
After implementing it and publishing the update, the result was underwhelming. It still opened a browser, so the back-and-forth with VSCode didn't go away. If anything, the sequence now felt longer: call the MCP tool, wait for the browser to open, check the result, switch back to VSCode. That made it clear the approach itself was wrong at a fundamental level.
Switching to a VSCode extension
The actual goal was viewing the spreadsheet inside VSCode. An MCP server gives an AI new tools to call, but it has no way to control VSCode's own UI — the editor panes, panels, and so on. MCP communicates over stdio, standard input/output, so there's no mechanism for drawing anything on screen.
Showing a spreadsheet inside VSCode required VSCode's "Webview Panel" feature, which only a VSCode extension can use. That meant building a separate extension from scratch, apart from the MCP server. Development shifted to this new extension.
What got built
The extension pulls all data and formatting from the Google Sheets API and renders it as an HTML table inside a VSCode webview.
Viewing features:
- Background color, text color, bold, italic, and font size rendering
- Borders (solid, thick, dashed, dotted, double)
- Merged cell display
- Column width and row height
- Row numbers (1, 2, 3…) and column headers (A, B, C…)
- Sheet tab switching
Editing features:
- Double-click a cell to edit its value directly
- Edits sync to Google Sheets in real time
- Toolbar controls for bold, text color, background color, borders, and alignment
- Undo/redo support
Sheet management:
- Add, copy, delete, and rename sheet tabs
- Create a new spreadsheet
Three ways to open a preview were added: pressing Ctrl+Shift+G and entering a URL, running "Google Sheets: Open Preview" from the command palette, or selecting a spreadsheet URL in the editor and right-clicking it.
Slow tab switching
Switching sheet tabs triggered a new Google Sheets API request every time, causing a few seconds of lag. The fix was caching loaded sheet data in memory: after the first load, switching tabs shows the cached version immediately while the latest data is fetched in the background.
Build problems, again
The Dropbox file-locking issue from the earlier MCP server build showed up again: compiling TypeScript inside a Dropbox-synced folder produced an EBUSY error. The same workaround applied — copy the project to a temporary folder, build there, and copy only the output back.
A separate issue came from vsce, the VSCode extension packaging tool, which turned out to be incompatible with Node.js v18 and errored out at runtime. The fix was to build the VSIX package (the extension's packaging format) manually instead of relying on vsce.
Claude integration via URI handler
To connect the extension back to Claude, VSCode's URI handler feature was used — a mechanism where a specific URI scheme automatically launches the extension. When Claude runs a command like:
vscode://beatmaster.google-sheets-preview/open?spreadsheetId=XXX&gid=YYY the preview opens directly inside VSCode. The gid parameter in the URL is used to automatically select the right sheet tab, so the correct sheet opens immediately.
Results
What ended up working: formatted spreadsheet previews inside VSCode, direct cell editing without leaving VSCode, no more switching to a browser, and automatic preview display just by telling Claude which spreadsheet to open.
Two things remain unresolved: the initial load is still slow, since the first API call takes a few seconds, and chart rendering is difficult because of limitations in the Sheets API.
The project clarified how the two tools divide labor. An MCP server exists to give an AI new tools to call. A VSCode extension exists to let a human see the result visually. Only with both in place does a full loop — the AI acting, and a human checking the outcome by eye — stay entirely inside VSCode.
The MCP server package from the earlier project is available at https://www.npmjs.com/package/@beatmaster/google-sheets-mcp.
Follow @kmrb_works here on DEV for more field notes from real development work. Also on X and note, mostly in Japanese.