# Connect KnowMan to Gemini CLI

Client: Gemini CLI

Add KnowMan to [Gemini CLI](https://www.knowman.io/guides/teach-gemini-cli-your-knowledge) as a [local stdio MCP server](https://www.knowman.io/guides/what-is-an-mcp-server) in `settings.json`, using `gemini mcp add` or the config below. [Gemini CLI supports local stdio servers](https://raw.githubusercontent.com/google-gemini/gemini-cli/main/docs/tools/mcp-server.md), and KnowMan's server uses `@knowman/mcp` with Node 22 or newer. [KnowMan's MCP server](https://raw.githubusercontent.com/google-gemini/gemini-cli/main/docs/tools/mcp-server.md) exposes [six tools](https://www.knowman.io/guides/mcp-server-knowledge-base) for searching, asking, reading, saving, [recent items](https://www.knowman.io/guides/personal-knowledge-base), and memories.

## Project settings.json

```json
{
  "mcpServers": {
    "knowman": {
      "command": "npx",
      "args": ["-y", "@knowman/mcp"],
      "env": {
        "KNOWMAN_API_KEY": "km_..."
      }
    }
  }
}
```

## Add the server

Gemini CLI reads MCP server definitions from the `mcpServers` object in `settings.json`. [Gemini CLI MCP documentation](https://raw.githubusercontent.com/google-gemini/gemini-cli/main/docs/tools/mcp-server.md) describes user settings at `~/.gemini/settings.json` and project settings at `.gemini/settings.json`; project scope is the default.

The snippet uses KnowMan's `npx -y @knowman/mcp` command and `KNOWMAN_API_KEY` environment variable. [KnowMan's MCP server](https://raw.githubusercontent.com/google-gemini/gemini-cli/main/docs/tools/mcp-server.md) requires Node 22 or newer and accepts a Bearer key beginning with `km_`.

## Sign in once with knowman login

Instead of placing an API key in the config, run `npx -p @knowman/mcp knowman login` and approve the [browser sign-in](https://www.knowman.io/integrations/continue). [KnowMan's CLI and MCP server](https://www.knowman.io/integrations/claude-code) share the saved credential, so you can then remove the `env` block. [KnowMan MCP setup](https://raw.githubusercontent.com/google-gemini/gemini-cli/main/docs/tools/mcp-server.md)

## Choose user or project settings

Use `gemini mcp add` to add a local server. The `-s` or `--scope` option selects `user` or `project`, and defaults to project. [Gemini CLI MCP documentation](https://raw.githubusercontent.com/google-gemini/gemini-cli/main/docs/tools/mcp-server.md)

For example, `gemini mcp add -e KNOWMAN_API_KEY=km_... knowman npx -y @knowman/mcp` adds environment variables and command arguments using the documented local stdio form. [Gemini CLI MCP documentation](https://raw.githubusercontent.com/google-gemini/gemini-cli/main/docs/tools/mcp-server.md)

## Verify the connection

Start Gemini CLI and use `/mcp` to view configured servers and their connection status. MCP discovery runs when Gemini CLI starts. [Gemini CLI MCP documentation](https://raw.githubusercontent.com/google-gemini/gemini-cli/main/docs/tools/mcp-server.md)

Gemini CLI displays stdio servers as connected only when the [current folder is trusted](https://www.knowman.io/integrations/zed). [Gemini CLI MCP documentation](https://raw.githubusercontent.com/google-gemini/gemini-cli/main/docs/tools/mcp-server.md)

## Use the six KnowMan tools

`kb_search` searches [saved items](https://www.knowman.io/guides/how-to-save-articles) by [keyword or meaning](https://www.knowman.io/guides/ai-knowledge-base). `kb_ask` answers questions with citations. `kb_get_item` retrieves one item's readable content. [KnowMan MCP server](https://raw.githubusercontent.com/google-gemini/gemini-cli/main/docs/tools/mcp-server.md)

`kb_save` saves a URL with an optional note. `kb_recent` lists recent items. `kb_memories` lists saved claims, decisions, and playbooks. [KnowMan MCP server](https://raw.githubusercontent.com/google-gemini/gemini-cli/main/docs/tools/mcp-server.md)

## Questions

### Where does Gemini CLI store the MCP configuration?

User scope uses `~/.gemini/settings.json`, while project scope uses `.gemini/settings.json`. The scope option defaults to project. [Gemini CLI MCP documentation](https://raw.githubusercontent.com/google-gemini/gemini-cli/main/docs/tools/mcp-server.md)

### Do I need to keep the API key in settings.json?

No. Run `npx -p @knowman/mcp knowman login` and approve the browser sign-in. The MCP server shares the saved credential, so the environment block can be removed. [KnowMan MCP setup](https://raw.githubusercontent.com/google-gemini/gemini-cli/main/docs/tools/mcp-server.md)

### Why does Gemini CLI not show the server as connected?

Gemini CLI displays stdio servers as connected only when the current folder is trusted. Its `/mcp` command shows server connection status. [Gemini CLI MCP documentation](https://raw.githubusercontent.com/google-gemini/gemini-cli/main/docs/tools/mcp-server.md)

### What does the KnowMan MCP server provide?

It provides six tools: `kb_search`, `kb_ask`, `kb_get_item`, `kb_save`, `kb_recent`, and `kb_memories`. [KnowMan MCP server](https://raw.githubusercontent.com/google-gemini/gemini-cli/main/docs/tools/mcp-server.md)

## Related pages

- [Connect your knowledge base through KnowMan's MCP server](https://www.knowman.io/guides/mcp-server-knowledge-base)

- [How Do You Connect AI to Your Notes?](https://www.knowman.io/guides/connect-any-ai-to-your-notes)

- [What Is a Knowledge Base for AI Agents?](https://www.knowman.io/guides/knowledge-base-for-ai-agents)

## More in this topic

- [KnowMan MCP server for Hermes Agent](https://www.knowman.io/integrations/hermes)
- [KnowMan MCP server for Goose](https://www.knowman.io/integrations/goose)
- [Add the KnowMan MCP server to Crush](https://www.knowman.io/integrations/crush)

## More for Gemini CLI

- [How to give Gemini CLI better memory](https://www.knowman.io/guides/gemini-cli-memory)
- [How to teach Gemini CLI your knowledge](https://www.knowman.io/guides/teach-gemini-cli-your-knowledge)

## Give Gemini CLI your saved knowledge

Try KnowMan Pro for 14 days with no credit card. [Create your account](https://app.knowman.io/signup)

[Start free](https://app.knowman.io/signup)

Every new account starts with 14 days of Pro. No credit card.

Source: https://www.knowman.io/integrations/gemini-cli
