Knol

Knol Docs

Tenant + OSS Documentation

OSS SDK: MCP

MCP server integration docs for Knol.

Knol MCP Server

A Model Context Protocol (MCP) server for integrating the Knol memory platform with AI coding tools like Claude Code, Cursor, and Windsurf. This allows AI assistants to persistently store and retrieve memories across sessions, building a contextual knowledge graph.

Features

Installation

Prerequisites

Step 1: Build the server

cd /path/to/knol-mcp
npm install
npm run build

The compiled server will be available at dist/index.js.

Configuration

The server reads configuration from environment variables:

Variable Required Default Description
KNOL_API_KEY Yes - Bearer token for Knol API authentication
KNOL_API_URL No http://localhost:8080 Knol API endpoint URL
KNOL_USER_ID No default Default user ID for operations

MCP Tools

knol_remember

Store a memory in Knol.

Parameters:

Example:

{
  "content": "User prefers TypeScript for backend development",
  "session_id": "session-123",
  "metadata": { "category": "preferences", "confidence": 0.95 }
}

knol_search

Search for memories using semantic queries.

Parameters:

Example:

{
  "query": "TypeScript backend preferences",
  "limit": 10,
  "graph_depth": 1
}

knol_get

Retrieve a specific memory by ID.

Parameters:

Example:

{
  "memory_id": "mem-abc123"
}

knol_update

Update an existing memory.

Parameters:

Example:

{
  "memory_id": "mem-abc123",
  "content": "Updated content",
  "importance": 8
}

knol_delete

Delete a memory.

Parameters:

Example:

{
  "memory_id": "mem-abc123"
}

knol_entities

List knowledge graph entities.

Parameters:

Example:

{
  "entity_type": "technology",
  "limit": 50
}

knol_entity_neighbors

Get related entities for a specific entity.

Parameters:

Example:

{
  "entity_id": "ent-typescript",
  "limit": 20
}

MCP Resources

knol://recent

Returns the 10 most recent memories for the configured user.

This resource is automatically available and can be accessed to quickly retrieve recent context.

Integration Guides

Claude Code

Add to your Claude Code configuration file (~/.config/Claude Code/mcp.json or in project settings):

{
  "mcpServers": {
    "knol": {
      "command": "node",
      "args": ["/path/to/knol-mcp/dist/index.js"],
      "env": {
        "KNOL_API_KEY": "your-api-key-here",
        "KNOL_API_URL": "https://api.knol.example.com",
        "KNOL_USER_ID": "your-user-id"
      }
    }
  }
}

Cursor

Add to your Cursor settings (.cursor/settings.json):

{
  "mcpServers": {
    "knol": {
      "command": "node",
      "args": ["/path/to/knol-mcp/dist/index.js"],
      "env": {
        "KNOL_API_KEY": "your-api-key-here",
        "KNOL_API_URL": "https://api.knol.example.com",
        "KNOL_USER_ID": "your-user-id"
      }
    }
  }
}

Windsurf

Add to your Windsurf configuration (.windsurf/mcp.json):

{
  "mcpServers": {
    "knol": {
      "command": "node",
      "args": ["/path/to/knol-mcp/dist/index.js"],
      "env": {
        "KNOL_API_KEY": "your-api-key-here",
        "KNOL_API_URL": "https://api.knol.example.com",
        "KNOL_USER_ID": "your-user-id"
      }
    }
  }
}

Alternative: npm Installation

If published to npm, you can also use the npx shorthand:

{
  "mcpServers": {
    "knol": {
      "command": "npx",
      "args": ["@knol/mcp-server"],
      "env": {
        "KNOL_API_KEY": "your-api-key-here",
        "KNOL_API_URL": "https://api.knol.example.com",
        "KNOL_USER_ID": "your-user-id"
      }
    }
  }
}

Development

Building

npm run build

Watch Mode

npm run dev

Testing

To test the server locally, set up environment variables and run:

export KNOL_API_KEY="test-key"
export KNOL_API_URL="http://localhost:8080"
npm run build
npm start

Architecture

The MCP server is built on the @modelcontextprotocol/sdk and implements:

The server:

  1. Reads configuration from environment variables
  2. Makes authenticated HTTP requests to the Knol API
  3. Exposes tools and resources through the MCP protocol
  4. Returns formatted results to the MCP client

API Reference

For detailed Knol API documentation, see: https://knol.example.com/docs

Endpoints Used

Error Handling

The server handles errors gracefully and returns error messages in the MCP response format. Common errors include:

All errors are returned with an isError: true flag in the MCP response.

Security

Contributing

Contributions are welcome! Please submit pull requests to the Knol repository.

License

MIT License - See LICENSE file for details

Support

For issues, questions, or feature requests, please open an issue on GitHub or contact the Knol team.