@anyproto/anytype-mcp 1.2.2 → 1.2.4

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/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "mcp",
8
8
  "server"
9
9
  ],
10
- "version": "1.2.2",
10
+ "version": "1.2.4",
11
11
  "license": "MIT",
12
12
  "type": "module",
13
13
  "scripts": {
@@ -25,29 +25,29 @@
25
25
  "anytype-mcp": "bin/cli.mjs"
26
26
  },
27
27
  "dependencies": {
28
- "@modelcontextprotocol/sdk": "1.26.0",
29
- "axios": "1.13.5",
28
+ "@modelcontextprotocol/sdk": "1.27.1",
29
+ "axios": "1.13.6",
30
30
  "form-data": "4.0.5",
31
31
  "mustache": "4.2.0",
32
32
  "node-fetch": "3.3.2",
33
- "openapi-client-axios": "7.8.0",
33
+ "openapi-client-axios": "7.9.0",
34
34
  "openapi-schema-validator": "12.1.3",
35
35
  "openapi-types": "12.1.3",
36
36
  "zod": "4.3.6"
37
37
  },
38
38
  "devDependencies": {
39
- "@anthropic-ai/sdk": "0.74.0",
39
+ "@anthropic-ai/sdk": "0.78.0",
40
40
  "@eslint/js": "9.39.2",
41
41
  "@types/json-schema": "7.0.15",
42
42
  "@types/mustache": "4.2.6",
43
- "@types/node": "25.2.3",
43
+ "@types/node": "25.3.3",
44
44
  "@types/which": "3.0.4",
45
45
  "@vitest/coverage-v8": "4.0.18",
46
- "@typescript-eslint/eslint-plugin": "8.56.0",
47
- "@typescript-eslint/parser": "8.56.0",
46
+ "@typescript-eslint/eslint-plugin": "8.56.1",
47
+ "@typescript-eslint/parser": "8.56.1",
48
48
  "eslint": "9.39.2",
49
49
  "esbuild": "0.27.3",
50
- "openai": "6.22.0",
50
+ "openai": "6.25.0",
51
51
  "prettier": "3.8.1",
52
52
  "prettier-plugin-organize-imports": "4.3.0",
53
53
  "tsx": "4.21.0",
@@ -1,12 +1,12 @@
1
- import { AppKeyGenerator } from "../src/auth/get-key";
1
+ import { ApiKeyGenerator } from "../src/auth/get-key";
2
2
  import { initProxy, loadOpenApiSpec, ValidationError } from "../src/init-server";
3
3
  import { determineBaseUrl } from "../src/utils/base-url";
4
4
 
5
- async function generateAppKey(specPath?: string) {
5
+ async function generateApiKey(specPath?: string) {
6
6
  const openApiSpec = await loadOpenApiSpec(specPath);
7
7
  const baseUrl = determineBaseUrl(openApiSpec);
8
- const generator = new AppKeyGenerator(baseUrl);
9
- await generator.generateAppKey();
8
+ const generator = new ApiKeyGenerator(baseUrl);
9
+ await generator.generateApiKey();
10
10
  }
11
11
 
12
12
  export async function main(args: string[] = process.argv.slice(2)) {
@@ -14,7 +14,7 @@ export async function main(args: string[] = process.argv.slice(2)) {
14
14
  if (!command || command === "run") {
15
15
  await initProxy(specPath);
16
16
  } else if (command === "get-key") {
17
- await generateAppKey(specPath);
17
+ await generateApiKey(specPath);
18
18
  } else {
19
19
  console.error(`Error: Unknown command "${command}"`);
20
20
  process.exit(1);
@@ -2,10 +2,10 @@ import axios from "axios";
2
2
  import * as readline from "readline";
3
3
 
4
4
  interface AuthToken {
5
- app_key: string;
5
+ api_key: string;
6
6
  }
7
7
 
8
- export class AppKeyGenerator {
8
+ export class ApiKeyGenerator {
9
9
  private readonly rl: readline.Interface;
10
10
  private readonly appName: string = "anytype_mcp_server";
11
11
  private readonly basePath: string;
@@ -24,8 +24,8 @@ export class AppKeyGenerator {
24
24
  });
25
25
  }
26
26
 
27
- private displaySuccessMessage(appKey: string, anytypeVersion: string): void {
28
- console.log(`\nYour APP KEY: ${appKey}`);
27
+ private displaySuccessMessage(apiKey: string, anytypeVersion: string): void {
28
+ console.log(`\nYour API KEY: ${apiKey}`);
29
29
  console.log("\nAdd this to your MCP settings file as:");
30
30
  console.log(`
31
31
  {
@@ -37,7 +37,7 @@ export class AppKeyGenerator {
37
37
  "@anyproto/anytype-mcp",
38
38
  ],
39
39
  "env": {
40
- "OPENAPI_MCP_HEADERS": "{\\"Authorization\\":\\"Bearer ${appKey}\\", \\"Anytype-Version\\":\\"${anytypeVersion}\\"}"
40
+ "OPENAPI_MCP_HEADERS": "{\\"Authorization\\":\\"Bearer ${apiKey}\\", \\"Anytype-Version\\":\\"${anytypeVersion}\\"}"
41
41
  }
42
42
  }
43
43
  }
@@ -51,9 +51,7 @@ export class AppKeyGenerator {
51
51
  */
52
52
  private async startAuthentication(): Promise<string> {
53
53
  try {
54
- const response = await axios.post(`${this.basePath}/v1/auth/display_code`, null, {
55
- params: { app_name: this.appName },
56
- });
54
+ const response = await axios.post(`${this.basePath}/v1/auth/challenges`, { app_name: this.appName });
57
55
 
58
56
  if (!response.data?.challenge_id) {
59
57
  throw new Error("Failed to get challenge ID");
@@ -75,34 +73,35 @@ export class AppKeyGenerator {
75
73
  private async completeAuthentication(
76
74
  challengeId: string,
77
75
  code: string,
78
- ): Promise<{ appKey: string; anytypeVersion: string }> {
76
+ ): Promise<{ apiKey: string; anytypeVersion: string }> {
79
77
  try {
80
- const response = await axios.post<AuthToken>(`${this.basePath}/v1/auth/token`, null, {
81
- params: { challenge_id: challengeId, code: code },
78
+ const response = await axios.post<AuthToken>(`${this.basePath}/v1/auth/api_keys`, {
79
+ challenge_id: challengeId,
80
+ code: code,
82
81
  });
83
82
 
84
- if (!response.data?.app_key) {
85
- throw new Error("Authentication failed: No app key received");
83
+ if (!response.data?.api_key) {
84
+ throw new Error("Authentication failed: No api key received");
86
85
  }
87
86
 
88
- return { appKey: response.data.app_key, anytypeVersion: response.headers["anytype-version"] };
87
+ return { apiKey: response.data.api_key, anytypeVersion: response.headers["anytype-version"] };
89
88
  } catch (error) {
90
89
  console.error("Authentication error:", error instanceof Error ? error.message : error);
91
90
  throw new Error("Failed to complete authentication");
92
91
  }
93
92
  }
94
93
 
95
- public async generateAppKey(): Promise<void> {
94
+ public async generateApiKey(): Promise<void> {
96
95
  try {
97
- console.log("Starting authentication to get app key...");
96
+ console.log("Starting authentication to get API key...");
98
97
 
99
98
  const challengeId = await this.startAuthentication();
100
99
  console.log("Please check Anytype Desktop for the 4-digit code");
101
100
  const code = await this.prompt("Enter the 4-digit code shown in Anytype Desktop: ");
102
101
 
103
- const { appKey, anytypeVersion } = await this.completeAuthentication(challengeId, code);
102
+ const { apiKey, anytypeVersion } = await this.completeAuthentication(challengeId, code);
104
103
  console.log("Authenticated successfully!");
105
- this.displaySuccessMessage(appKey, anytypeVersion);
104
+ this.displaySuccessMessage(apiKey, anytypeVersion);
106
105
  } catch (error) {
107
106
  console.error("Error:", error instanceof Error ? error.message : error);
108
107
  process.exit(1);