@shivaduke28/gmail-mcp 1.0.0 → 1.1.0
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/dist/index.js +6 -5
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { encode } from "@toon-format/toon";
|
|
6
|
-
import { authorize } from "@shivaduke28/google-mcp-auth";
|
|
6
|
+
import { authorize, resolvePath } from "@shivaduke28/google-mcp-auth";
|
|
7
7
|
import { gmail as googleGmail } from "@googleapis/gmail";
|
|
8
8
|
import { extractHeaders, extractBody, buildRawMessage } from "./gmail.js";
|
|
9
9
|
import { existsSync } from "node:fs";
|
|
@@ -12,17 +12,18 @@ import { join } from "node:path";
|
|
|
12
12
|
const SCOPES = [
|
|
13
13
|
"https://www.googleapis.com/auth/gmail.modify",
|
|
14
14
|
];
|
|
15
|
-
const
|
|
16
|
-
if (!
|
|
15
|
+
const rawCredentialsPath = process.env.GOOGLE_OAUTH_CREDENTIALS;
|
|
16
|
+
if (!rawCredentialsPath) {
|
|
17
17
|
console.error("GOOGLE_OAUTH_CREDENTIALS 環境変数を設定してください");
|
|
18
18
|
process.exit(1);
|
|
19
19
|
}
|
|
20
|
+
const credentialsPath = resolvePath(rawCredentialsPath);
|
|
20
21
|
if (!existsSync(credentialsPath)) {
|
|
21
22
|
console.error(`credentials.json が見つかりません: ${credentialsPath}`);
|
|
22
23
|
process.exit(1);
|
|
23
24
|
}
|
|
24
25
|
const resolvedCredentialsPath = credentialsPath;
|
|
25
|
-
const resolvedTokensPath = process.env.GOOGLE_OAUTH_TOKENS
|
|
26
|
+
const resolvedTokensPath = process.env.GOOGLE_OAUTH_TOKENS ? resolvePath(process.env.GOOGLE_OAUTH_TOKENS) : join(homedir(), ".config", "gmail-mcp", "tokens.json");
|
|
26
27
|
// lazy auth: ツール呼び出し時に初めて認証する
|
|
27
28
|
let gmailClient = null;
|
|
28
29
|
async function getGmail() {
|
|
@@ -34,7 +35,7 @@ async function getGmail() {
|
|
|
34
35
|
}
|
|
35
36
|
const server = new McpServer({
|
|
36
37
|
name: "gmail-mcp",
|
|
37
|
-
version: "1.
|
|
38
|
+
version: "1.1.0",
|
|
38
39
|
});
|
|
39
40
|
// 1. search-messages
|
|
40
41
|
server.registerTool("search-messages", {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shivaduke28/gmail-mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
31
31
|
"@toon-format/toon": "^2.1.0",
|
|
32
32
|
"zod": "^4.3.6",
|
|
33
|
-
"@shivaduke28/google-mcp-auth": "1.
|
|
33
|
+
"@shivaduke28/google-mcp-auth": "1.1.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "^25.2.3",
|