@jsondb-cloud/mcp 1.0.17 → 1.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 SIA Billy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -82,11 +82,14 @@ Add to `.cursor/mcp.json`:
82
82
 
83
83
  ### Environment Variables
84
84
 
85
- | Variable | Required | Default | Description |
86
- | ----------------- | -------- | -------------------------- | ------------------------------------------------ |
87
- | `JSONDB_API_KEY` | Yes | — | API key (`jdb_sk_live_...` or `jdb_sk_test_...`) |
88
- | `JSONDB_PROJECT` | No | `v1` | Project namespace |
89
- | `JSONDB_BASE_URL` | No | `https://api.jsondb.cloud` | API base URL |
85
+ | Variable | Required | Default | Description |
86
+ | ---------------------- | -------- | -------------------------- | --------------------------------------------------- |
87
+ | `JSONDB_API_KEY` | Yes | — | API key (`jdb_sk_live_...` or `jdb_sk_test_...`) |
88
+ | `JSONDB_PROJECT` | No | `v1` | Project namespace |
89
+ | `JSONDB_BASE_URL` | No | `https://api.jsondb.cloud` | API base URL |
90
+ | `JSONDB_MCP_TRANSPORT` | No | `stdio` | Transport type: `stdio` or `http` |
91
+ | `JSONDB_MCP_PORT` | No | `3100` | HTTP server port (only used with `http` transport) |
92
+ | `JSONDB_MCP_HOST` | No | `127.0.0.1` | HTTP bind address (only used with `http` transport) |
90
93
 
91
94
  ## Tools
92
95
 
@@ -141,6 +144,34 @@ Add to `.cursor/mcp.json`:
141
144
  | `delete_webhook` | Delete a webhook |
142
145
  | `test_webhook` | Send a test event to verify delivery |
143
146
 
147
+ ### Vectors
148
+
149
+ | Tool | Description |
150
+ | ---------------------- | --------------------------------------------------------------------------------- |
151
+ | `semantic_search` | Search documents using natural language semantic similarity with relevance scores |
152
+ | `store_with_embedding` | Store a document and auto-generate a vector embedding for semantic search |
153
+
154
+ Embeddings are generated **asynchronously by the jsondb.cloud backend** using **Ollama** (`nomic-embed-text`, 768 dimensions). The MCP server delegates to the REST API — no local embedding model or API key is needed.
155
+
156
+ ## HTTP Transport
157
+
158
+ By default the server uses **stdio** transport (for Claude Desktop, Cursor, etc.). To run as an HTTP server instead, set:
159
+
160
+ ```bash
161
+ JSONDB_MCP_TRANSPORT=http JSONDB_API_KEY=jdb_sk_live_... npx @jsondb-cloud/mcp
162
+ ```
163
+
164
+ This starts a stateless Streamable HTTP server that creates a fresh `McpServer` + transport per request (no session affinity required). Endpoints:
165
+
166
+ | Method | Path | Description |
167
+ | -------- | --------- | ---------------------------------------- |
168
+ | `POST` | `/mcp` | MCP JSON-RPC requests |
169
+ | `GET` | `/mcp` | SSE stream for server notifications |
170
+ | `DELETE` | `/mcp` | Session termination |
171
+ | `GET` | `/health` | Health check (returns `{"status":"ok"}`) |
172
+
173
+ Configure the host and port with `JSONDB_MCP_HOST` and `JSONDB_MCP_PORT` (defaults: `127.0.0.1:3100`).
174
+
144
175
  ## Documentation
145
176
 
146
177
  Full documentation at [jsondb.cloud/docs](https://jsondb.cloud/docs).
package/dist/index.js CHANGED
@@ -1493,17 +1493,17 @@ async function main() {
1493
1493
  project,
1494
1494
  baseUrl
1495
1495
  });
1496
- const server = new import_mcp2.McpServer({
1497
- name: "jsondb-cloud",
1498
- version: "1.0.0"
1499
- });
1500
- registerDocumentTools(server, db);
1501
- registerCollectionTools(server, db);
1502
- registerSchemaTools(server, db);
1503
- registerVersionTools(server, db);
1504
- registerWebhookTools(server, db);
1505
- registerVectorTools(server, db);
1506
- registerCollectionResources(server, db);
1496
+ function createServer() {
1497
+ const s = new import_mcp2.McpServer({ name: "jsondb-cloud", version: "1.0.0" });
1498
+ registerDocumentTools(s, db);
1499
+ registerCollectionTools(s, db);
1500
+ registerSchemaTools(s, db);
1501
+ registerVersionTools(s, db);
1502
+ registerWebhookTools(s, db);
1503
+ registerVectorTools(s, db);
1504
+ registerCollectionResources(s, db);
1505
+ return s;
1506
+ }
1507
1507
  const transportType = process.env.JSONDB_MCP_TRANSPORT || "stdio";
