togello-mcp-server 1.0.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 -0
- package/build/client.js +21 -0
- package/build/handlers/tasksHandler.js +36 -0
- package/build/index.js +20 -0
- package/package.json +28 -0
package/README.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Togello MCP Server
|
|
2
|
+
|
|
3
|
+
This server implements the Model Context Protocol (MCP) for managing context in applications.
|
|
4
|
+
|
|
5
|
+
## Using npm
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
{
|
|
9
|
+
"mcpServers": {
|
|
10
|
+
"togello": {
|
|
11
|
+
"command": "npx",
|
|
12
|
+
"args": ["-y", "@togello/togello-mcp-server"],
|
|
13
|
+
"env": {
|
|
14
|
+
"TOGELLO_API_TOKEN": "replace_with_your_token",
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
```
|
package/build/client.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const API_BASE_URL = "https://togello.api.toru-takagi.dev";
|
|
2
|
+
export const httpClient = {
|
|
3
|
+
fetchURL: async ({ path }) => {
|
|
4
|
+
const token = process.env.TOGELLO_API_TOKEN;
|
|
5
|
+
if (!token) {
|
|
6
|
+
throw new Error("environment variable TOGELLO_API_TOKEN is not set");
|
|
7
|
+
}
|
|
8
|
+
const url = `${API_BASE_URL}${path}`;
|
|
9
|
+
const response = await fetch(url, {
|
|
10
|
+
method: "GET",
|
|
11
|
+
headers: {
|
|
12
|
+
Authorization: `Bearer ${token}`,
|
|
13
|
+
"Content-Type": "application/json",
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
if (!response.ok) {
|
|
17
|
+
throw new Error(`response status: ${response.status}`);
|
|
18
|
+
}
|
|
19
|
+
return (await response.json());
|
|
20
|
+
},
|
|
21
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { httpClient } from "../client.js";
|
|
2
|
+
export const tasksHandler = async (uri, {}) => {
|
|
3
|
+
try {
|
|
4
|
+
const tasks = await httpClient.fetchURL({
|
|
5
|
+
path: "/v2/integration/todo",
|
|
6
|
+
});
|
|
7
|
+
return {
|
|
8
|
+
contents: [
|
|
9
|
+
{
|
|
10
|
+
type: "text",
|
|
11
|
+
uri: uri.href,
|
|
12
|
+
text: tasks
|
|
13
|
+
.map((todo) => JSON.stringify({
|
|
14
|
+
label: todo.label,
|
|
15
|
+
scheduledStartDate: todo.scheduledStartDate,
|
|
16
|
+
scheduledEndDate: todo.scheduledEndDate,
|
|
17
|
+
priorityNumber: todo.priorityNumber,
|
|
18
|
+
}))
|
|
19
|
+
.join(","),
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
console.error("Error in resource handler:", error);
|
|
26
|
+
return {
|
|
27
|
+
contents: [
|
|
28
|
+
{
|
|
29
|
+
type: "text",
|
|
30
|
+
uri: uri.href,
|
|
31
|
+
text: `Error in resource handler: ${error}`,
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
};
|
package/build/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { tasksHandler } from "./handlers/tasksHandler.js";
|
|
5
|
+
const server = new McpServer({
|
|
6
|
+
name: "togello",
|
|
7
|
+
version: "1.0.0",
|
|
8
|
+
capabilities: {
|
|
9
|
+
resources: {},
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
async function main() {
|
|
13
|
+
const transport = new StdioServerTransport();
|
|
14
|
+
server.resource("togello-todos", "togello://tasks", tasksHandler);
|
|
15
|
+
await server.connect(transport);
|
|
16
|
+
}
|
|
17
|
+
main().catch((error) => {
|
|
18
|
+
console.error("Fatal error in main():", error);
|
|
19
|
+
process.exit(1);
|
|
20
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "module",
|
|
3
|
+
"name": "togello-mcp-server",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsc && chmod 755 build/index.js",
|
|
8
|
+
"start": "node build/index.js",
|
|
9
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [],
|
|
12
|
+
"author": "",
|
|
13
|
+
"license": "ISC",
|
|
14
|
+
"description": "",
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@modelcontextprotocol/sdk": "^1.9.0"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@types/node": "^22.14.1",
|
|
20
|
+
"typescript": "^5.8.3"
|
|
21
|
+
},
|
|
22
|
+
"bin": {
|
|
23
|
+
"togello": "./build/index.js"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"build"
|
|
27
|
+
]
|
|
28
|
+
}
|