Khwan — Claude Code MCP server: memory and setup
Khwan carries useful project facts into later sessions and subagents. Use it when an agent needs decisions or task context from earlier work.
claude mcp add --env KHWAN_API_KEY=<KHWAN_API_KEY> --env KHWAN_CORE=<KHWAN_CORE> --env KHWAN_USER=<KHWAN_USER> --env KHWAN_BASE_URL=<KHWAN_BASE_URL> --transport stdio khwan -- uvx khwan-mcpWhat Khwan does
Khwan gives an MCP client a persistent store for distilled facts. An agent can look up relevant context with khwan_recall and save a durable decision with khwan_remember; a later session gets a compact set of facts rather than an old conversation replay. KHWAN_CORE and KHWAN_USER let you separate memories across projects and subagents.
It does not cut token use inside a live session: MCP memory is added to the context the host already sends. For Claude Code, the suggested pattern is to retrieve memory at the start, then save lasting facts as they come up instead of repeating the loop every turn. The HTTP setup command is below. Local uvx setup needs KHWAN_API_KEY, so keep the secret out of a project config that may be committed.
What it helps with
- retrieve a decision from an earlier session
- give a subagent a concise task brief
- save a durable project fact or preference
- keep project and subagent memories separate
Example prompts for the agent
- Use
khwan_recallto retrieve deployment decisions relevant to this task. - Save this lasting project decision with
khwan_remember. - Look up the task context with
khwan_recalland pass it to a subagent.
How to install Khwan
1Platform CLI
claude mcp add --env KHWAN_API_KEY=<KHWAN_API_KEY> --env KHWAN_CORE=<KHWAN_CORE> --env KHWAN_USER=<KHWAN_USER> --env KHWAN_BASE_URL=<KHWAN_BASE_URL> --transport stdio khwan -- uvx khwan-mcpReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from khwan-mcp <command>
2Platform CLI: remote server
claude mcp add --transport http khwan-mcp https://mcp.khwan.ai/mcp/{core}/{user}1Platform CLI
codex mcp add khwan --env KHWAN_API_KEY=<KHWAN_API_KEY> --env KHWAN_CORE=<KHWAN_CORE> --env KHWAN_USER=<KHWAN_USER> --env KHWAN_BASE_URL=<KHWAN_BASE_URL> -- uvx khwan-mcpReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from khwan-mcp <command>
2Platform CLI: remote server
codex mcp add khwan --url https://mcp.khwan.ai/mcp/{core}/{user}1Config file
{
"mcpServers": {
"khwan": {
"command": "uvx",
"args": [
"khwan-mcp"
],
"env": {
"KHWAN_API_KEY": "<KHWAN_API_KEY>",
"KHWAN_CORE": "<KHWAN_CORE>",
"KHWAN_USER": "<KHWAN_USER>",
"KHWAN_BASE_URL": "<KHWAN_BASE_URL>"
}
}
}
}Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from khwan-mcp <command>
2Config file
{
"mcpServers": {
"khwan": {
"url": "https://mcp.khwan.ai/mcp/{core}/{user}"
}
}
}1Config file
{
"servers": {
"khwan": {
"type": "stdio",
"command": "uvx",
"args": [
"khwan-mcp"
],
"env": {
"KHWAN_API_KEY": "<KHWAN_API_KEY>",
"KHWAN_CORE": "<KHWAN_CORE>",
"KHWAN_USER": "<KHWAN_USER>",
"KHWAN_BASE_URL": "<KHWAN_BASE_URL>"
}
}
}
}Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from khwan-mcp <command>
2Config file
{
"servers": {
"khwan": {
"type": "http",
"url": "https://mcp.khwan.ai/mcp/{core}/{user}"
}
}
}1Platform CLI
gemini mcp add -e KHWAN_API_KEY=<KHWAN_API_KEY> -e KHWAN_CORE=<KHWAN_CORE> -e KHWAN_USER=<KHWAN_USER> -e KHWAN_BASE_URL=<KHWAN_BASE_URL> khwan uvx khwan-mcpReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from khwan-mcp <command>
2Platform CLI: remote server
gemini mcp add -t http khwan https://mcp.khwan.ai/mcp/{core}/{user}Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about Khwan
How do I install Khwan in Claude Code?
Connect the server over HTTP with claude mcp add --transport http khwan https://mcp.khwan.ai/mcp/{core}/{user}.
What does Khwan do?
It stores distilled facts between sessions and lets an agent retrieve them later. A subagent can receive a compact task context instead of an old conversation.
Does Khwan reduce token use during a live session?
No. The host still sends its existing context, and MCP memory adds to it. In Claude Code, retrieve memory at the start and save durable facts as they emerge.