gmcp 0.2.1 → 0.3.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/README.md +20 -6
- package/dist/auth-cli.js +19 -24
- package/dist/cli.js +42 -47
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
<p align="center">
|
|
11
11
|
<a href="https://www.npmjs.com/package/gmcp" rel="nofollow"><img src="https://img.shields.io/npm/v/gmcp.svg" alt="npm"></a>
|
|
12
12
|
<a href="https://hub.docker.com/r/johnie/gmcp" rel="nofollow"><img src="https://img.shields.io/docker/pulls/johnie/gmcp" alt="Docker Pulls"></a>
|
|
13
|
-
<a href="https://opensource.org/licenses/MIT" rel="nofollow"><img src="https://img.shields.io/github/license/johnie/gmcp" alt="License"></a>
|
|
14
13
|
<a href="https://github.com/johnie/gmcp" rel="nofollow"><img src="https://img.shields.io/github/stars/johnie/gmcp" alt="stars"></a>
|
|
15
14
|
</p>
|
|
16
15
|
|
|
@@ -61,10 +60,10 @@ bun install
|
|
|
61
60
|
|
|
62
61
|
```bash
|
|
63
62
|
# If installed globally
|
|
64
|
-
gmcp
|
|
63
|
+
gmcp auth
|
|
65
64
|
|
|
66
65
|
# Or with npx
|
|
67
|
-
npx gmcp
|
|
66
|
+
npx gmcp auth
|
|
68
67
|
|
|
69
68
|
# Or from source
|
|
70
69
|
bun run auth
|
|
@@ -76,10 +75,11 @@ Follow the prompts to authorize. The browser will show "connection refused" afte
|
|
|
76
75
|
|
|
77
76
|
```bash
|
|
78
77
|
# Globally installed
|
|
79
|
-
gmcp
|
|
78
|
+
gmcp start
|
|
79
|
+
# or just: gmcp
|
|
80
80
|
|
|
81
81
|
# With npx
|
|
82
|
-
npx gmcp
|
|
82
|
+
npx gmcp start
|
|
83
83
|
|
|
84
84
|
# From source
|
|
85
85
|
bun run start
|
|
@@ -135,7 +135,7 @@ Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
|
135
135
|
"mcpServers": {
|
|
136
136
|
"gmcp": {
|
|
137
137
|
"command": "bun",
|
|
138
|
-
"args": ["run", "/path/to/gmcp/src/
|
|
138
|
+
"args": ["run", "/path/to/gmcp/src/cli.ts"],
|
|
139
139
|
"env": {
|
|
140
140
|
"GOOGLE_CREDENTIALS_PATH": "/path/to/credentials.json",
|
|
141
141
|
"GOOGLE_TOKEN_PATH": "/path/to/token.json",
|
|
@@ -210,6 +210,20 @@ GOOGLE_SCOPES=gmail.readonly,calendar.readonly
|
|
|
210
210
|
GOOGLE_SCOPES=gmail.readonly,gmail.modify,gmail.send,calendar.events
|
|
211
211
|
```
|
|
212
212
|
|
|
213
|
+
## CLI Reference
|
|
214
|
+
|
|
215
|
+
```
|
|
216
|
+
gmcp [command]
|
|
217
|
+
|
|
218
|
+
Commands:
|
|
219
|
+
start Start MCP server (default)
|
|
220
|
+
auth Run OAuth2 authentication flow
|
|
221
|
+
|
|
222
|
+
Options:
|
|
223
|
+
--help, -h Show usage
|
|
224
|
+
--version, -v Show version
|
|
225
|
+
```
|
|
226
|
+
|
|
213
227
|
## Testing
|
|
214
228
|
|
|
215
229
|
```bash
|
package/dist/auth-cli.js
CHANGED
|
@@ -10,19 +10,8 @@ import {
|
|
|
10
10
|
import"./shared/chunk-3s189drz.js";
|
|
11
11
|
|
|
12
12
|
// src/auth-cli.ts
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
const rl = createInterface({
|
|
16
|
-
input: process.stdin,
|
|
17
|
-
output: process.stdout
|
|
18
|
-
});
|
|
19
|
-
return new Promise((resolve) => {
|
|
20
|
-
rl.on("line", (line) => {
|
|
21
|
-
rl.close();
|
|
22
|
-
resolve(line.trim());
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
}
|
|
13
|
+
import { input } from "@inquirer/prompts";
|
|
14
|
+
import kleur from "kleur";
|
|
26
15
|
async function runAuth() {
|
|
27
16
|
console.log(`GMCP Server - OAuth2 Authentication
|
|
28
17
|
`);
|
|
@@ -39,7 +28,7 @@ async function runAuth() {
|
|
|
39
28
|
========================================`);
|
|
40
29
|
console.log("STEP 1: Visit this URL to authorize:");
|
|
41
30
|
console.log("========================================");
|
|
42
|
-
console.log(
|
|
31
|
+
console.log(kleur.cyan(authUrl));
|
|
43
32
|
console.log(`
|
|
44
33
|
========================================`);
|
|
45
34
|
console.log("STEP 2: After authorizing:");
|
|
@@ -54,24 +43,30 @@ Copy the entire code after "code=" (the long string before "&scope")`);
|
|
|
54
43
|
console.log(`
|
|
55
44
|
========================================`);
|
|
56
45
|
console.log("STEP 3: Paste the authorization code below:");
|
|
57
|
-
console.log(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
46
|
+
console.log(`========================================
|
|
47
|
+
`);
|
|
48
|
+
const code = await input({
|
|
49
|
+
message: "Authorization code:",
|
|
50
|
+
required: true,
|
|
51
|
+
validate: (value) => {
|
|
52
|
+
if (value.length < 10) {
|
|
53
|
+
return "Authorization code appears too short";
|
|
54
|
+
}
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
63
58
|
console.log(`
|
|
64
59
|
Exchanging authorization code for tokens...`);
|
|
65
60
|
try {
|
|
66
61
|
const tokens = await getTokensFromCode(oauth2Client, code);
|
|
67
62
|
await saveTokens(tokenPath, tokens);
|
|
68
|
-
console.log(
|
|
69
|
-
Success! Tokens saved to
|
|
63
|
+
console.log(kleur.green(`
|
|
64
|
+
Success! Tokens saved to ${tokenPath}`));
|
|
70
65
|
console.log(`
|
|
71
66
|
You can now run the MCP server with: npx gmcp`);
|
|
72
67
|
} catch (error) {
|
|
73
|
-
console.error(
|
|
74
|
-
Error exchanging code for tokens:`);
|
|
68
|
+
console.error(kleur.red(`
|
|
69
|
+
Error exchanging code for tokens:`));
|
|
75
70
|
console.error(error);
|
|
76
71
|
process.exit(1);
|
|
77
72
|
}
|
package/dist/cli.js
CHANGED
|
@@ -7,56 +7,51 @@ import {
|
|
|
7
7
|
} from "./shared/chunk-3s189drz.js";
|
|
8
8
|
|
|
9
9
|
// src/cli.ts
|
|
10
|
-
|
|
11
|
-
Usage: gmcp [command]
|
|
10
|
+
import { run } from "@stricli/core";
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
auth Run OAuth2 authentication flow
|
|
12
|
+
// src/cli/app.ts
|
|
13
|
+
import { buildApplication, buildRouteMap } from "@stricli/core";
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
// src/cli/commands/auth.ts
|
|
16
|
+
import { buildCommand } from "@stricli/core";
|
|
17
|
+
var authCommand = buildCommand({
|
|
18
|
+
func: async () => {
|
|
19
|
+
const { runAuth } = await import("./auth-cli.js");
|
|
20
|
+
await runAuth();
|
|
21
|
+
},
|
|
22
|
+
parameters: {},
|
|
23
|
+
docs: { brief: "Run OAuth2 authentication flow" }
|
|
24
|
+
});
|
|
20
25
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
`.trim();
|
|
26
|
-
function showHelp() {
|
|
27
|
-
console.log(USAGE);
|
|
28
|
-
}
|
|
29
|
-
async function showVersion() {
|
|
30
|
-
const version = await getVersion();
|
|
31
|
-
console.log(`gmcp v${version}`);
|
|
32
|
-
}
|
|
33
|
-
async function main() {
|
|
34
|
-
const args = process.argv.slice(2);
|
|
35
|
-
const command = args[0];
|
|
36
|
-
if (command === "--help" || command === "-h") {
|
|
37
|
-
showHelp();
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
if (command === "--version" || command === "-v") {
|
|
41
|
-
await showVersion();
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
if (!command || command === "start") {
|
|
26
|
+
// src/cli/commands/start.ts
|
|
27
|
+
import { buildCommand as buildCommand2 } from "@stricli/core";
|
|
28
|
+
var startCommand = buildCommand2({
|
|
29
|
+
func: async () => {
|
|
45
30
|
const { startServer } = await import("./index.js");
|
|
46
31
|
await startServer();
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
main().catch((error) => {
|
|
60
|
-
console.error("Fatal error:", error);
|
|
61
|
-
process.exit(1);
|
|
32
|
+
},
|
|
33
|
+
parameters: {},
|
|
34
|
+
docs: { brief: "Start the MCP server" }
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// src/cli/app.ts
|
|
38
|
+
var routes = buildRouteMap({
|
|
39
|
+
routes: {
|
|
40
|
+
start: startCommand,
|
|
41
|
+
auth: authCommand
|
|
42
|
+
},
|
|
43
|
+
docs: { brief: "GMCP - Gmail and Calendar MCP Server" }
|
|
62
44
|
});
|
|
45
|
+
async function createApp() {
|
|
46
|
+
const version = await getVersion();
|
|
47
|
+
return buildApplication(routes, {
|
|
48
|
+
name: "gmcp",
|
|
49
|
+
versionInfo: { currentVersion: version }
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// src/cli.ts
|
|
54
|
+
var app = await createApp();
|
|
55
|
+
var args = process.argv.slice(2);
|
|
56
|
+
var effectiveArgs = args.length === 0 ? ["start"] : args;
|
|
57
|
+
await run(app, effectiveArgs, { process });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gmcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "GMCP Server for Google Workspace with OAuth2 authentication",
|
|
5
5
|
"module": "src/index.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -44,9 +44,12 @@
|
|
|
44
44
|
"anthropic"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
+
"@inquirer/prompts": "^8.2.0",
|
|
47
48
|
"@modelcontextprotocol/sdk": "^1.25.3",
|
|
49
|
+
"@stricli/core": "^1.2.5",
|
|
48
50
|
"googleapis": "^170.1.0",
|
|
49
51
|
"json2md": "^2.0.3",
|
|
52
|
+
"kleur": "^4.1.5",
|
|
50
53
|
"pino": "^9.7.0",
|
|
51
54
|
"pino-pretty": "^13.0.0",
|
|
52
55
|
"zod": "^4.3.6"
|