Get Started
Integrating the Pieces MCP with Google Gemini CLI brings your workflow context directly into the Gemini command-line agent. Gemini CLI supports stdio, SSE, and Streamable HTTP.
Prerequisites
There are two prerequisites for integrating Pieces with Gemini CLI as an MCP—an active instance of PiecesOS and the fully-enabled Long-Term Memory engine.
Installing PiecesOS & Configuring Permissions
Follow the instructions below for a detailed guide on setting up and configuring PiecesOS to correctly pass captured workflow context to the Pieces MCP server.
Setting Up Google Gemini CLI
Gemini CLI stores its MCP configuration in ~/.gemini/settings.json. Workspace settings override user settings.
Config File Location
| Scope | Path |
|---|---|
| User (global) | ~/.gemini/settings.json |
| Workspace | YOUR_PROJECT/.gemini/settings.json |
Local Setup (Streamable HTTP — recommended)
Edit ~/.gemini/settings.json:
{
"mcpServers": {
"pieces": {
"httpUrl": "http://localhost:39300/model_context_protocol/2025-03-26/mcp",
"timeout": 30000
}
}
}
Local Setup (SSE)
For SSE, use url instead of httpUrl:
{
"mcpServers": {
"pieces": {
"url": "http://localhost:39300/model_context_protocol/2024-11-05/sse",
"timeout": 30000
}
}
}
Using Pieces MCP Server in Gemini CLI
Once integrated, you can utilize Pieces LTM directly in Gemini CLI.
Updating
Edit ~/.gemini/settings.json, update the URL, and start a new Gemini CLI session.
Troubleshooting
If you're experiencing issues integrating Pieces MCP with Gemini CLI:
Verify PiecesOS Status: Ensure PiecesOS is actively running on your system.
HTTP vs SSE Key: Use
httpUrlfor Streamable HTTP,urlfor SSE—they are different fields.Settings File Not Found: Create
~/.gemini/settings.jsonmanually.Tools Not Discovered: Restart Gemini CLI after editing settings.
OAuth Prompt: Pieces does not require OAuth. Dismiss if prompted.
You're now set to enhance your Gemini CLI workflow with powerful context retrieval through Pieces MCP. Happy coding!