affine-mcp-server 1.2.1 → 1.2.2

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
@@ -2,7 +2,7 @@
2
2
 
3
3
  A Model Context Protocol (MCP) server that integrates with AFFiNE (self‑hosted or cloud). It exposes AFFiNE workspaces and documents to AI assistants over stdio.
4
4
 
5
- [![Version](https://img.shields.io/badge/version-1.2.1-blue)](https://github.com/dawncr0w/affine-mcp-server/releases)
5
+ [![Version](https://img.shields.io/badge/version-1.2.2-blue)](https://github.com/dawncr0w/affine-mcp-server/releases)
6
6
  [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-1.17.2-green)](https://github.com/modelcontextprotocol/typescript-sdk)
7
7
  [![License](https://img.shields.io/badge/license-MIT-yellow)](LICENSE)
8
8
 
@@ -14,7 +14,7 @@ A Model Context Protocol (MCP) server that integrates with AFFiNE (self‑hosted
14
14
  - Tools: 30+ tools plus WebSocket-based document editing
15
15
  - Status: Production Ready (v1.2.1)
16
16
 
17
- > New in v1.2.1: Email/Password login no longer blocks MCP startup. The server connects over stdio immediately and performs login asynchronously by default. Use `AFFINE_LOGIN_AT_START=sync` to restore the previous blocking behavior.
17
+ > New in v1.2.2: Fixed CLI binary to always run via Node (no shell mis-execution). Startup remains non-blocking for email/password login by default; set `AFFINE_LOGIN_AT_START=sync` to block at startup.
18
18
 
19
19
  ## Features
20
20
 
@@ -43,33 +43,15 @@ npx -y -p affine-mcp-server affine-mcp -- --version
43
43
 
44
44
  The package installs a CLI named `affine-mcp` that runs the MCP server over stdio.
45
45
 
46
- > Available on npm: install in seconds with `npm i -g affine-mcp-server` and use `affine-mcp` anywhere. No manual build or path setup required.
46
+ Note: From v1.2.2 the CLI wrapper (`bin/affine-mcp`) ensures Node runs the ESM entrypoint, preventing shell from misinterpreting JS.
47
47
 
48
48
  ## Configuration
49
49
 
50
- Set environment variables (recommended) or create a `.env` file:
50
+ Configure via environment variables (shell or app config). `.env` files are no longer recommended.
51
51
 
52
- ```env
53
- # AFFiNE server URL (required)
54
- AFFINE_BASE_URL=https://your-affine-instance.com
55
-
56
- # Authentication (choose one method):
57
- # 1) Bearer Token (highest priority)
58
- AFFINE_API_TOKEN=your_personal_access_token
59
- # 2) Session Cookie
60
- AFFINE_COOKIE=affine_session=xxx; affine_csrf=yyy
61
- # 3) Email/Password (fallback)
62
- AFFINE_EMAIL=your@email.com
63
- AFFINE_PASSWORD=your_password
64
-
65
- # Optional settings
66
- AFFINE_GRAPHQL_PATH=/graphql # Default: /graphql
67
- AFFINE_WORKSPACE_ID=workspace-uuid # Default workspace for operations
68
-
69
- # Startup auth behavior (optional)
70
- # AFFINE_LOGIN_AT_START=async # Default: async (don't block MCP handshake)
71
- # AFFINE_LOGIN_AT_START=sync # Block at startup to sign in with email/password
72
- ```
52
+ - Required: `AFFINE_BASE_URL`
53
+ - Auth (choose one): `AFFINE_API_TOKEN` | `AFFINE_COOKIE` | `AFFINE_EMAIL` + `AFFINE_PASSWORD`
54
+ - Optional: `AFFINE_GRAPHQL_PATH` (default `/graphql`), `AFFINE_WORKSPACE_ID`, `AFFINE_LOGIN_AT_START` (`async` default, `sync` to block)
73
55
 
74
56
  Authentication priority:
75
57
  1) `AFFINE_API_TOKEN` → 2) `AFFINE_COOKIE` → 3) `AFFINE_EMAIL` + `AFFINE_PASSWORD`
@@ -184,7 +166,7 @@ Authentication
184
166
  - Email/Password: ensure your instance allows password auth and credentials are valid
185
167
  - Cookie: copy cookies (e.g., `affine_session`, `affine_csrf`) from the browser DevTools after login
186
168
  - Token: generate a personal access token; verify it hasn’t expired
187
- - If using Email/Password and your MCP client shows a startup timeout, ensure `AFFINE_LOGIN_AT_START=async` (default) so login happens after the stdio handshake.
169
+ - Startup timeouts: v1.2.2 includes a CLI wrapper fix and the default async login to avoid blocking the MCP handshake. Set `AFFINE_LOGIN_AT_START=sync` only if needed.
188
170
 
189
171
  Connection
190
172
  - Confirm `AFFINE_BASE_URL` is reachable
@@ -201,6 +183,11 @@ Connection
201
183
 
202
184
  ## Version History
203
185
 
186
+ ### 1.2.2 (2025‑09‑18)
187
+ - CLI wrapper added to ensure Node runs ESM entry (`bin/affine-mcp`), preventing shell mis-execution
188
+ - Docs cleaned: use env vars via shell/app config; `.env` file no longer recommended
189
+ - MCP startup behavior unchanged from 1.2.1 (async login by default)
190
+
204
191
  ### 1.2.1 (2025‑09‑17)
205
192
  - Default to asynchronous email/password login after MCP stdio handshake
206
193
  - New `AFFINE_LOGIN_AT_START` env (`async` default, `sync` to block at startup)
package/bin/affine-mcp ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ // Lightweight CLI wrapper to ensure Node runs the ESM entry
3
+ // Resolves to the compiled ESM entrypoint in dist
4
+ import '../dist/index.js';
5
+
package/dist/config.js CHANGED
@@ -1,5 +1,3 @@
1
- import dotenv from "dotenv";
2
- dotenv.config();
3
1
  const defaultEndpoints = {
4
2
  listWorkspaces: { method: "GET", path: "/api/workspaces" },
5
3
  listDocs: { method: "GET", path: "/api/workspaces/:workspaceId/docs" },
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@ import { loginWithPassword } from "./auth.js";
16
16
  import { registerAuthTools } from "./tools/auth.js";
17
17
  const config = loadConfig();
18
18
  async function buildServer() {
19
- const server = new McpServer({ name: "affine-mcp", version: "1.2.1" });
19
+ const server = new McpServer({ name: "affine-mcp", version: "1.2.2" });
20
20
  // Initialize GraphQL client with authentication
21
21
  const gql = new GraphQLClient({
22
22
  endpoint: `${config.baseUrl}${config.graphqlPath}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "affine-mcp-server",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Model Context Protocol server for AFFiNE - enables AI assistants to interact with AFFiNE workspaces, documents, and collaboration features.",
@@ -20,7 +20,7 @@
20
20
  ],
21
21
  "main": "dist/index.js",
22
22
  "bin": {
23
- "affine-mcp": "dist/index.js"
23
+ "affine-mcp": "bin/affine-mcp"
24
24
  },
25
25
  "scripts": {
26
26
  "build": "tsc -p tsconfig.json",
@@ -29,6 +29,7 @@
29
29
  "prepublishOnly": "npm run build"
30
30
  },
31
31
  "files": [
32
+ "bin",
32
33
  "dist",
33
34
  "README.md",
34
35
  "LICENSE"
@@ -41,7 +42,6 @@
41
42
  },
42
43
  "dependencies": {
43
44
  "@modelcontextprotocol/sdk": "^1.17.2",
44
- "dotenv": "^16.6.1",
45
45
  "form-data": "^4.0.4",
46
46
  "node-fetch": "^3.3.2",
47
47
  "socket.io-client": "^4.8.1",