{"_id":"@cogniguard/mcp-server","_rev":"2-e23d5c340d2b440758453357f1361167","name":"@cogniguard/mcp-server","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@cogniguard/mcp-server","version":"0.1.0","keywords":["mcp","cogniguard","cognitive-fitness","ai-tracking","claude-code"],"license":"MIT","_id":"@cogniguard/mcp-server@0.1.0","maintainers":[{"name":"cogni26","email":"info@cogniguard.eu"}],"bin":{"cogniguard-mcp":"dist/server.js","cogniguard-setup":"dist/setup.js","cogniguard-capture":"dist/capture.js"},"dist":{"shasum":"cd7c71a6e0bd4b96dc44d47ffdcada5472607a27","tarball":"https://registry.npmjs.org/@cogniguard/mcp-server/-/mcp-server-0.1.0.tgz","fileCount":38,"integrity":"sha512-Fs0QJteDK8KpD3/sxE9dLWwX3NUNtdGUtlxeORnv2v/NpukOSpOnLStkd9l5sjeiEzXY5iiNpFh1yi8hUDIINQ==","signatures":[{"sig":"MEYCIQDHMY8UYeYbIRQCBJLtWwF7MpWuD82kax5VmIoR+RMGswIhAKw0IQKlm2cqSiy57e2QgSjOBw3s95yLOvqwYg2qlx+y","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":61830},"type":"module","engines":{"node":">=18"},"gitHead":"4f50afa300406bab959cbe37309c7bec09e23926","scripts":{"dev":"tsc --watch","build":"tsc","start":"node dist/server.js"},"_npmUser":{"name":"cogni26","email":"info@cogniguard.eu"},"_npmVersion":"10.1.0","description":"CogniGuard MCP server — cognitive fitness tracking for AI coding agents","directories":{},"_nodeVersion":"20.9.0","dependencies":{"zod":"^3.23.0","@modelcontextprotocol/sdk":"^1.29.0"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.5.0","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/mcp-server_0.1.0_1774999941537_0.6882588186636776","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@cogniguard/mcp-server","version":"0.2.0","description":"CogniGuard MCP server — cognitive fitness tracking for AI coding agents","type":"module","bin":{"cogniguard-mcp":"dist/server.js","cogniguard-capture":"dist/capture.js","cogniguard-setup":"dist/setup.js"},"scripts":{"build":"tsc","dev":"tsc --watch","start":"node dist/server.js"},"engines":{"node":">=18"},"dependencies":{"@modelcontextprotocol/sdk":"^1.29.0","zod":"^3.23.0"},"devDependencies":{"typescript":"^5.5.0","@types/node":"^20.0.0"},"keywords":["mcp","cogniguard","cognitive-fitness","ai-tracking","claude-code"],"license":"MIT","_id":"@cogniguard/mcp-server@0.2.0","gitHead":"a480f1336118fd780b0abb73a8b2c2136f9b6db9","_nodeVersion":"20.9.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-ZncBB/I3y5RCki+nOF4lvMTBF7geBw9tf97SOa7QO8+OmbWPyBOuld5q3dhI6YOCFlUpHt4mO3khtYCfwFr8Jg==","shasum":"ce5fd8c2305f2f6baa8cd3140b43c3b51c8c5b39","tarball":"https://registry.npmjs.org/@cogniguard/mcp-server/-/mcp-server-0.2.0.tgz","fileCount":42,"unpackedSize":82450,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDbptheualfpuQtlx48yn1COtsAl09t8qDZNwLL+a9BPwIhALhGCDYO7PB2fDWh7UYidh4WIIJ4e0anXG1vrxIjxkvq"}]},"_npmUser":{"name":"cogni26","email":"info@cogniguard.eu"},"directories":{},"maintainers":[{"name":"cogni26","email":"info@cogniguard.eu"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mcp-server_0.2.0_1775261734165_0.260579758372278"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-31T23:32:21.416Z","modified":"2026-04-04T00:15:34.514Z","0.1.0":"2026-03-31T23:32:21.702Z","0.2.0":"2026-04-04T00:15:34.392Z"},"license":"MIT","keywords":["mcp","cogniguard","cognitive-fitness","ai-tracking","claude-code"],"description":"CogniGuard MCP server — cognitive fitness tracking for AI coding agents","maintainers":[{"name":"cogni26","email":"info@cogniguard.eu"}],"readme":"# @cogniguard/mcp-server\n\nCogniGuard MCP server + CLI capture for AI coding agents.\n\nTrack the cognitive impact of your AI coding sessions with the same backend used by CogniGuard on the web, now exposed through MCP tools and optional CLI capture hooks.\n\n## Support Status\n\n- **Claude Code**: full support\n  - MCP tools\n  - automatic prompt capture via `UserPromptSubmit`\n- **OpenClaw**: beta dual-path support\n  - MCP tool logging via `log_prompt`\n  - optional hook logging via `cogniguard-capture`\n- **Other MCP-compatible agents**: MCP tools and manual logging\n  - auto-capture is only supported where a runtime can invoke `cogniguard-capture` with the documented contract\n\n## Install / Run\n\nAll examples below use the published package directly:\n\n```bash\nnpx --yes --package @cogniguard/mcp-server cogniguard-mcp\n```\n\nYou can swap `cogniguard-mcp` for `cogniguard-setup` or `cogniguard-capture` as needed.\n\n## Quick Setup\n\n### Auth/config only\n\n```bash\nnpx --yes --package @cogniguard/mcp-server cogniguard-setup\n```\n\nThis authenticates with CogniGuard, stores credentials in `~/.cogniguard/config.json`, verifies the connection, and prints next steps for your agent/runtime.\n\n### Claude Code full setup\n\n```bash\nnpx --yes --package @cogniguard/mcp-server cogniguard-setup --claude\n```\n\nThis does the generic auth/config flow and also registers:\n\n1. the MCP server in Claude Code\n2. a `UserPromptSubmit` hook for automatic prompt capture\n\n### Headless setup\n\n```bash\nprintf '%s' \"$COGNIGUARD_PASSWORD\" | npx --yes --package @cogniguard/mcp-server cogniguard-setup --email you@example.com --password-stdin --non-interactive\n```\n\nOr provide the password via env:\n\n```bash\nCOGNIGUARD_PASSWORD='...' npx --yes --package @cogniguard/mcp-server cogniguard-setup --email you@example.com --non-interactive\n```\n\n## MCP Server Configuration\n\nUse this command in any runtime that supports stdio MCP servers:\n\n```bash\nnpx --yes --package @cogniguard/mcp-server cogniguard-mcp\n```\n\nExample JSON config:\n\n```json\n{\n  \"mcpServers\": {\n    \"cogniguard\": {\n      \"type\": \"stdio\",\n      \"command\": \"npx\",\n      \"args\": [\"--yes\", \"--package\", \"@cogniguard/mcp-server\", \"cogniguard-mcp\"],\n      \"tools\": [\"*\"]\n    }\n  }\n}\n```\n\n## Prompt Logging Paths\n\nCogniGuard supports two ingestion paths that land in the same backend flow.\n\n### 1. MCP tool path\n\nCall the `log_prompt` MCP tool once per prompt.\n\nThis is the recommended path for OpenClaw and any agent that can already invoke MCP tools reliably.\n\n### 2. CLI capture path\n\nUse `cogniguard-capture` when your runtime can invoke a shell command/hook directly.\n\n#### Argv mode\n\n```bash\nnpx --yes --package @cogniguard/mcp-server cogniguard-capture \"Explain this stack trace\" --tool openclaw --model claude-opus-4 --session-id abc123 --cwd /workspace/repo\n```\n\nSupported tools:\n\n- `claude-code`\n- `cursor`\n- `cline`\n- `copilot`\n- `windsurf`\n- `openclaw`\n- `other`\n\n#### Stdin JSON mode\n\nThis is kept for Claude Code hook payloads:\n\n```json\n{\n  \"prompt\": { \"content\": \"Explain this stack trace\" },\n  \"model\": \"claude-sonnet-4-5\",\n  \"session_id\": \"abc123\",\n  \"cwd\": \"/workspace/repo\"\n}\n```\n\n## Environment Bootstrap\n\nIf `~/.cogniguard/config.json` does not exist, the runtime can bootstrap from env vars:\n\n- `COGNIGUARD_ACCESS_TOKEN`\n- `COGNIGUARD_REFRESH_TOKEN`\n- `COGNIGUARD_USER_ID`\n\nOptional:\n\n- `COGNIGUARD_EMAIL`\n- `COGNIGUARD_SUPABASE_URL`\n- `COGNIGUARD_SUPABASE_ANON_KEY`\n- `COGNIGUARD_TOKEN_EXPIRES_AT`\n\nWhen bootstrap env vars are used, CogniGuard immediately writes a real `~/.cogniguard/config.json` so token refreshes persist for later short-lived processes like `cogniguard-capture`.\n\n## MCP Tools\n\n| Tool | Description |\n|------|-------------|\n| `log_prompt` | Capture a prompt for cognitive analysis |\n| `get_cognitive_score` | Your cognitive health score (0-100) for the last 7 days |\n| `get_session_metrics` | Today's prompt count, zone distribution, session duration |\n| `get_coaching_advice` | Personalized cognitive coaching based on your patterns |\n\n## OpenClaw Notes\n\nOpenClaw is currently supported in two ways:\n\n- **Tool path**: call `cogniguard__log_prompt` per prompt\n- **Hook path**: invoke `cogniguard-capture` from `PATH`\n\nRecommended hook shape:\n\n```js\nexecFile(\n  \"cogniguard-capture\",\n  [\n    content.slice(0, 10000),\n    \"--tool\", \"openclaw\",\n    \"--model\", event.context.model || \"unknown\",\n    \"--session-id\", event.context.sessionId || \"\",\n    \"--cwd\", process.cwd(),\n  ],\n  {\n    timeout: 10000,\n    env: { ...process.env, PATH: process.env.PATH },\n  },\n  (err) => {\n    if (err) console.error(`[cogniguard-logger] ${err.message}`);\n  }\n);\n```\n\nHooks and MCP tools are separate integration surfaces. The hook should not assume it can call MCP tools internally.\n\n## Development\n\n```bash\ncd packages/mcp-server\nnpm install\nnpm run build\n```\n","readmeFilename":"README.md"}