KnownsDocuments
AI & Agents

MCP Integration

Connect Knowns with AI assistants using Model Context Protocol

MCP Integration

Integrate Knowns with AI assistants for seamless development workflows.

The v0.18 series expands MCP coverage with code-aware tools and stronger retrieval guidance. By v0.18.3, the preferred flow is to use MCP retrieve for structured multi-source context when available, and use CLI only as fallback.

What is MCP?

Model Context Protocol (MCP) is a standard for connecting AI assistants to external tools and data sources. Knowns implements an MCP server that allows AI to read and manage your tasks and documentation directly.

Session Initialization (Critical)

At the START of every MCP session, run these tools to set the project context:

// 1. Detect available projects
mcp__knowns__detect_projects({})

// 2. Set the active project
mcp__knowns__set_project({ "projectRoot": "/path/to/project" })

// 3. Verify project is set
mcp__knowns__get_current_project({})

Why? MCP servers (especially global configs like Antigravity/Gemini) don't know which project to work with. Without setting the project, operations will fail or affect the wrong directory.

Support Matrix

PlatformConfig FileAuto-discoverProject Scope
Claude Code.mcp.json (project)YesPer-project
Antigravity~/.gemini/antigravity/mcp_config.json (global)YesNeeds set_project
Gemini CLI~/.gemini/settings.json (global)YesNeeds set_project
Cursor.cursor/mcp.json (project)ManualPer-project
Cline.cline/mcp.json (project)ManualPer-project
Continue.continue/config.json (project)ManualPer-project

Knowns MCP Server

{
  "command": "npx",
  "args": ["-y", "knowns", "mcp"]
}

Setup

knowns mcp setup

What happens:

  • Creates .mcp.json in your project for Claude Code auto-discovery
  • Registers the Knowns MCP server with the Claude CLI if installed
  • Reminds you to restart Claude Code to load the server

Variations

  • knowns mcp setup --project — only create/update .mcp.json in this project
  • knowns mcp setup --global — only register with Claude Code CLI

Option B: Manual Setup

Platform Configs

Claude Code: .mcp.json (Project-level)

{
  "mcpServers": {
    "knowns": {
      "command": "npx",
      "args": ["-y", "knowns", "mcp"]
    }
  }
}

Antigravity: ~/.gemini/antigravity/mcp_config.json (Global)

{
  "mcpServers": {
    "knowns": {
      "command": "npx",
      "args": ["-y", "knowns", "mcp"]
    }
  }
}

Note: Antigravity uses global config. Use detect_projects and set_project at session start.

Gemini CLI: ~/.gemini/settings.json (Global)

{
  "mcpServers": {
    "knowns": {
      "command": "npx",
      "args": ["-y", "knowns", "mcp"]
    }
  }
}

Cursor: .cursor/mcp.json

{
  "mcpServers": {
    "knowns": {
      "command": "npx",
      "args": ["-y", "knowns", "mcp"]
    }
  }
}

Continue: .continue/config.json

{
  "experimental": {
    "modelContextProtocolServers": [
      {
        "name": "knowns",
        "transport": {
          "type": "stdio",
          "command": "npx",
          "args": ["-y", "knowns", "mcp"]
        }
      }
    ]
  }
}

CLI Commands

# Auto-generate MCP config
knowns mcp setup

# Only create project-level .mcp.json
knowns mcp setup --project

# Only register globally with Claude Code
knowns mcp setup --global

Usage

Once configured, Claude can access your Knowns data automatically.

Example Conversation

You: "Start working on task 42"

Claude: [Reads task via MCP]
"I see task #42 'Add user authentication' with these acceptance criteria:

- User can login with email/password
- JWT token is returned on success
- Invalid credentials return 401

The description references @doc/patterns/auth. Let me check that..."

[Fetches patterns/auth.md via MCP]

"Got it! The auth pattern uses JWT with 15-minute access tokens and
7-day refresh tokens. I'll implement following this pattern.

Starting timer and beginning implementation..."

[Starts time tracking via MCP]

Guidelines for MCP

Sync Instruction Files

# Sync with full embedded MCP guidelines (default)
knowns agents sync --type mcp

# Sync with minimal instruction only
knowns agents sync --type mcp --minimal

# Sync all files
knowns agents sync --type mcp --all

MCP Guideline Tool

AI agents can get modular guidelines on-demand via MCP:

mcp__knowns__get_guideline({})                    # Full guidelines (all sections)
mcp__knowns__get_guideline({ type: "unified" })   # Same as above

Guidelines include these sections:

  • Core Rules - Golden rules, must-follow principles
  • Commands Reference - CLI/MCP commands quick reference
  • Workflow Creation/Execution/Completion - Stage-specific guides
  • Common Mistakes - Anti-patterns and DO vs DON'T

Available MCP Tools

Project Tools (Session Init)

ToolDescription
mcp__knowns__detect_projectsScan for Knowns projects
mcp__knowns__set_projectSet active project
mcp__knowns__get_current_projectGet current project status

Tasks

ToolDescription
mcp__knowns__list_tasksList tasks
mcp__knowns__get_taskGet task
mcp__knowns__create_taskCreate task
mcp__knowns__update_taskUpdate task (status, AC, plan, notes)

Docs

ToolDescription
mcp__knowns__list_docsList docs
mcp__knowns__get_docGet doc (with smart mode)
mcp__knowns__create_docCreate doc
mcp__knowns__update_docUpdate doc

Memory (Persistent)

