@gramatr/mcp 0.20.13 → 0.20.16

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 CHANGED
@@ -1,5 +1,24 @@
1
1
  # @gramatr/mcp
2
2
 
3
+ > ## ⚠️ Deprecated
4
+ >
5
+ > **This package is no longer the recommended way to use grāmatr.**
6
+ >
7
+ > Install the Claude Code plugin instead:
8
+ >
9
+ > ```
10
+ > /plugin marketplace add gramatr/claude-plugin
11
+ > /plugin install gramatr@gramatr-claude-plugin
12
+ > ```
13
+ >
14
+ > The plugin handles OAuth automatically through Claude Code's connector
15
+ > flow — no manual setup, no local installer side-effects.
16
+ >
17
+ > Codex and Gemini integrations are paused while those clients lack
18
+ > HTTPS+OAuth MCP support. We'll revisit when they're ready.
19
+ >
20
+ > See: https://github.com/gramatr/gramatr/issues/2750
21
+
3
22
  Intelligence middleware for AI agents by [gramatr](https://gramatr.com).
4
23
 
5
24
  Pre-classifies every request, injects relevant memory and behavioral context,
File without changes
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gramatr/mcp",
3
- "version": "0.20.13",
4
- "description": "grāmatrIntelligence middleware for AI agents. Pre-classifies every request, injects relevant memory and behavioral context, enforces data quality, and maintains session continuity across Claude, ChatGPT, Codex, Cursor, Gemini, and any MCP-compatible client.",
3
+ "version": "0.20.16",
4
+ "description": "DEPRECATEDinstall the Claude Code plugin at gramatr/claude-plugin instead. This npm package no longer ships a CLI; Codex and Gemini integrations are paused pending HTTPS+OAuth MCP support.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -35,13 +35,9 @@
35
35
  "node": ">=22"
36
36
  },
37
37
  "type": "module",
38
- "bin": {
39
- "gramatr": "dist/bin/gramatr-mcp.js"
40
- },
41
38
  "main": "dist/server/server.js",
42
39
  "exports": {
43
40
  ".": "./dist/server/server.js",
44
- "./bin": "./dist/bin/gramatr-mcp.js",
45
41
  "./types": "./dist/types/generated/rest-api-types.js"
46
42
  },
47
43
  "files": [
@@ -49,11 +45,6 @@
49
45
  "dist/**/*.d.ts",
50
46
  "dist/**/*.d.ts.map",
51
47
  "dist/**/*.js.map",
52
- "scripts/postinstall.mjs",
53
- "scripts/hook-userpromptsubmit.sh",
54
- "scripts/hook-sessionend.sh",
55
- "scripts/hook-sessionstart.sh",
56
- "scripts/hook-stop.sh",
57
48
  "LICENSE"
58
49
  ],
59
50
  "dependencies": {
@@ -70,7 +61,6 @@
70
61
  "vitest": "^4.0.18"
71
62
  },
