NAME

MCP::Server::KnowledgeStore - MCP server for shared memories, skills, specs, and agents

VERSION

version 0.001

SYNOPSIS

MCP_KS_PG=postgresql://mcp_ks@db/mcp_ks \
MCP_KS_TOKEN=secret \
  ./bin/mcp-ks daemon -l 'http://*:3000'

# then, from any MCP client
https://mcp-memory.internal.lan/mcp

DESCRIPTION

A Mojolicious application exposing one shared memory/skills store over MCP, so every agent on the network reads and writes the same data instead of keeping its own copy. See SPEC.md for the problem it solves.

Entries live in Postgres and are append-only: each save adds a revision rather than replacing one, so the history SPEC.md expected from git survives the move into the database.

Callers are agents, authenticated by a named token (see MCP::Server::KnowledgeStore::Command::token) and nothing more - no accounts, no sessions. A token's name is recorded as the author of everything it writes.

This is a bare Mojolicious application - no UI, no templates. An admin interface over the same store, if one gets built, is a separate project talking to this one over MCP like any other agent, not something bolted onto this app's base class.

CONFIGURATION

Environment variables win over mcp-ks.conf.

MCP_KS_PG / pg

Postgres connection string for the shared store. Required.

MCP_KS_TOKEN / token

A bootstrap bearer token, accepted in addition to the tokens in the database. It exists to reach a fresh deployment before any token has been minted; it cannot be revoked without a redeploy, so drop it once token add has been run. When unset, only database tokens are accepted.

MCP_KS_NO_MIGRATE

Set to skip running migrations at startup, for when the schema is managed out of band.

MCP_KS_NO_PURGE

Set to a true value (e.g., 1) to disable the purge_* tools across all resource types. When disabled, calls to any purge tool will return an error. This allows deployments to prevent permanent deletion while still allowing archive/restore operations. Archive provides soft deletion that preserves all data and history for audit purposes.

MOJO_LOG_LEVEL

Sets the Mojolicious log threshold. Supported values are trace, debug, info, warn, error, and fatal. The default is trace in development mode and info in other modes.

Successful tool calls are logged at info. Arguments and replies are logged at debug, and raw request and reply envelopes at trace. Unknown tools and requests rejected by the HTTP transport are warn, while tool failures and exceptions are error. fatal remains available for unrecoverable server conditions.

ATTRIBUTES

store

The MCP::Server::KnowledgeStore::Store the tools operate on, built from the configuration above.

mcp_server

The assembled MCP::Server - see MCP::Server::KnowledgeStore::Tools. Exposed so a tool can be registered on it after startup, which is how the test suite verifies token attribution without depending on any resource plugin.

METHODS

startup

Migrates the database, mounts the MCP endpoint at /mcp behind bearer-token authentication, and a /health check that verifies the database is reachable.

SEE ALSO

MCP::Server::KnowledgeStore::Store, MCP::Server::KnowledgeStore::Tools, MCP::Server.

AUTHOR

Wesley Schwengle <waterkip@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2026 by Wesley Schwengle.

This is free software, licensed under:

The (three-clause) BSD License