{"_id":"l-chris-chatlab-mcp","name":"l-chris-chatlab-mcp","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"l-chris-chatlab-mcp","version":"0.1.0","description":"MCP server that manages and calls the local ChatLab CLI HTTP API.","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","bin":{"l-chris-chatlab-mcp":"dist/index.js","chatlab-mcp":"dist/index.js"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"build":"tsc","dev":"tsx src/index.ts","prepare":"npm run build","publish:npm":"npm publish --access public","start":"node dist/index.js","typecheck":"tsc --noEmit"},"keywords":["mcp","chatlab","chatlab-cli","chat-history","model-context-protocol"],"homepage":"https://github.com/L-Chris/chatlab-mcp#readme","bugs":{"url":"https://github.com/L-Chris/chatlab-mcp/issues"},"repository":{"type":"git","url":"git+https://github.com/L-Chris/chatlab-mcp.git"},"publishConfig":{"access":"public"},"license":"AGPL-3.0","dependencies":{"@modelcontextprotocol/sdk":"^1.15.0","chatlab-cli":"^0.30.0","zod":"^3.25.76"},"devDependencies":{"@types/node":"^22.13.14","tsx":"^4.20.3","typescript":"^5.8.3"},"engines":{"node":">=20.0.0"},"_id":"l-chris-chatlab-mcp@0.1.0","gitHead":"e7392d82dc74f2204ab25f810da4ecf8f5206564","_nodeVersion":"22.21.1","_npmVersion":"10.9.4","dist":{"integrity":"sha512-8XK8ozuTbp7MX4/totLQsSe7LU/lYTTqvgIIwEK5nEp+6idMXuh9uFJIc9vHLEbHO2mHemt830ss8mh3O3DNsg==","shasum":"78add4a463b5d48b7fcf2110a50f11d23818bc38","tarball":"https://registry.npmjs.org/l-chris-chatlab-mcp/-/l-chris-chatlab-mcp-0.1.0.tgz","fileCount":5,"unpackedSize":29881,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIGsEXik/G/qeBJRAU6Lri/sjXhprE2CeWU5DdUIPcYSsAiEAjRGI19o3RLX8UnA6x58GVZkWk6v5/OR1HCuzS4DQAKk="}]},"_npmUser":{"name":"l-chris","email":"563303226@qq.com"},"directories":{},"maintainers":[{"name":"l-chris","email":"563303226@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/l-chris-chatlab-mcp_0.1.0_1783496618067_0.34457769731778143"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-08T07:43:37.946Z","0.1.0":"2026-07-08T07:43:38.197Z","modified":"2026-07-08T07:43:38.366Z"},"maintainers":[{"name":"l-chris","email":"563303226@qq.com"}],"description":"MCP server that manages and calls the local ChatLab CLI HTTP API.","homepage":"https://github.com/L-Chris/chatlab-mcp#readme","keywords":["mcp","chatlab","chatlab-cli","chat-history","model-context-protocol"],"repository":{"type":"git","url":"git+https://github.com/L-Chris/chatlab-mcp.git"},"bugs":{"url":"https://github.com/L-Chris/chatlab-mcp/issues"},"license":"AGPL-3.0","readme":"# chatlab-mcp\n\nTypeScript MCP server for [ChatLab](https://github.com/ChatLab/ChatLab). It depends on `chatlab-cli` and starts the ChatLab HTTP API in headless mode by default.\n\nChatLab CLI command used by default:\n\n```bash\nchatlab start --headless --host 127.0.0.1 --port 3110 --token <token>\n```\n\n## Install\n\nUse directly with `npx`:\n\n```bash\nnpx -y l-chris-chatlab-mcp\n```\n\nOr install from source:\n\n```bash\nnpm install\nnpm run build\n```\n\n## Configuration\n\n| Variable | Default | Description |\n| --- | --- | --- |\n| `CHATLAB_PORT` | `3110` | ChatLab HTTP API port |\n| `CHATLAB_API_PORT` | empty | Fallback port variable if `CHATLAB_PORT` is not set |\n| `CHATLAB_HOST` | `127.0.0.1` | ChatLab listen host |\n| `CHATLAB_TOKEN` | generated per MCP process | Bearer token passed to `chatlab-cli` and used for API calls |\n| `CHATLAB_AUTO_START` | `true` | Start `chatlab-cli` automatically before API calls |\n| `CHATLAB_HEADLESS` | `true` | Use `--headless`; set to `false` to serve the Web UI too |\n| `CHATLAB_TIMEOUT_MS` | `30000` | HTTP request timeout |\n| `CHATLAB_CLI_BIN` | bundled `chatlab-cli` | Optional custom executable or script path |\n\n## MCP client example\n\n```json\n{\n  \"mcpServers\": {\n    \"chatlab\": {\n      \"command\": \"node\",\n      \"args\": [\"/home/projects/wechat-tool/chatlab-mcp/dist/index.js\"],\n      \"env\": {\n        \"CHATLAB_PORT\": \"3110\",\n        \"CHATLAB_TOKEN\": \"YOUR_TOKEN\"\n      }\n    }\n  }\n}\n```\n\nAfter npm publish, you can use `npx` instead:\n\n```json\n{\n  \"mcpServers\": {\n    \"chatlab\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"l-chris-chatlab-mcp\"],\n      \"env\": {\n        \"CHATLAB_PORT\": \"3110\",\n        \"CHATLAB_TOKEN\": \"YOUR_TOKEN\"\n      }\n    }\n  }\n}\n```\n\n## Tools\n\n- `chatlab_start`: start `chatlab-cli` as a child process.\n- `chatlab_stop`: stop the child process started by this MCP server.\n- `chatlab_status`: show process state and ChatLab `/api/v1/status`.\n- `chatlab_list_sessions`: list imported chat sessions.\n- `chatlab_get_session`: get one session's metadata.\n- `chatlab_get_messages`: page messages from a session.\n- `chatlab_get_members`: list members in a session.\n- `chatlab_get_overview`: get session overview stats.\n- `chatlab_execute_sql`: run readonly SQL against a session database.\n- `chatlab_export_session`: export one session in ChatLab format.\n- `chatlab_import_session`: import ChatLab-format JSON into a session ID.\n- `chatlab_request`: call any ChatLab HTTP API endpoint.\n\n## Notes\n\n- ChatLab's default API port is `3110`.\n- The MCP server keeps ChatLab CLI logs on stderr so MCP stdio stays valid.\n- ChatLab also has its own CLI MCP mode (`chatlab mcp`); this project is a wrapper that manages headless HTTP mode and exposes stable API tools.\n","readmeFilename":"README.md","_rev":"1-397c6b4433ec1bb748610128efe9f979"}