72
63
  "scripts": {
73
- "postinstall": "node scripts/postinstall.mjs",
74
64
  "build": "tsc --build && node ./scripts/build-marketplace.mjs",
75
65
  "build:binary": "node ./scripts/build-binary.mjs",
76
66
  "build:marketplace": "node ./scripts/build-marketplace.mjs",
@@ -1,14 +0,0 @@
1
- #!/bin/sh
2
- # gramatr SessionEnd hook — fire-and-forget session_end.
3
- # Reads {"session_id":...} on stdin. Hard 2s timeout. Silent fail. Exit 0 always.
4
- set -u
5
- INPUT=$(cat 2>/dev/null) || exit 0
6
- SID=$(printf '%s' "$INPUT" | jq -r '.session_id // empty' 2>/dev/null) || exit 0
7
- [ -z "$SID" ] && exit 0
8
- TOKEN=$(jq -r '.mcpServers.gramatr.headers.Authorization // empty' "$HOME/.claude.json" 2>/dev/null) || exit 0
9
- [ -z "$TOKEN" ] && exit 0
10
- API_URL="${GRAMATR_API_URL:-https://api.gramatr.com}/api/v1/session/end"
11
- curl -sS --max-time 2 -o /dev/null -X POST "$API_URL" \
12
- -H "Authorization: $TOKEN" -H "Content-Type: application/json" \
13
- -d "$(printf '{"session_id":"%s"}' "$SID")" >/dev/null 2>&1 || true
14
- exit 0
@@ -1,21 +0,0 @@
1
- #!/bin/sh
2
- # gramatr SessionStart hook — auto session_start + handoff injection (issue #2475).
3
- # Reads SessionStart JSON on stdin, collects cwd + git remote, POSTs to
4
- # /api/v1/session/start, emits <gramatr-handoff> block on stdout. Silent no-op
5
- # on any failure. Hard 2s timeout. Mirrors hook-userpromptsubmit.sh shape.
6
- set -u
7
- INPUT=$(cat 2>/dev/null) || INPUT='{}'
8
- TOKEN=$(jq -r '.mcpServers.gramatr.headers.Authorization // empty' "$HOME/.claude.json" 2>/dev/null) || exit 0
9
- [ -z "$TOKEN" ] && exit 0
10
- CWD=$(pwd 2>/dev/null) || CWD=""
11
- GIT_REMOTE=$(git config --get remote.origin.url 2>/dev/null) || GIT_REMOTE=""
12
- PROJECT_ID=$(printf '%s' "$INPUT" | jq -r '.project_id // .cwd // empty' 2>/dev/null) || PROJECT_ID=""
13
- SESSION_ID=$(printf '%s' "$INPUT" | jq -r '.session_id // empty' 2>/dev/null) || SESSION_ID=""
14
- API_URL="${GRAMATR_API_URL:-https://api.gramatr.com}/api/v1/session/start"
15
- BODY=$(jq -nc --arg pid "$PROJECT_ID" --arg cwd "$CWD" --arg gr "$GIT_REMOTE" --arg sid "$SESSION_ID" \
16
- '{project_id: $pid, cwd: $cwd, git_remote: $gr, session_id: $sid} | with_entries(select(.value != ""))' 2>/dev/null) || exit 0
17
- RESPONSE=$(curl -sS --max-time 2 -X POST "$API_URL" -H "Authorization: $TOKEN" -H "Content-Type: application/json" -d "$BODY" 2>/dev/null) || exit 0
18
- [ -z "$RESPONSE" ] && exit 0
19
- printf '%s' "$RESPONSE" | jq -e '.schema == "gmtr.session.start.v1" and (.last_handoff != null)' >/dev/null 2>&1 || exit 0
20
- printf '<gramatr-handoff>\n%s\n</gramatr-handoff>\n' "$(printf '%s' "$RESPONSE" | jq -c .last_handoff)"
21
- exit 0
@@ -1,17 +0,0 @@
1
- #!/bin/sh
2
- # gramatr Stop hook — fire-and-forget auto classification feedback (#2476).
3
- # Reads {"session_id":..., "interaction_id":...?} on stdin. Hard 2s timeout. Silent fail. Exit 0 always.
4
- set -u
5
- INPUT=$(cat 2>/dev/null) || exit 0
6
- SID=$(printf '%s' "$INPUT" | jq -r '.session_id // empty' 2>/dev/null) || exit 0
7
- [ -z "$SID" ] && exit 0
8
- IID=$(printf '%s' "$INPUT" | jq -r '.interaction_id // empty' 2>/dev/null) || IID=""
9
- TOKEN=$(jq -r '.mcpServers.gramatr.headers.Authorization // empty' "$HOME/.claude.json" 2>/dev/null) || exit 0
10
- [ -z "$TOKEN" ] && exit 0
11
- API_URL="${GRAMATR_API_URL:-https://api.gramatr.com}/api/v1/classification/feedback/auto"
12
- BODY=$(printf '%s' "$INPUT" | jq -c --arg sid "$SID" --arg iid "$IID" \
13
- '{session_id:$sid, interaction_id:(if $iid=="" then null else $iid end), client_type:"claude-code"}' 2>/dev/null) || exit 0
14
- curl -sS --max-time 2 -o /dev/null -X POST "$API_URL" \
15
- -H "Authorization: $TOKEN" -H "Content-Type: application/json" \
16
- -d "$BODY" >/dev/null 2>&1 || true
17
- exit 0
@@ -1,21 +0,0 @@
1
- #!/bin/sh
2
- # gramatr UserPromptSubmit hook — classifier-only injection.
3
- # Reads {"prompt":...,"session_id":...} on stdin (Claude Code hook contract).
4
- # POSTs to /api/v1/classify, emits <gramatr-classification> block on stdout.
5
- # Hard 2s timeout. Silent no-op on any failure — never crashes the user turn.
6
- set -u
7
- INPUT=$(cat 2>/dev/null) || exit 0
8
- PROMPT=$(printf '%s' "$INPUT" | jq -r '.prompt // empty' 2>/dev/null) || exit 0
9
- [ -z "$PROMPT" ] && exit 0
10
- TOKEN=$(jq -r '.mcpServers.gramatr.headers.Authorization // empty' "$HOME/.claude.json" 2>/dev/null) || exit 0
11
- [ -z "$TOKEN" ] && exit 0
12
- API_URL="${GRAMATR_API_URL:-https://api.gramatr.com}/api/v1/classify"
13
- BODY=$(printf '%s' "$INPUT" | jq -c '{prompt: .prompt, session_id: (.session_id // null)}' 2>/dev/null) || exit 0
14
- RESPONSE=$(curl -sS --max-time 2 -X POST "$API_URL" \
15
- -H "Authorization: $TOKEN" \
16
- -H "Content-Type: application/json" \
17
- -d "$BODY" 2>/dev/null) || exit 0
18
- [ -z "$RESPONSE" ] && exit 0
19
- printf '%s' "$RESPONSE" | jq -e '.schema == "gmtr.classification.v1"' >/dev/null 2>&1 || exit 0
20
- printf '<gramatr-classification>\n%s\n</gramatr-classification>\n' "$(printf '%s' "$RESPONSE" | jq -c .)"
21
- exit 0
@@ -1,55 +0,0 @@
1
- /**
2
- * postinstall.mjs — Auto-detect and configure local AI clients.
3
- *
4
- * Runs on `npm install -g @gramatr/mcp`. Detects installed AI clients
5
- * (Claude Code, Codex, Gemini CLI, etc.), configures them automatically,
6
- * and prints a link for web/app setup.
7
- *
8
- * Design constraints:
9
- * - Pure Node.js (no external dependencies)
10
- * - Graceful failure: always exits 0
11
- * - Non-interactive in CI (no prompts)
12
- */
13
-
14
- import { execSync } from "node:child_process";
15
- import { existsSync } from "node:fs";
16
- import { mkdir } from "node:fs/promises";
17
- import { homedir } from "node:os";
18
- import { join } from "node:path";
19
- import { fileURLToPath } from "node:url";
20
- import { dirname } from "node:path";
21
-
22
- async function main() {
23
- const home = homedir();
24
- const gramatrDir = join(home, ".gramatr");
25
- await mkdir(gramatrDir, { recursive: true });
26
-
27
- // Resolve the gramatr-mcp entry point relative to this script
28
- const __dirname = dirname(fileURLToPath(import.meta.url));
29
- const entrypoint = join(__dirname, "..", "dist", "bin", "gramatr-mcp.js");
30
-
31
- // Skip if dist hasn't been built yet (e.g. during CI install before build step).
32
- if (!existsSync(entrypoint)) return;
33
-
34
- // Skip when running inside the monorepo workspace — postinstall is for
35
- // published global installs only. Workspace dev installs (pnpm install at
36
- // repo root) must not overwrite ~/.claude/settings.json with the current
37
- // workspace dist, which may be stale or use different hook commands.
38
- if (existsSync(join(__dirname, "..", "..", "..", "pnpm-workspace.yaml"))) return;
39
-
40
- // Skip interactive flow in CI environments
41
- const isCI = process.env.CI || process.env.CONTINUOUS_INTEGRATION || process.env.BUILD_ID || !process.stdin.isTTY;
42
-
43
- // Configure local clients, then prompt for login if not already authenticated.
44
- // In CI, stop after setup — no login prompt.
45
- const command = isCI ? `node "${entrypoint}" setup auto --yes` : `node "${entrypoint}" start`;
46
- try {
47
- execSync(command, {
48
- stdio: "inherit",
49
- timeout: 300000, // 5 min — enough for OAuth browser flow
50
- });
51
- } catch {
52
- }
53
- }
54
-
55
- main().catch(() => process.exit(0));