1508
1508
  if (transportType === "http") {
1509
1509
  const port = parseInt(process.env.JSONDB_MCP_PORT || "3100", 10);
@@ -1514,25 +1514,16 @@ async function main() {
1514
1514
  res.end(JSON.stringify({ status: "ok" }));
1515
1515
  return;
1516
1516
  }
1517
- if (req.method === "POST" && req.url === "/mcp") {
1518
- const transport = new import_streamableHttp.StreamableHTTPServerTransport({
1519
- sessionIdGenerator: void 0
1520
- });
1521
- await server.connect(transport);
1522
- await transport.handleRequest(req, res);
1523
- return;
1524
- }
1525
- if (req.method === "GET" && req.url === "/mcp") {
1517
+ if (req.url === "/mcp") {
1518
+ const server = createServer();
1526
1519
  const transport = new import_streamableHttp.StreamableHTTPServerTransport({
1527
1520
  sessionIdGenerator: void 0
1528
1521
  });
1529
- await server.connect(transport);
1530
- await transport.handleRequest(req, res);
1531
- return;
1532
- }
1533
- if (req.method === "DELETE" && req.url === "/mcp") {
1534
- const transport = new import_streamableHttp.StreamableHTTPServerTransport({
1535
- sessionIdGenerator: void 0
1522
+ res.on("close", () => {
1523
+ transport.close().catch(() => {
1524
+ });
1525
+ server.close().catch(() => {
1526
+ });
1536
1527
  });
1537
1528
  await server.connect(transport);
1538
1529
  await transport.handleRequest(req, res);
@@ -1545,6 +1536,7 @@ async function main() {
1545
1536
  console.error(`MCP HTTP server listening on ${host}:${port}`);
1546
1537
  });
1547
1538
  } else {
1539
+ const server = createServer();
1548
1540
  const transport = new import_stdio.StdioServerTransport();
1549
1541
  await server.connect(transport);
1550
1542
  }
package/dist/index.mjs CHANGED
@@ -1469,17 +1469,17 @@ async function main() {
1469
1469
  project,
1470
1470
  baseUrl
1471
1471
  });
1472
- const server = new McpServer2({
1473
- name: "jsondb-cloud",
1474
- version: "1.0.0"
1475
- });
1476
- registerDocumentTools(server, db);
1477
- registerCollectionTools(server, db);
1478
- registerSchemaTools(server, db);
1479
- registerVersionTools(server, db);
1480
- registerWebhookTools(server, db);
1481
- registerVectorTools(server, db);
1482
- registerCollectionResources(server, db);
1472
+ function createServer() {
1473
+ const s = new McpServer2({ name: "jsondb-cloud", version: "1.0.0" });
1474
+ registerDocumentTools(s, db);
1475
+ registerCollectionTools(s, db);
1476
+ registerSchemaTools(s, db);
1477
+ registerVersionTools(s, db);
1478
+ registerWebhookTools(s, db);
1479
+ registerVectorTools(s, db);
1480
+ registerCollectionResources(s, db);
1481
+ return s;
1482
+ }
1483
1483
  const transportType = process.env.JSONDB_MCP_TRANSPORT || "stdio";
1484
1484
  if (transportType === "http") {
1485
1485
  const port = parseInt(process.env.JSONDB_MCP_PORT || "3100", 10);
@@ -1490,25 +1490,16 @@ async function main() {
1490
1490
  res.end(JSON.stringify({ status: "ok" }));
1491
1491
  return;
1492
1492
  }
1493
- if (req.method === "POST" && req.url === "/mcp") {
1494
- const transport = new StreamableHTTPServerTransport({
1495
- sessionIdGenerator: void 0
1496
- });
1497
- await server.connect(transport);
1498
- await transport.handleRequest(req, res);
1499
- return;
1500
- }
1501
- if (req.method === "GET" && req.url === "/mcp") {
1493
+ if (req.url === "/mcp") {
1494
+ const server = createServer();
1502
1495
  const transport = new StreamableHTTPServerTransport({
1503
1496
  sessionIdGenerator: void 0
1504
1497
  });
1505
- await server.connect(transport);
1506
- await transport.handleRequest(req, res);
1507
- return;
1508
- }
1509
- if (req.method === "DELETE" && req.url === "/mcp") {
1510
- const transport = new StreamableHTTPServerTransport({
1511
- sessionIdGenerator: void 0
1498
+ res.on("close", () => {
1499
+ transport.close().catch(() => {
1500
+ });
1501
+ server.close().catch(() => {
1502
+ });
1512
1503
  });
1513
1504
  await server.connect(transport);
1514
1505
  await transport.handleRequest(req, res);
@@ -1521,6 +1512,7 @@ async function main() {
1521
1512
  console.error(`MCP HTTP server listening on ${host}:${port}`);
1522
1513
  });
1523
1514
  } else {
1515
+ const server = createServer();
1524
1516
  const transport = new StdioServerTransport();
1525
1517
  await server.connect(transport);
1526
1518
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsondb-cloud/mcp",
3
- "version": "1.0.17",
3
+ "version": "1.0.25",
4
4
  "description": "MCP (Model Context Protocol) server for jsondb.cloud — lets AI agents interact with your JSON database",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -27,7 +27,7 @@
27
27
  "prepare": "husky"
28
28
  },
29
29
  "dependencies": {
30
- "@jsondb-cloud/client": "*",
30
+ "@jsondb-cloud/client": "^1.0.18",
31
31
  "@modelcontextprotocol/sdk": "^1.0.0",
32
32
  "zod": "^3.23.0"
33
33
  },