Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ To authenticate and save credentials:

To integrate this server with the desktop app, add the following to your app's server configuration:

#### MacOS

```json
{
"mcpServers": {
Expand All @@ -106,3 +108,18 @@ To integrate this server with the desktop app, add the following to your app's s
}
}
```

#### Windows

```json
{
"mcpServers": {
"gtasks": {
"command": "C:\\Program Files\\nodejs\\node.exe",
"args": [
"{ABSOLUTE PATH TO FILE HERE}\\dist\\index.js"
]
}
}
}
```
19 changes: 10 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import {
import fs from "fs";
import { google, tasks_v1 } from "googleapis";
import path from "path";
import { fileURLToPath } from "url";
import { TaskActions, TaskResources } from "./Tasks.js";
import { Console } from "console";

const tasks = google.tasks("v1");

Expand Down Expand Up @@ -232,18 +234,18 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
}
throw new Error("Tool not found");
});
const folderPath = path.dirname(fileURLToPath(import.meta.url));
//const folderPath = path.dirname(path.fileURLToPath(import.meta.url));

const credentialsPath = path.join(
path.dirname(new URL(import.meta.url).pathname),
"../.gtasks-server-credentials.json",
);
function getFilePath(relativePath: string): string {
return path.join(folderPath, relativePath);
}

const credentialsPath = getFilePath("../.gtasks-server-credentials.json");

async function authenticateAndSaveCredentials() {
console.log("Launching auth flow…");
const p = path.join(
path.dirname(new URL(import.meta.url).pathname),
"../gcp-oauth.keys.json",
);
const p = getFilePath("../gcp-oauth.keys.json");

console.log(p);
const auth = await authenticate({
Expand All @@ -261,7 +263,6 @@ async function loadCredentialsAndRunServer() {
);
process.exit(1);
}

const credentials = JSON.parse(fs.readFileSync(credentialsPath, "utf-8"));
const auth = new google.auth.OAuth2();
auth.setCredentials(credentials);
Expand Down