MCP Integration

Connect Knowns with AI assistants using Model Context Protocol

MCP Integration

Integrate Knowns with AI assistants for seamless development workflows.

v0.20 consolidates 46 individual MCP tools into 10 domain-grouped tools with action-based dispatch. This reduces context overhead while maintaining full feature parity. The release also adds AI permission guards and MCP audit trails.

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:

JSON
// 1. Detect available projects
project({ action: "detect" })

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

// 3. Check project readiness and capabilities
project({ action: "status" })

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
Kiro.kiro/settings/mcp.jsonYesPer-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

Setup

bash
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 your AI assistant 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)

JSON
{
  "mcpServers": {
    "knowns": {
      "command": "knowns",
      "args": ["mcp"]
    }
  }
}

Kiro: .kiro/settings/mcp.json

JSON
{
  "mcpServers": {
    "knowns": {
      "command": "knowns",
      "args": ["mcp"]
    }
  }
}

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

JSON
{
  "mcpServers": {
    "knowns": {
      "command": "knowns",
      "args": ["mcp"]
    }
  }
}

Note: Antigravity uses global config. Use project({ action: "detect" }) and project({ action: "set" }) at session start.

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

JSON
{
  "mcpServers": {
    "knowns": {
      "command": "knowns",
      "args": ["mcp"]
    }
  }
}

Cursor: .cursor/mcp.json

JSON
{
  "mcpServers": {
    "knowns": {
      "command": "knowns",
      "args": ["mcp"]
    }
  }
}

Continue: .continue/config.json

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

CLI Commands

bash
# 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

Available MCP Tools (v0.20 Consolidated)

In v0.20, tools are grouped by domain with action-based dispatch. Instead of 46 separate tools, there are now 10 domain tools.

Project

ActionDescription
detectScan for Knowns projects
setSet active project
currentGet current project info
statusCheck project readiness and capabilities

Tasks

ActionDescription
listList tasks with filters
getGet task by ID
createCreate task
updateUpdate task (status, AC, plan, notes)
deleteDelete task (dry-run by default)
historyGet version history of a task
boardGet kanban board state

Docs

ActionDescription
listList docs
getGet doc (with smart mode)
createCreate doc
updateUpdate doc
deleteDelete doc (dry-run by default)
historyGet version history of a doc

Memory (Persistent)

ActionDescription
addCreate a memory entry (project or global)
getGet memory entry by ID
listList memories with layer/category/tag
updateUpdate memory entry
deleteDelete memory entry (dry-run by default)
promotePromote up one layer (project → global)
demoteDemote down one layer (global → project)
ActionDescription
searchUnified search (tasks + docs + memories) with semantic
retrieveRanked context retrieval with citations
resolveResolve semantic reference expression

Time

ActionDescription
startStart timer
stopStop timer
addAdd manual time entry
reportGet time report

Templates

ActionDescription
listList templates
getGet template config
runRun template
createCreate template scaffold

Code Intelligence

ActionDescription
searchFind relevant code symbols and nearby code context
symbolsInspect indexed code symbols
depsInspect raw dependency/relationship edges
graphReturn graph data for code-aware exploration

Validation

ToolDescription
validateValidate tasks, docs, templates, memories for broken refs

AI Permission Model (v0.20)

Knowns now includes a capability-based permission system for AI actions:

JSON
// Check permissions via project status
project({ action: "status" })
// Returns: permissions.allowedCapabilities, permissions.deniedCapabilities

Permission presets control what AI agents can do:

  • read-only: Only read operations allowed
  • read-write-no-delete: Read and write, but no deletions (default)
  • full-access: All operations allowed

MCP Audit Trail (v0.20)

All MCP tool calls are now audited with structured events. Use project({ action: "status" }) to check audit capabilities.

Usage

Once configured, your AI assistant can access Knowns data automatically.

Example Conversation

Markdown
You: "Start working on task abc123"

Claude: [Reads task via MCP]
tasks({ action: "get", taskId: "abc123" })

"I see task '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..."

docs({ action: "get", path: "patterns/auth", smart: true })

"Got it! Starting timer and beginning implementation..."

time({ action: "start", taskId: "abc123" })

MCP vs CLI

AspectMCPCLI
SpeedFasterSlower
OutputJSONText
Complex opsFull supportFull support

Recommendation: Use MCP for all operations when available.

Full Feature Parity

FeatureCLIMCP
List taskstask listtasks({ action: "list" })
Get tasktask <id>tasks({ action: "get", taskId })
Create tasktask createtasks({ action: "create", title })
Update statustask edit -stasks({ action: "update", status })
Add AC--actasks({ action: "update", addAc })
Check AC--check-actasks({ action: "update", checkAc })
Set plan--plantasks({ action: "update", plan })
Append notes--append-notestasks({ action: "update", appendNotes })
Time trackingtime start/stoptime({ action: "start/stop" })
List docsdoc listdocs({ action: "list" })
Get docdoc <path>docs({ action: "get", path, smart: true })
Searchsearchsearch({ action: "search", query })
Retrieve contextretrievesearch({ action: "retrieve", query })
Code searchcode searchcode({ action: "search", query })
Code symbolscode symbolscode({ action: "symbols" })
Code depscode depscode({ action: "deps" })
Templatestemplate runtemplates({ action: "run", name })
Memorymemory ...memory({ action: "add/list/update/..." })
Validatevalidatevalidate({ scope: "all" })
Project detectionN/Aproject({ action: "detect" })

Large Document Workflow:

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

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

Example: Full Task Workflow via MCP

JSON
// 0. Session init (required for global MCP configs)
project({ action: "detect" })
project({ action: "set", projectRoot: "/path/to/project" })

// 1. Get task
tasks({ action: "get", taskId: "abc123" })

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

// 3. Start timer
time({ action: "start", taskId: "abc123" })

// 4. Set implementation plan
tasks({ action: "update", taskId: "abc123", plan: "1. Research\n2. Implement\n3. Test" })

// 5. Check AC after completing
tasks({ action: "update", taskId: "abc123", checkAc: [1] })

// 6. Append progress notes
tasks({ action: "update", taskId: "abc123", appendNotes: "✓ Completed: login feature" })

// 7. Stop timer
time({ action: "stop", taskId: "abc123" })

// 8. Mark done
tasks({ action: "update", 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

bash
# Check project is initialized
knowns init

# For global configs, use session init
project({ action: "detect" })
project({ action: "set", projectRoot: "/path" })

Tools not appearing

bash
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:

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

Then paste into any AI assistant.

Resources