FastMCP Sample With GeminiCLI
No description available
Ask AI about FastMCP Sample With GeminiCLI
Powered by Claude · Grounded in docs
I know everything about FastMCP Sample With GeminiCLI. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
MCP + Gemini (Project Demo)
A tiny, ready-to-run MCP server (SQLite) you can use to test Gemini CLI’s MCP integration at project scope.
What it does
-
Spins up a minimal MCP server (stdio) exposing:
- Tool:
run_sql(sql, limit=50)— read-onlySELECTqueries - (Optional) Resource:
schema://sqlite(see schema)
- Tool:
-
Uses a local SQLite DB:
demo.db
Requirements
- Python 3.9+
uvinstalled (pipx install uvor package manager)- Gemini CLI installed and logged in (
gemini --helpworks)
Project structure
.
├── server.py # FastMCP server (stdio)
├── demo.db # sample SQLite DB (auto-created/seeded)
├── pyproject.toml # managed by uv
└── uv.lock
Setup (with uv)
# clone your repo, then:
uv sync
# (optional) pin DB location (defaults to demo.db)
export MCP_SQLITE_PATH=demo.db
Run locally (MCP Inspector - optional)
uv run mcp dev server.py
# opens the Inspector UI; try:
# - Resource: schema://sqlite
# - Tool: run_sql {"sql":"SELECT * FROM users","limit":5}
Add to Gemini CLI at project level
Run these from the project root (so it’s saved to
.gemini/settings.json).
# add the MCP server (stdio) to THIS project
gemini mcp add sqlite-demo uv run server.py -s project \
--description "MCP server to query a local SQLite DB (read-only)."
# verify
gemini mcp list -s project
# (shows: ✓ sqlite-demo: uv run server.py (stdio) - Connected)
Use it in a Gemini chat
gemini
# then in the prompt:
# > Get number of users
Typical commands you’ll run
# run the server standalone (stdio mode)
uv run server.py
# seed/reset demo DB (server creates + seeds on first run)
rm -f demo.db && uv run server.py # then Ctrl+C
# change DB file
export MCP_SQLITE_PATH=/path/to/your.db
Example queries (inside Gemini)
- “List tables in the DB using sqlite-demo.”
- “Get number of users”
Troubleshooting
-
No logs on start (stdio): stdout is used by JSON-RPC. Use
logging(stderr) or the Inspector’s debug view. -
Gemini doesn’t see the server: ensure you added with
-s projectfrom this folder; check.gemini/settings.json. -
uvnot found: use full path or swap topython:# If you ever add Codex later, project-local .codex/config.toml would look like: [mcp_servers.sqlite-demo] command = "python" args = ["server.py"] env = { MCP_SQLITE_PATH = "demo.db" } -
Port expectations: this demo uses stdio (no port). If you need HTTP:
# server.py (switch transport) if __name__ == "__main__": mcp.run(transport="streamable-http")Then register with Gemini using
-t httpand a URL (requires mounting into an HTTP app).
Notes
- The tool only allows
SELECT(safe read-only). - Rename tools and server for multi-DB setups (e.g.,
Users DB,Orders DB) and give each a clear--description.
License
This project is licensed under the MIT License – see the LICENSE file for details.
