MCP Server Integration

Extend Gemini CLI with Model Context Protocol (MCP) servers to access external tools and services.

Understanding MCP

Model Context Protocol (MCP) allows Gemini CLI to connect with external services and tools:

  • • File system operations
  • • Database queries
  • • Web API interactions
  • • Development tool integration
  • • Custom business logic

Quick Setup

1. Install MCP Server

npm install -g @modelcontextprotocol/server-filesystem

2. Configure Gemini CLI

gemini mcp add filesystem npx @modelcontextprotocol/server-filesystem ./

3. Test Integration

gemini "List the files in my project directory"

Popular MCP Servers

Filesystem Server

Read, write, and search files and directories

@modelcontextprotocol/server-filesystem

Git Server

Git repository operations and version control

@modelcontextprotocol/server-git

SQLite Server

Database queries and data manipulation

@modelcontextprotocol/server-sqlite

Web Fetch Server

HTTP requests and web scraping

@modelcontextprotocol/server-fetch

Advanced Configuration

Manual Configuration

Edit your config file directly:

{ "mcpServers": { "filesystem": { "command": "npx", "args": ["@modelcontextprotocol/server-filesystem", "/path/to/workspace"] }, "git": { "command": "npx", "args": ["@modelcontextprotocol/server-git", "."] } } }

Common Issues

Server not starting

Check if the MCP server package is installed and the path is correct.

Permission denied

Ensure the MCP server has proper file system permissions.

Explore MCP Servers

Discover more MCP servers and integration options: