@manhq/localmcp 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.
Files changed (106) hide show
  1. package/README.md +239 -0
  2. package/README.vi.md +239 -0
  3. package/bin/localmcp.js +31 -0
  4. package/dist/cli.d.ts +2 -0
  5. package/dist/cli.d.ts.map +1 -0
  6. package/dist/cli.js +333 -0
  7. package/dist/cli.js.map +1 -0
  8. package/dist/index.d.ts +4 -0
  9. package/dist/index.d.ts.map +1 -0
  10. package/dist/index.js +102 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/services/atlassian/client.d.ts +4 -0
  13. package/dist/services/atlassian/client.d.ts.map +1 -0
  14. package/dist/services/atlassian/client.js +26 -0
  15. package/dist/services/atlassian/client.js.map +1 -0
  16. package/dist/services/atlassian/index.d.ts +3 -0
  17. package/dist/services/atlassian/index.d.ts.map +1 -0
  18. package/dist/services/atlassian/index.js +7 -0
  19. package/dist/services/atlassian/index.js.map +1 -0
  20. package/dist/services/atlassian/tools/confluence.d.ts +3 -0
  21. package/dist/services/atlassian/tools/confluence.d.ts.map +1 -0
  22. package/dist/services/atlassian/tools/confluence.js +222 -0
  23. package/dist/services/atlassian/tools/confluence.js.map +1 -0
  24. package/dist/services/atlassian/tools/jira.d.ts +3 -0
  25. package/dist/services/atlassian/tools/jira.d.ts.map +1 -0
  26. package/dist/services/atlassian/tools/jira.js +266 -0
  27. package/dist/services/atlassian/tools/jira.js.map +1 -0
  28. package/dist/services/atlassian/types.d.ts +74 -0
  29. package/dist/services/atlassian/types.d.ts.map +1 -0
  30. package/dist/services/atlassian/types.js +2 -0
  31. package/dist/services/atlassian/types.js.map +1 -0
  32. package/dist/services/figma/client.d.ts +3 -0
  33. package/dist/services/figma/client.d.ts.map +1 -0
  34. package/dist/services/figma/client.js +27 -0
  35. package/dist/services/figma/client.js.map +1 -0
  36. package/dist/services/figma/index.d.ts +3 -0
  37. package/dist/services/figma/index.d.ts.map +1 -0
  38. package/dist/services/figma/index.js +13 -0
  39. package/dist/services/figma/index.js.map +1 -0
  40. package/dist/services/figma/tools/comments.d.ts +3 -0
  41. package/dist/services/figma/tools/comments.d.ts.map +1 -0
  42. package/dist/services/figma/tools/comments.js +41 -0
  43. package/dist/services/figma/tools/comments.js.map +1 -0
  44. package/dist/services/figma/tools/components.d.ts +3 -0
  45. package/dist/services/figma/tools/components.d.ts.map +1 -0
  46. package/dist/services/figma/tools/components.js +101 -0
  47. package/dist/services/figma/tools/components.js.map +1 -0
  48. package/dist/services/figma/tools/files.d.ts +3 -0
  49. package/dist/services/figma/tools/files.d.ts.map +1 -0
  50. package/dist/services/figma/tools/files.js +86 -0
  51. package/dist/services/figma/tools/files.js.map +1 -0
  52. package/dist/services/figma/tools/images.d.ts +3 -0
  53. package/dist/services/figma/tools/images.d.ts.map +1 -0
  54. package/dist/services/figma/tools/images.js +67 -0
  55. package/dist/services/figma/tools/images.js.map +1 -0
  56. package/dist/services/figma/tools/variables.d.ts +3 -0
  57. package/dist/services/figma/tools/variables.d.ts.map +1 -0
  58. package/dist/services/figma/tools/variables.js +44 -0
  59. package/dist/services/figma/tools/variables.js.map +1 -0
  60. package/dist/services/figma/types.d.ts +65 -0
  61. package/dist/services/figma/types.d.ts.map +1 -0
  62. package/dist/services/figma/types.js +2 -0
  63. package/dist/services/figma/types.js.map +1 -0
  64. package/dist/services/google-chat/auth.d.ts +2 -0
  65. package/dist/services/google-chat/auth.d.ts.map +1 -0
  66. package/dist/services/google-chat/auth.js +18 -0
  67. package/dist/services/google-chat/auth.js.map +1 -0
  68. package/dist/services/google-chat/client.d.ts +3 -0
  69. package/dist/services/google-chat/client.d.ts.map +1 -0
  70. package/dist/services/google-chat/client.js +14 -0
  71. package/dist/services/google-chat/client.js.map +1 -0
  72. package/dist/services/google-chat/index.d.ts +3 -0
  73. package/dist/services/google-chat/index.d.ts.map +1 -0
  74. package/dist/services/google-chat/index.js +5 -0
  75. package/dist/services/google-chat/index.js.map +1 -0
  76. package/dist/services/google-chat/tools/messages.d.ts +3 -0
  77. package/dist/services/google-chat/tools/messages.d.ts.map +1 -0
  78. package/dist/services/google-chat/tools/messages.js +144 -0
  79. package/dist/services/google-chat/tools/messages.js.map +1 -0
  80. package/dist/services/google-chat/types.d.ts +31 -0
  81. package/dist/services/google-chat/types.d.ts.map +1 -0
  82. package/dist/services/google-chat/types.js +2 -0
  83. package/dist/services/google-chat/types.js.map +1 -0
  84. package/dist/shared/env.d.ts +18 -0
  85. package/dist/shared/env.d.ts.map +1 -0
  86. package/dist/shared/env.js +27 -0
  87. package/dist/shared/env.js.map +1 -0
  88. package/dist/shared/errors.d.ts +8 -0
  89. package/dist/shared/errors.d.ts.map +1 -0
  90. package/dist/shared/errors.js +38 -0
  91. package/dist/shared/errors.js.map +1 -0
  92. package/dist/shared/response.d.ts +7 -0
  93. package/dist/shared/response.d.ts.map +1 -0
  94. package/dist/shared/response.js +7 -0
  95. package/dist/shared/response.js.map +1 -0
  96. package/dist/shared/settings.d.ts +36 -0
  97. package/dist/shared/settings.d.ts.map +1 -0
  98. package/dist/shared/settings.js +104 -0
  99. package/dist/shared/settings.js.map +1 -0
  100. package/docs/atlassian.md +170 -0
  101. package/docs/figma.md +154 -0
  102. package/docs/google-chat.md +130 -0
  103. package/docs/vi/atlassian.md +170 -0
  104. package/docs/vi/figma.md +154 -0
  105. package/docs/vi/google-chat.md +130 -0
  106. package/package.json +53 -0
@@ -0,0 +1,154 @@
1
+ # Figma
2
+
3
+ [English](../figma.md) | [Tiếng Việt](figma.md)
4
+
5
+ Tích hợp Figma API — cho phép đọc file thiết kế, lấy design tokens, xuất ảnh, và quản lý bình luận.
6
+
7
+ ## Biến môi trường
8
+
9
+ | Biến | Bắt buộc | Mô tả |
10
+ |------|----------|-------|
11
+ | `FIGMA_HOST` | Có | Địa chỉ API, mặc định `https://api.figma.com/v1` |
12
+ | `FIGMA_TOKEN` | Có | Personal access token từ cài đặt tài khoản Figma |
13
+
14
+ Service chỉ được bật khi **cả hai** biến trên có giá trị.
15
+
16
+ ### Lấy token
17
+
18
+ 1. Vào [Figma Account Settings](https://www.figma.com/settings)
19
+ 2. Cuộn xuống phần **Personal access tokens** → tạo token mới
20
+ 3. Điền vào `.env`:
21
+ ```
22
+ FIGMA_HOST=https://api.figma.com/v1
23
+ FIGMA_TOKEN=figd_xxxxxxxxxxxx
24
+ ```
25
+
26
+ ## Endpoint MCP
27
+
28
+ ```
29
+ http://localhost:47001/mcp/figma
30
+ ```
31
+
32
+ ## Đăng ký với AI Agents
33
+
34
+ **Claude Code** — `.claude/settings.local.json`
35
+ ```json
36
+ {
37
+ "mcpServers": {
38
+ "figma": {
39
+ "url": "http://localhost:47001/mcp/figma"
40
+ }
41
+ }
42
+ }
43
+ ```
44
+
45
+ Hoặc đăng ký bằng command line:
46
+ ```bash
47
+ claude mcp add --transport http figma http://localhost:47001/mcp/figma
48
+ ```
49
+
50
+ **Codex** — `~/.codex/config.toml`
51
+ ```toml
52
+ [mcp_servers.figma]
53
+ url = "http://localhost:47001/mcp/figma"
54
+ ```
55
+
56
+ Hoặc đăng ký bằng command line:
57
+ ```bash
58
+ codex mcp add figma --url http://localhost:47001/mcp/figma
59
+ ```
60
+
61
+ **GitHub Copilot / VS Code** — `.vscode/mcp.json`
62
+ ```json
63
+ {
64
+ "servers": {
65
+ "figma": {
66
+ "type": "http",
67
+ "url": "http://localhost:47001/mcp/figma"
68
+ }
69
+ }
70
+ }
71
+ ```
72
+
73
+ **Cursor** — `.cursor/mcp.json`
74
+ ```json
75
+ {
76
+ "mcpServers": {
77
+ "figma": {
78
+ "url": "http://localhost:47001/mcp/figma"
79
+ }
80
+ }
81
+ }
82
+ ```
83
+
84
+ **Windsurf** — `~/.codeium/windsurf/mcp_config.json`
85
+ ```json
86
+ {
87
+ "mcpServers": {
88
+ "figma": {
89
+ "serverUrl": "http://localhost:47001/mcp/figma"
90
+ }
91
+ }
92
+ }
93
+ ```
94
+
95
+ **Antigravity** — `~/.gemini/config/mcp_config.json`
96
+ ```json
97
+ {
98
+ "mcpServers": {
99
+ "figma": {
100
+ "serverUrl": "http://localhost:47001/mcp/figma"
101
+ }
102
+ }
103
+ }
104
+ ```
105
+
106
+ ## Danh sách tools
107
+
108
+ ### File & Node
109
+
110
+ | Tool | Mô tả |
111
+ |------|-------|
112
+ | `figma_get_metadata` | Lấy cấu trúc cây của file hoặc một node cụ thể: tên, ID, kiểu, bounding box. Dùng trước khi lấy chi tiết thiết kế. |
113
+ | `figma_get_design_context` | Lấy toàn bộ thuộc tính thiết kế của một node: màu sắc, typography, auto-layout, effects, constraints. |
114
+
115
+ ### Bình luận
116
+
117
+ | Tool | Mô tả |
118
+ |------|-------|
119
+ | `figma_get_comments` | Lấy tất cả bình luận trong file: nội dung, tác giả, ngày tạo, trạng thái resolved. |
120
+ | `figma_post_comment` | Đăng bình luận lên file. Có thể gắn vào node cụ thể qua `nodeId`. |
121
+
122
+ ### Design Tokens
123
+
124
+ | Tool | Mô tả |
125
+ |------|-------|
126
+ | `figma_get_variables` | Lấy tất cả biến thiết kế cục bộ trong file: màu, spacing, typography, border-radius, v.v. |
127
+ | `figma_get_published_variables` | Lấy các biến thiết kế đã được publish từ file thư viện. |
128
+
129
+ ### Ảnh & Assets
130
+
131
+ | Tool | Mô tả |
132
+ |------|-------|
133
+ | `figma_export_image` | Xuất node thành ảnh, trả về URL tải tạm thời. Hỗ trợ PNG, JPG, SVG, PDF. |
134
+ | `figma_get_image_fills` | Lấy URL tải ảnh cho tất cả image fills được nhúng trong file. |
135
+
136
+ ### Components & Styles
137
+
138
+ | Tool | Mô tả |
139
+ |------|-------|
140
+ | `figma_get_components` | Lấy danh sách components đã publish trong file: tên, mô tả, node ID. |
141
+ | `figma_get_component_sets` | Lấy danh sách component sets (nhóm variants) trong file. |
142
+ | `figma_get_styles` | Lấy tất cả styles đã publish: color styles, text styles, effect styles, grid styles. |
143
+ | `figma_get_team_components` | Lấy components từ tất cả thư viện dùng chung của team. Cần `teamId`. |
144
+
145
+ ### Tài khoản
146
+
147
+ | Tool | Mô tả |
148
+ |------|-------|
149
+ | `figma_whoami` | Xem thông tin tài khoản Figma đang được xác thực: tên, email, account ID. |
150
+
151
+ ## Tìm fileKey và nodeId
152
+
153
+ - **fileKey**: chuỗi trong URL của file Figma, ví dụ `https://www.figma.com/file/`**`AbCdEfGh`**`/Ten-file`
154
+ - **nodeId**: có dạng `123:456`, lấy từ URL khi chọn một layer, hoặc dùng `figma_get_metadata` để duyệt cây.
@@ -0,0 +1,130 @@
1
+ # Google Chat
2
+
3
+ [English](../google-chat.md) | [Tiếng Việt](google-chat.md)
4
+
5
+ Tích hợp Google Chat API — tìm kiếm conversations, đọc và gửi tin nhắn. Tool set tương đương [Google Chat MCP server](https://developers.google.com/workspace/chat/api/reference/mcp) chính thức.
6
+
7
+ ## Biến môi trường
8
+
9
+ | Biến | Bắt buộc | Mô tả |
10
+ |------|----------|-------|
11
+ | `GCHAT_CLIENT_ID` | Có | OAuth 2.0 Client ID |
12
+ | `GCHAT_CLIENT_SECRET` | Có | OAuth 2.0 Client Secret |
13
+ | `GCHAT_REFRESH_TOKEN` | Có | OAuth 2.0 Refresh Token |
14
+
15
+ Service chỉ được bật khi **cả ba** biến trên có giá trị.
16
+
17
+ ### Lấy credentials
18
+
19
+ 1. Vào [Google Cloud Console](https://console.cloud.google.com) → tạo hoặc chọn project
20
+ 2. Bật **Google Chat API**
21
+ 3. Vào **APIs & Services → Credentials → Create Credentials → OAuth client ID**
22
+ - Application type: **Web application**
23
+ - Authorized redirect URIs: `http://localhost`
24
+ 4. Sao chép **Client ID** và **Client Secret**
25
+ 5. Lấy Refresh Token — chạy OAuth flow với các scopes sau:
26
+ ```
27
+ https://www.googleapis.com/auth/chat.spaces.readonly
28
+ https://www.googleapis.com/auth/chat.messages.readonly
29
+ https://www.googleapis.com/auth/chat.messages.create
30
+ ```
31
+ 6. Điền vào `.env`:
32
+ ```
33
+ GCHAT_CLIENT_ID=xxxx.apps.googleusercontent.com
34
+ GCHAT_CLIENT_SECRET=GOCSPX-xxxx
35
+ GCHAT_REFRESH_TOKEN=1//xxxx
36
+ ```
37
+
38
+ ## Endpoint MCP
39
+
40
+ ```
41
+ http://localhost:47001/mcp/google-chat
42
+ ```
43
+
44
+ ## Đăng ký với AI Agents
45
+
46
+ **Claude Code** — `.claude/settings.local.json`
47
+ ```json
48
+ {
49
+ "mcpServers": {
50
+ "google-chat": {
51
+ "url": "http://localhost:47001/mcp/google-chat"
52
+ }
53
+ }
54
+ }
55
+ ```
56
+
57
+ Hoặc đăng ký bằng command line:
58
+ ```bash
59
+ claude mcp add --transport http google-chat http://localhost:47001/mcp/google-chat
60
+ ```
61
+
62
+ **Codex** — `~/.codex/config.toml`
63
+ ```toml
64
+ [mcp_servers.google-chat]
65
+ url = "http://localhost:47001/mcp/google-chat"
66
+ ```
67
+
68
+ Hoặc đăng ký bằng command line:
69
+ ```bash
70
+ codex mcp add google-chat --url http://localhost:47001/mcp/google-chat
71
+ ```
72
+
73
+ **GitHub Copilot / VS Code** — `.vscode/mcp.json`
74
+ ```json
75
+ {
76
+ "servers": {
77
+ "google-chat": {
78
+ "type": "http",
79
+ "url": "http://localhost:47001/mcp/google-chat"
80
+ }
81
+ }
82
+ }
83
+ ```
84
+
85
+ **Cursor** — `.cursor/mcp.json`
86
+ ```json
87
+ {
88
+ "mcpServers": {
89
+ "google-chat": {
90
+ "url": "http://localhost:47001/mcp/google-chat"
91
+ }
92
+ }
93
+ }
94
+ ```
95
+
96
+ **Windsurf** — `~/.codeium/windsurf/mcp_config.json`
97
+ ```json
98
+ {
99
+ "mcpServers": {
100
+ "google-chat": {
101
+ "serverUrl": "http://localhost:47001/mcp/google-chat"
102
+ }
103
+ }
104
+ }
105
+ ```
106
+
107
+ **Antigravity** — `~/.gemini/config/mcp_config.json`
108
+ ```json
109
+ {
110
+ "mcpServers": {
111
+ "google-chat": {
112
+ "serverUrl": "http://localhost:47001/mcp/google-chat"
113
+ }
114
+ }
115
+ }
116
+ ```
117
+
118
+ ## Danh sách tools
119
+
120
+ | Tool | Mô tả |
121
+ |------|-------|
122
+ | `search_conversations` | Tìm kiếm spaces, DMs, group DMs theo tên hoặc danh sách participants |
123
+ | `list_messages` | Lấy tin nhắn từ một conversation. Có thể lọc theo thread, khoảng thời gian, hỗ trợ phân trang |
124
+ | `search_messages` | Tìm kiếm tin nhắn theo keywords, sender, thời gian, mention, v.v. |
125
+ | `send_message` | Gửi tin nhắn vào một conversation. Hỗ trợ reply vào thread cụ thể |
126
+
127
+ ## Lấy conversationId và threadId
128
+
129
+ - **conversationId**: resource name của space, dạng `spaces/AAAAAAA`. Lấy bằng `search_conversations`.
130
+ - **threadId**: resource name của thread, dạng `spaces/AAAAAAA/threads/BBBBBBB`. Lấy từ field `thread.name` trong kết quả `list_messages`.
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@manhq/localmcp",
3
+ "version": "1.0.0",
4
+ "description": "Local HTTP MCP server for Figma, Atlassian, and Google Chat with a single CLI.",
5
+ "type": "module",
6
+ "license": "UNLICENSED",
7
+ "keywords": [
8
+ "mcp",
9
+ "model-context-protocol",
10
+ "figma",
11
+ "jira",
12
+ "confluence",
13
+ "google-chat"
14
+ ],
15
+ "engines": {
16
+ "node": ">=20"
17
+ },
18
+ "publishConfig": {
19
+ "access": "public"
20
+ },
21
+ "main": "./dist/index.js",
22
+ "types": "./dist/index.d.ts",
23
+ "files": [
24
+ "bin",
25
+ "dist",
26
+ "docs",
27
+ "README.md",
28
+ "README.vi.md"
29
+ ],
30
+ "bin": {
31
+ "localmcp": "bin/localmcp.js"
32
+ },
33
+ "scripts": {
34
+ "dev": "tsx watch src/index.ts",
35
+ "build": "tsc",
36
+ "start": "node dist/index.js",
37
+ "inspect": "npx @modelcontextprotocol/inspector --config mcp.json --server localmcp",
38
+ "prepublishOnly": "npm run build"
39
+ },
40
+ "dependencies": {
41
+ "@modelcontextprotocol/sdk": "^1.12.1",
42
+ "axios": "^1.7.9",
43
+ "dotenv": "^16.4.7",
44
+ "express": "^4.21.2",
45
+ "zod": "^3.24.2"
46
+ },
47
+ "devDependencies": {
48
+ "@types/express": "^5.0.0",
49
+ "@types/node": "^22.10.7",
50
+ "tsx": "^4.19.2",
51
+ "typescript": "^5.7.3"
52
+ }
53
+ }