@remnic/replit 1.0.0 → 9.3.515

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/README.md ADDED
@@ -0,0 +1,101 @@
1
+ # @remnic/replit
2
+
3
+ MCP connector helper for using [Remnic](https://github.com/joshuaswarren/remnic) memory with [Replit Agent](https://replit.com/).
4
+
5
+ Replit Agent has no plugin system, so it can't install a Remnic hook like Claude Code or Codex can. Instead, this package takes a bearer token that you mint separately (`remnic token generate replit`) and produces the exact MCP server config + paste-ready setup instructions for Replit's **Integrations** pane, turning any Replit workspace into a Remnic memory client over HTTP + MCP.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pnpm add @remnic/replit
11
+ # or: npm i @remnic/replit
12
+ ```
13
+
14
+ Needs a running Remnic server (see [`@remnic/server`](https://www.npmjs.com/package/@remnic/server)) or a `@remnic/cli`-managed daemon that exposes MCP on port 4318.
15
+
16
+ ## Quick start
17
+
18
+ First mint a Replit-scoped token with the Remnic CLI:
19
+
20
+ ```bash
21
+ remnic token generate replit
22
+ ```
23
+
24
+ Then use the helper to render the setup instructions and MCP config:
25
+
26
+ ```ts
27
+ import { generateReplitInstructions } from "@remnic/replit";
28
+
29
+ // Pass the token returned by `remnic token generate replit`:
30
+ const setup = generateReplitInstructions("YOUR_REMNIC_TOKEN");
31
+
32
+ console.log(setup.instructions);
33
+ // Paste setup.mcpConfig into Replit's Integrations > Add MCP server form.
34
+ ```
35
+
36
+ For a cloud Replit workspace, pass the public HTTPS origin for your Remnic server:
37
+
38
+ ```ts
39
+ const setup = generateReplitInstructions("YOUR_REMNIC_TOKEN", {
40
+ baseUrl: "https://remnic.example.com",
41
+ });
42
+ ```
43
+
44
+ The legacy `generateReplitInstructions(token, host?, port?)` form is still supported for
45
+ local or LAN hosts. If `host` already includes a scheme, it is treated as a complete
46
+ origin and the MCP URL is generated with the URL API.
47
+
48
+ `generateReplitInstructions(token, endpoint?, port?)` returns:
49
+
50
+ ```ts
51
+ interface ReplitInstallResult {
52
+ token: string;
53
+ instructions: string; // human-readable setup steps
54
+ mcpConfig: {
55
+ url: string; // http://localhost:4318/mcp or https://{origin}/mcp
56
+ headers: Record<string, string>; // Authorization + X-Engram-Client-Id
57
+ };
58
+ }
59
+ ```
60
+
61
+ Defaults are `host="localhost"`, `port=4318`. Public origins must be an origin only,
62
+ without a path, query string, or hash.
63
+
64
+ ## Replit pane setup
65
+
66
+ Running `generateReplitInstructions` prints something like:
67
+
68
+ ```
69
+ Replit Agent MCP Setup
70
+ ======================
71
+
72
+ 1. In your Replit workspace, open Integrations > Add MCP server
73
+ 2. Enter URL: http://localhost:4318/mcp
74
+ 3. Add headers:
75
+ - Authorization: Bearer <your-remnic-token>
76
+ - X-Engram-Client-Id: replit
77
+ 4. Click Test & Save
78
+ ```
79
+
80
+ A ready-to-paste snippet lives at `setup-snippet.json` in the package.
81
+
82
+ ## Caveats
83
+
84
+ - For a **cloud** Replit workspace, the Remnic server has to be publicly reachable — via a tunnel (Cloudflare Tunnel, ngrok, Tailscale funnel), a public IP, or a reverse proxy. Pass that public origin with `baseUrl`, for example `https://remnic.example.com`. `localhost` only works for self-hosted Replit-likes.
85
+ - Replit has **no hook system**, so the agent must explicitly call Remnic MCP tools (`recall`, `observe`, `store`, `search`). Auto-recall before prompts isn't available the way it is on Claude Code, Codex, or OpenClaw. All 44 MCP tools are exposed.
86
+ - The token is a plain bearer token. Don't paste it into a Replit that you share with others unless each collaborator should have the same memory namespace.
87
+
88
+ ## Agent note
89
+
90
+ If you're an AI agent scaffolding a Replit integration: call `generateReplitInstructions(token)` once you have a live Remnic token; don't hand-roll the MCP config (future protocol bumps will update this helper first).
91
+
92
+ ## Related
93
+
94
+ - [`@remnic/cli`](https://www.npmjs.com/package/@remnic/cli) — daemon lifecycle + token minting
95
+ - [`@remnic/server`](https://www.npmjs.com/package/@remnic/server) — standalone HTTP + MCP server
96
+ - Connector guide: [docs/integration/connector-setup.md](https://github.com/joshuaswarren/remnic/blob/main/docs/integration/connector-setup.md) in the repo
97
+ - Source + issues: <https://github.com/joshuaswarren/remnic>
98
+
99
+ ## License
100
+
101
+ MIT. See the root [LICENSE](https://github.com/joshuaswarren/remnic/blob/main/LICENSE) file.
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Replit connector installer.
3
3
  *
4
- * Since Replit has no plugin system, this generates a token and
5
- * prints setup instructions for the Integrations pane.
4
+ * Since Replit has no plugin system, this formats a pre-existing Remnic
5
+ * bearer token into setup instructions for the Integrations pane.
6
6
  */
7
7
  interface ReplitInstallResult {
8
8
  token: string;
@@ -12,6 +12,11 @@ interface ReplitInstallResult {
12
12
  headers: Record<string, string>;
13
13
  };
14
14
  }
15
- declare function generateReplitInstructions(token: string, host?: string, port?: number): ReplitInstallResult;
15
+ interface ReplitEndpointOptions {
16
+ host?: string;
17
+ port?: number;
18
+ baseUrl?: string | URL;
19
+ }
20
+ declare function generateReplitInstructions(token: string, hostOrOptions?: string | URL | ReplitEndpointOptions, port?: number): ReplitInstallResult;
16
21
 
17
22
  export { type ReplitInstallResult, generateReplitInstructions };
package/dist/index.js CHANGED
@@ -1,6 +1,39 @@
1
1
  // src/installer.ts
2
- function generateReplitInstructions(token, host = "localhost", port = 4318) {
3
- const url = `http://${host}:${port}/mcp`;
2
+ function assertValidPort(port) {
3
+ if (!Number.isInteger(port) || port < 1 || port > 65535) {
4
+ throw new TypeError("Replit MCP port must be an integer between 1 and 65535");
5
+ }
6
+ }
7
+ function hasScheme(value) {
8
+ return /^[a-z][a-z0-9+.-]*:\/\//i.test(value);
9
+ }
10
+ function endpointFromHost(host, port) {
11
+ const trimmedHost = host.trim();
12
+ if (trimmedHost.length === 0) {
13
+ throw new TypeError("Replit MCP host must be a non-empty hostname or URL origin");
14
+ }
15
+ if (hasScheme(trimmedHost)) {
16
+ const url = new URL(trimmedHost);
17
+ if (url.pathname !== "/" || url.search !== "" || url.hash !== "") {
18
+ throw new TypeError("Replit MCP base URL must be an origin without a path, query, or hash");
19
+ }
20
+ return url;
21
+ }
22
+ if (/[/?#]/.test(trimmedHost)) {
23
+ throw new TypeError("Replit MCP host must not include a path, query, or hash");
24
+ }
25
+ assertValidPort(port);
26
+ return new URL(`http://${trimmedHost}:${port}`);
27
+ }
28
+ function buildMcpUrl(hostOrOptions = "localhost", port = 4318) {
29
+ const endpoint = hostOrOptions instanceof URL ? endpointFromHost(hostOrOptions.toString(), port) : typeof hostOrOptions === "object" ? hostOrOptions.baseUrl ? endpointFromHost(hostOrOptions.baseUrl.toString(), hostOrOptions.port ?? port) : endpointFromHost(hostOrOptions.host ?? "localhost", hostOrOptions.port ?? port) : endpointFromHost(hostOrOptions, port);
30
+ endpoint.pathname = "/mcp";
31
+ endpoint.search = "";
32
+ endpoint.hash = "";
33
+ return endpoint.toString();
34
+ }
35
+ function generateReplitInstructions(token, hostOrOptions = "localhost", port = 4318) {
36
+ const url = buildMcpUrl(hostOrOptions, port);
4
37
  const instructions = `
5
38
  Replit Agent MCP Setup
6
39
  ======================
@@ -12,11 +45,11 @@ Replit Agent MCP Setup
12
45
  - X-Engram-Client-Id: replit
13
46
  4. Click Test & Save
14
47
 
15
- Note: For cloud Replit, EMO must be publicly reachable (via tunnel, public IP, or reverse proxy).
48
+ Note: For cloud Replit, the Remnic MCP endpoint must be publicly reachable (via tunnel, public IP, or reverse proxy).
16
49
 
17
50
  Limitations:
18
51
  - Replit has no hook system, so memory recall/observe is manual
19
- - The agent must explicitly call engram tools (recall, observe, store, search)
52
+ - The agent must explicitly call Remnic MCP tools (recall, observe, store, search)
20
53
  - All 44 MCP tools are available
21
54
  `.trim();
22
55
  return {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@remnic/replit",
3
- "version": "1.0.0",
4
- "description": "Remnic MCP connector for Replit Agent — setup instructions and token generator",
3
+ "version": "9.3.515",
4
+ "description": "Remnic MCP connector for Replit Agent — setup instructions for an existing token",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",