ToolDescription
mcp__knowns__add_memoryCreate a project or global memory entry
mcp__knowns__get_memoryGet a memory entry by ID
mcp__knowns__list_memoriesList memories with layer/category/tag filter
mcp__knowns__update_memoryUpdate a memory entry
mcp__knowns__delete_memoryDelete a memory entry
mcp__knowns__promote_memoryPromote memory up one layer
mcp__knowns__demote_memoryDemote memory down one layer

Working Memory (Session-Scoped)

ToolDescription
mcp__knowns__add_working_memoryAdd ephemeral session memory
mcp__knowns__get_working_memoryGet working memory entry
mcp__knowns__list_working_memoriesList all working memory entries
mcp__knowns__delete_working_memoryDelete a working memory entry
mcp__knowns__clear_working_memoryClear all working memory for session

Time

ToolDescription
mcp__knowns__start_timeStart timer
mcp__knowns__stop_timeStop timer
mcp__knowns__add_timeAdd manual time entry
mcp__knowns__get_time_reportGet time report

Templates

ToolDescription
mcp__knowns__list_templatesList templates
mcp__knowns__get_templateGet template config
mcp__knowns__run_templateRun template
mcp__knowns__create_templateCreate template scaffold
ToolDescription
mcp__knowns__searchUnified search across tasks, docs, and memories
mcp__knowns__retrieveStructured mixed-source retrieval with context-pack assembly

Code Intelligence

ToolDescription
mcp__knowns__code_searchFind relevant code symbols and nearby code context
mcp__knowns__code_symbolsInspect indexed code symbols
mcp__knowns__code_depsInspect raw dependency/relationship edges
mcp__knowns__code_graphReturn graph data for code-aware exploration

Other

ToolDescription
mcp__knowns__get_boardGet kanban board

MCP vs CLI

AspectMCPCLI
SpeedFasterSlower
OutputJSONText
Complex opsFull supportFull support

Recommendation: Use MCP for all operations when available.

Full Feature Parity

FeatureCLIMCP
List taskstask listlist_tasks
Get tasktask <id>get_task
Create tasktask createcreate_task
Update statustask edit -supdate_task
Add AC--acaddAc
Check AC--check-accheckAc
Set plan--planplan
Set notes--notesnotes
Append notes--append-notesappendNotes
Time trackingtime start/stopstart_time/stop_time
List docsdoc listlist_docs
Get docdoc <path>get_doc
Create docdoc createcreate_doc
Update docdoc editupdate_doc
Searchsearchsearch
Retrieve context packretrieveretrieve
Code searchcode searchcode_search
Code symbolscode symbolscode_symbols
Code depscode depscode_deps
Code graphWeb UI / internal usecode_graph
Templatestemplate runrun_template
Memory (persistent)memory ...add_memory, list_memories, ...
Working memoryN/Aadd_working_memory, list_working_memories, ...
Project detectionN/Adetect_projects

Large Document Workflow:

// Step 1: Use smart mode (recommended) - auto-handles size
{ "path": "readme", "smart": true }
// Small doc → returns full content
// Large doc → returns stats + TOC

// Step 2: Read specific section (if large)
{ "path": "readme", "section": "2" }

// Edit specific section only
{ "path": "readme", "section": "2", "content": "New content" }

Example: Full Task Workflow via MCP

// 0. Session init (required for global MCP configs)
mcp__knowns__detect_projects({})
mcp__knowns__set_project({ "projectRoot": "/path/to/project" })

// 1. Get task
mcp__knowns__get_task({ "taskId": "abc123" })

// 2. Take task
mcp__knowns__update_task({
  "taskId": "abc123",
  "status": "in-progress",
  "assignee": "@me"
})

// 3. Start timer
mcp__knowns__start_time({ "taskId": "abc123" })

// 4. Add acceptance criteria
mcp__knowns__update_task({
  "taskId": "abc123",
  "addAc": ["User can login"]
})

// 5. Set implementation plan
mcp__knowns__update_task({
  "taskId": "abc123",
  "plan": "1. Research\n2. Implement\n3. Test"
})

// 6. Check AC after completing
mcp__knowns__update_task({
  "taskId": "abc123",
  "checkAc": [1]
})

// 7. Append progress notes
mcp__knowns__update_task({
  "taskId": "abc123",
  "appendNotes": "✓ Completed: login feature"
})

// 8. Stop timer
mcp__knowns__stop_time({ "taskId": "abc123" })

// 9. Mark done
mcp__knowns__update_task({
  "taskId": "abc123",
  "status": "done"
})

Benefits

Zero Context Loss

  • AI reads your docs directly - no copy-paste
  • References (@doc/..., @task-42) are resolved automatically
  • Project patterns are always available

Consistent Implementations

  • AI follows your documented patterns every time
  • Same conventions across all sessions
  • No more "how does your auth work?" questions

Perfect Memory

  • Documentation persists between sessions
  • AI can reference any past decision
  • Knowledge doesn't live in chat history

Time Tracking Integration

  • AI can start/stop timers automatically
  • Track time spent on each task
  • Generate reports for retrospectives

Troubleshooting

MCP server not responding

  • Verify installation: knowns --version
  • Run knowns mcp setup again
  • Restart your AI assistant

Project not detected

# Check project is initialized
knowns init

# For global configs, use session init
mcp__knowns__detect_projects({})
mcp__knowns__set_project({ "projectRoot": "/path" })

Tools not appearing

knowns init          # ensure project initialized
knowns mcp --stdio   # start MCP server

Alternative: --plain Output

If MCP is not available, use --plain flag for AI-readable output:

knowns task pdyd2e --plain | pbcopy
knowns doc "auth-pattern" --smart --plain

Then paste into any AI assistant.

Resources

On this page