# KnowMan MCP server for OpenCode

Client: opencode

Add KnowMan to OpenCode as a [local MCP server](https://www.knowman.io/guides/what-is-an-mcp-server) with `opencode mcp add knowman --env KNOWMAN_API_KEY=km_... -- npx -y @knowman/mcp`. OpenCode starts local servers over MCP stdio, according to its [MCP server documentation](https://opencode.ai/docs/mcp-servers/). KnowMan's package and MCP server details are documented in the [KnowMan MCP guide](https://www.knowman.io/guides/mcp-server-knowledge-base).

## opencode.jsonc

```jsonc
{
  "mcp": {
    "servers": {
      "knowman": {
        "type": "local",
        "command": ["npx", "-y", "@knowman/mcp"]
      }
    }
  }
}
```

## Add KnowMan from the terminal

Run `opencode mcp add knowman --env KNOWMAN_API_KEY=km_... -- npx -y @knowman/mcp`. OpenCode places the command after `--`, passes the environment variable, and writes the server to the project configuration. Add `--global` if you want it available in every project. See [OpenCode MCP server documentation](https://opencode.ai/docs/mcp-servers/).

## Use the OpenCode config file

You can also add the server by hand under `mcp.servers` in `opencode.jsonc`. OpenCode V2 does not place server names directly under `mcp`. A local server uses `"type": "local"` and a `command` array containing the executable followed by its arguments. See [OpenCode MCP server documentation](https://opencode.ai/docs/mcp-servers/).

## Sign in once with knowman login

Run `npx -p @knowman/mcp knowman login` once. The browser sign-in saves a credential shared by the KnowMan CLI and MCP server. After that, you can remove the `KNOWMAN_API_KEY` entry from the OpenCode configuration. See the [KnowMan MCP guide](https://www.knowman.io/guides/mcp-server-knowledge-base).

## Verify the OpenCode connection

Run `opencode mcp list` from any project. Look for `✓ knowman connected`. OpenCode connects servers automatically. If the entry says `needs authentication`, open OpenCode, run `/mcps`, select the server, and [sign in](https://www.knowman.io/guides/personal-knowledge-base). See [OpenCode MCP server documentation](https://opencode.ai/docs/mcp-servers/).

## Search your KnowMan library

`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) and returns titles, URLs, and metadata. `kb_ask` answers questions with citations. These tools let OpenCode work with [saved articles and links](https://www.knowman.io/guides/connect-any-ai-to-your-notes) in your KnowMan library. See the [KnowMan MCP guide](https://www.knowman.io/guides/mcp-server-knowledge-base).

## Read and save library items

`kb_get_item` returns the readable content and metadata for one item. `kb_save` saves a URL to the Inbox or Knowledge Base, with an optional note. Together, they let OpenCode retrieve full items and add new links. See the [KnowMan MCP guide](https://www.knowman.io/guides/mcp-server-knowledge-base).

## Review recent items and memories

`kb_recent` lists recently saved Inbox or Knowledge Base items. `kb_memories` lists saved claims, decisions, and playbooks. These tools give OpenCode access to recent library activity and [stored working knowledge](https://www.knowman.io/guides/ai-agent-memory). See the [KnowMan MCP guide](https://www.knowman.io/guides/mcp-server-knowledge-base).

## Questions

### Does OpenCode support the KnowMan MCP server?

Yes. OpenCode starts local servers over the MCP stdio transport. The KnowMan package is a local stdio MCP server. See [OpenCode MCP server documentation](https://opencode.ai/docs/mcp-servers/) and the [KnowMan MCP guide](https://www.knowman.io/guides/mcp-server-knowledge-base).

### Do I need an API key in the OpenCode config?

You can use `KNOWMAN_API_KEY=km_...` with the OpenCode add command. After running `npx -p @knowman/mcp knowman login`, the saved credential can be used without that environment variable. See the [KnowMan MCP guide](https://www.knowman.io/guides/mcp-server-knowledge-base).

### How do I check whether KnowMan is connected?

Run `opencode mcp list` and look for `✓ knowman connected`. Use `/mcps` inside OpenCode to view, connect, disconnect, or authenticate servers. See [OpenCode MCP server documentation](https://opencode.ai/docs/mcp-servers/).

### Which tools does KnowMan expose to OpenCode?

KnowMan exposes six tools: `kb_search`, `kb_ask`, `kb_get_item`, `kb_save`, `kb_recent`, and `kb_memories`. They cover search, cited answers, item reading, URL saving, recent items, and saved memories. See the [KnowMan MCP guide](https://www.knowman.io/guides/mcp-server-knowledge-base).

## Related pages

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

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

- [Persistent Memory for AI Agents](https://www.knowman.io/guides/persistent-memory-for-ai-agents)

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

- [What is a personal knowledge base, and how do you build one?](https://www.knowman.io/guides/personal-knowledge-base)

## More in this topic

- [KnowMan MCP server for Qwen Code](https://www.knowman.io/integrations/qwen-code)
- [KnowMan MCP server for Warp](https://www.knowman.io/integrations/warp)
- [Add the KnowMan MCP server to Grok Build](https://www.knowman.io/integrations/grok)

## More for opencode

- [How to give opencode context with AGENTS.md](https://www.knowman.io/guides/opencode-memory)
- [How to teach opencode your knowledge](https://www.knowman.io/guides/teach-opencode-your-knowledge)

## Give OpenCode access to your library

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/opencode
