Library Reference

Knot provides several libraries in the knot.* namespace for interacting with the platform from scripts.


Available Libraries

Library Description
knot.space Space management operations
knot.ai AI completion functions
knot.mcp MCP tool interaction
knot.skill Skills management
knot.template Template management
knot.volume Volume management
knot.user User management
knot.group Group management
knot.role Role management
knot.vars Variables management
knot.permission Permission checking

Usage

Import libraries using standard Python import syntax:

import knot.space as space
import knot.ai as ai
import knot.mcp as mcp

# Use the libraries
spaces = space.list()
client = ai.Client()
tools = mcp.list_tools()

Environment Compatibility

All knot.* libraries are available in all environments, but the implementation differs:

Library Local MCP Remote
knot.space API Internal API API
knot.ai API MCP Server API
knot.mcp API Tools Special API Tools
knot.skill API API API
knot.template API API API
knot.volume API API API
knot.user API API API
knot.group API API API
knot.role API API API
knot.vars API API API
knot.permission API API API
  • API: Uses HTTP API calls to the server
  • Internal: Uses internal Go function calls (no network)
  • MCP Server: Connects directly to the upstream AI provider
  • Special: Has access to MCP tool parameters and context

Authentication

Scripts automatically authenticate using the context they’re running in:

  • Local: Uses the configured API token from ~/.knot/config
  • Remote: Uses the space’s agent token
  • MCP: Uses the internal context (no explicit token needed)