42 lines
1.3 KiB
Markdown
42 lines
1.3 KiB
Markdown
# JavaScript Bridges
|
||
|
||
This folder contains JavaScript helpers that talk to the Kompanion MCP runtime.
|
||
They are intended for quick prototyping – copy the files into a Node.js project
|
||
and adjust them to your local workflow.
|
||
|
||
## Prerequisites
|
||
|
||
* Node.js 18+
|
||
* `kom_mcp` built from this repository (`cmake --build build --target kom_mcp`)
|
||
* Optional: `PG_DSN` environment variable exported so Kompanion can reach your personal database.
|
||
|
||
## Usage
|
||
|
||
1. Install dependencies.
|
||
|
||
```bash
|
||
npm install
|
||
```
|
||
|
||
(The helper only uses built-in Node modules, but this sets up a working package.json.)
|
||
|
||
2. Run the demo to save and recall memory via MCP:
|
||
|
||
```bash
|
||
node demoMemoryExchange.js
|
||
```
|
||
|
||
3. Wire the exported helpers into your own automation. The module exposes
|
||
`saveContext`, `recallContext`, and `searchMemory`, each returning a parsed
|
||
JSON object.
|
||
|
||
## Connecting to the Personal Database
|
||
|
||
The helper shells out to the `kom_mcp` CLI, so all database access flows through
|
||
Kompanion’s DAL. As long as the CLI can reach Postgres (or the in-memory stub),
|
||
JavaScript code automatically benefits from the same storage layer and policy.
|
||
|
||
If you need raw SQL access, you can extend the module with `pg` or any other
|
||
driver – this scaffolding is kept simple on purpose so it works out-of-the-box
|
||
without additional dependencies.
|