addai-chat-mcp 0.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/README.md +102 -0
- package/dist/api-client.d.ts +11 -0
- package/dist/api-client.d.ts.map +1 -0
- package/dist/api-client.js +35 -0
- package/dist/api-client.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/logo.d.ts +2 -0
- package/dist/logo.d.ts.map +1 -0
- package/dist/logo.js +7 -0
- package/dist/logo.js.map +1 -0
- package/dist/server.d.ts +3 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +28 -0
- package/dist/server.js.map +1 -0
- package/dist/setup.d.ts +2 -0
- package/dist/setup.d.ts.map +1 -0
- package/dist/setup.js +128 -0
- package/dist/setup.js.map +1 -0
- package/dist/tools/attachments.d.ts +4 -0
- package/dist/tools/attachments.d.ts.map +1 -0
- package/dist/tools/attachments.js +36 -0
- package/dist/tools/attachments.js.map +1 -0
- package/dist/tools/conversations.d.ts +4 -0
- package/dist/tools/conversations.d.ts.map +1 -0
- package/dist/tools/conversations.js +28 -0
- package/dist/tools/conversations.js.map +1 -0
- package/dist/tools/discovery.d.ts +4 -0
- package/dist/tools/discovery.d.ts.map +1 -0
- package/dist/tools/discovery.js +9 -0
- package/dist/tools/discovery.js.map +1 -0
- package/dist/tools/messages.d.ts +4 -0
- package/dist/tools/messages.d.ts.map +1 -0
- package/dist/tools/messages.js +19 -0
- package/dist/tools/messages.js.map +1 -0
- package/dist/tools/search.d.ts +4 -0
- package/dist/tools/search.d.ts.map +1 -0
- package/dist/tools/search.js +10 -0
- package/dist/tools/search.js.map +1 -0
- package/dist/types.d.ts +49 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +24 -0
package/README.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# addai-chat-mcp
|
|
2
|
+
|
|
3
|
+
MCP server for +Ai Chat. Lets Claude (and any other MCP client) read your chat conversations and send messages on your behalf, scoped to an API key you generate from Settings.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
The fastest path is the interactive setup:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx addai-chat-mcp --setup
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
It asks for your API key, then writes the right config into Claude Desktop (Windows & macOS) and Claude Code's global `~/.claude.json` for you. Restart Claude after running it.
|
|
14
|
+
|
|
15
|
+
### Get an API key
|
|
16
|
+
|
|
17
|
+
1. Open +Ai Chat → **Settings** → **Integrations**.
|
|
18
|
+
2. Click **New Key**, name it (e.g. "Claude on my laptop"), and create.
|
|
19
|
+
3. Copy the `aic_user_…` key shown once. You won't see it again — save it somewhere safe.
|
|
20
|
+
|
|
21
|
+
### Manual install
|
|
22
|
+
|
|
23
|
+
If you prefer to wire it yourself, add this to your MCP config:
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"mcpServers": {
|
|
28
|
+
"addai-chat": {
|
|
29
|
+
"command": "npx",
|
|
30
|
+
"args": ["-y", "addai-chat-mcp"],
|
|
31
|
+
"env": {
|
|
32
|
+
"ADDAI_CHAT_API_KEY": "aic_user_…"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Tools
|
|
40
|
+
|
|
41
|
+
### Discovery
|
|
42
|
+
- `me` — show the current key, its permissions, and accessible workspaces.
|
|
43
|
+
- `list_workspaces` — list workspaces this key can see.
|
|
44
|
+
- `list_workspace_members` — list people in a workspace.
|
|
45
|
+
- `get_profile` — fetch a single profile by id.
|
|
46
|
+
|
|
47
|
+
### Conversations
|
|
48
|
+
- `list_conversations` — DMs and groups in a workspace.
|
|
49
|
+
- `get_conversation` — details + participants for one conversation.
|
|
50
|
+
- `create_dm` — start a 1:1 chat with another user.
|
|
51
|
+
- `create_group` — create a group chat with named members.
|
|
52
|
+
- `update_conversation` — rename or update a group's description.
|
|
53
|
+
- `add_members` / `remove_member` — manage group membership.
|
|
54
|
+
- `leave_conversation` — leave a group.
|
|
55
|
+
- `mark_read` — mark a conversation read up to now.
|
|
56
|
+
- `pin_conversation` — pin or unpin a conversation.
|
|
57
|
+
|
|
58
|
+
### Messages
|
|
59
|
+
- `list_messages` — paginate a conversation's history (newest first).
|
|
60
|
+
- `send_message` — post a message. Supports `reply_to_id` and `attachments`.
|
|
61
|
+
- `edit_message` / `delete_message` — only on your own messages.
|
|
62
|
+
- `toggle_reaction` — add or remove an emoji reaction.
|
|
63
|
+
|
|
64
|
+
### Search
|
|
65
|
+
- `search_messages` — full-text across a workspace, optionally scoped to one conversation.
|
|
66
|
+
|
|
67
|
+
### Attachments
|
|
68
|
+
- `upload_attachment` — upload a local file and get an `attachment` object you can pass into `send_message`.
|
|
69
|
+
- `get_attachment` — look up an attachment by id.
|
|
70
|
+
|
|
71
|
+
## Permissions
|
|
72
|
+
|
|
73
|
+
Each key has a `chat` permission namespace with toggleable resources:
|
|
74
|
+
|
|
75
|
+
| Resource | Actions |
|
|
76
|
+
|---|---|
|
|
77
|
+
| `conversations` | `read`, `create`, `update`, `delete` |
|
|
78
|
+
| `messages` | `read`, `create`, `update`, `delete` |
|
|
79
|
+
| `members` | `read`, `manage` |
|
|
80
|
+
| `attachments` | `read`, `upload` |
|
|
81
|
+
|
|
82
|
+
By default every action is on; tighten in the Create-Key modal if you want a read-only or restricted key.
|
|
83
|
+
|
|
84
|
+
Keys are user-level: they automatically pick up every workspace you're a member of, and lose access when you leave a workspace.
|
|
85
|
+
|
|
86
|
+
## Rate limits
|
|
87
|
+
|
|
88
|
+
Default 60 requests/minute, 10,000/day. The MCP raises an error if you hit them — wait and retry.
|
|
89
|
+
|
|
90
|
+
## Troubleshooting
|
|
91
|
+
|
|
92
|
+
| Symptom | Cause |
|
|
93
|
+
|---|---|
|
|
94
|
+
| `ADDAI_CHAT_API_KEY environment variable is required` | Env var not set in your MCP config. |
|
|
95
|
+
| `[UNAUTHORIZED] Invalid or missing API key` | Key revoked or typed wrong. Mint a fresh one. |
|
|
96
|
+
| `[FORBIDDEN] Missing chat.<resource>.<action> permission` | That action is turned off on the key. Either flip it on (revoke + recreate) or use a different key. |
|
|
97
|
+
| `[WORKSPACE_ACCESS_REVOKED]` | You're no longer a member of that workspace. |
|
|
98
|
+
| `[RATE_LIMITED]` | Slow down or wait until the limit resets. |
|
|
99
|
+
|
|
100
|
+
## License
|
|
101
|
+
|
|
102
|
+
MIT.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare class ChatApiClient {
|
|
2
|
+
private apiKey;
|
|
3
|
+
private baseUrl;
|
|
4
|
+
constructor(apiKey: string, baseUrl?: string);
|
|
5
|
+
private request;
|
|
6
|
+
get<T>(path: string, query?: Record<string, string | number | undefined>): Promise<T>;
|
|
7
|
+
post<T>(path: string, body?: unknown): Promise<T>;
|
|
8
|
+
patch<T>(path: string, body?: unknown): Promise<T>;
|
|
9
|
+
delete<T>(path: string): Promise<T>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=api-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-client.d.ts","sourceRoot":"","sources":["../src/api-client.ts"],"names":[],"mappings":"AAEA,qBAAa,aAAa;IACZ,OAAO,CAAC,MAAM;IAAU,OAAO,CAAC,OAAO;gBAA/B,MAAM,EAAE,MAAM,EAAU,OAAO,GAAE,MAA+E;YAEtH,OAAO;IAkBrB,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACxE,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO;IACpC,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO;IACrC,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM;CACvB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export class ChatApiClient {
|
|
2
|
+
apiKey;
|
|
3
|
+
baseUrl;
|
|
4
|
+
constructor(apiKey, baseUrl = "https://syhzpqqvrplaqdipcymw.supabase.co/functions/v1/addai-chat-api") {
|
|
5
|
+
this.apiKey = apiKey;
|
|
6
|
+
this.baseUrl = baseUrl;
|
|
7
|
+
}
|
|
8
|
+
async request(method, path, body, query) {
|
|
9
|
+
const url = new URL(this.baseUrl + path);
|
|
10
|
+
if (query)
|
|
11
|
+
Object.entries(query).forEach(([k, v]) => { if (v !== undefined && v !== null)
|
|
12
|
+
url.searchParams.set(k, String(v)); });
|
|
13
|
+
const resp = await fetch(url.toString(), {
|
|
14
|
+
method,
|
|
15
|
+
headers: { "x-api-key": this.apiKey, "Content-Type": "application/json" },
|
|
16
|
+
body: body !== undefined ? JSON.stringify(body) : undefined,
|
|
17
|
+
});
|
|
18
|
+
if (!resp.ok) {
|
|
19
|
+
let payload = null;
|
|
20
|
+
try {
|
|
21
|
+
payload = await resp.json();
|
|
22
|
+
}
|
|
23
|
+
catch { /* ignore */ }
|
|
24
|
+
const msg = payload?.error?.message || `HTTP ${resp.status}`;
|
|
25
|
+
const code = payload?.error?.code || "ERROR";
|
|
26
|
+
throw new Error(`[${code}] ${msg}`);
|
|
27
|
+
}
|
|
28
|
+
return resp.json();
|
|
29
|
+
}
|
|
30
|
+
get(path, query) { return this.request("GET", path, undefined, query); }
|
|
31
|
+
post(path, body) { return this.request("POST", path, body); }
|
|
32
|
+
patch(path, body) { return this.request("PATCH", path, body); }
|
|
33
|
+
delete(path) { return this.request("DELETE", path); }
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=api-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+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AAE,OAAO,IAAI,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;YAC7D,MAAM,IAAI,GAAG,OAAO,EAAE,KAAK,EAAE,IAAI,IAAI,OAAO,CAAC;YAC7C,MAAM,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC,CAAC;QACtC,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;IACrB,CAAC;IAED,GAAG,CAAI,IAAY,EAAE,KAAmD,IAAI,OAAO,IAAI,CAAC,OAAO,CAAI,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IACpI,IAAI,CAAI,IAAY,EAAE,IAAc,IAAI,OAAO,IAAI,CAAC,OAAO,CAAI,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IACrF,KAAK,CAAI,IAAY,EAAE,IAAc,IAAI,OAAO,IAAI,CAAC,OAAO,CAAI,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IACvF,MAAM,CAAI,IAAY,IAAI,OAAO,IAAI,CAAC,OAAO,CAAI,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;CACpE"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
if (process.argv.includes('--setup') || process.argv.includes('setup')) {
|
|
3
|
+
await import('./setup.js');
|
|
4
|
+
}
|
|
5
|
+
else {
|
|
6
|
+
const { StdioServerTransport } = await import('@modelcontextprotocol/sdk/server/stdio.js');
|
|
7
|
+
const { createServer } = await import('./server.js');
|
|
8
|
+
const apiKey = process.env.ADDAI_CHAT_API_KEY;
|
|
9
|
+
if (!apiKey) {
|
|
10
|
+
console.error('Error: ADDAI_CHAT_API_KEY environment variable is required.\n\n' +
|
|
11
|
+
'Run setup to configure automatically:\n npx addai-chat-mcp --setup\n\n' +
|
|
12
|
+
'Or set the env var manually in your MCP config.');
|
|
13
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
const baseUrl = process.env.ADDAI_CHAT_API_URL || undefined;
|
|
16
|
+
const server = createServer(apiKey, baseUrl);
|
|
17
|
+
const transport = new StdioServerTransport();
|
|
18
|
+
await server.connect(transport);
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;IACvE,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC;AAC7B,CAAC;KAAM,CAAC;IACN,MAAM,EAAE,oBAAoB,EAAE,GAAG,MAAM,MAAM,CAAC,2CAA2C,CAAC,CAAC;IAC3F,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;IAErD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;IAC9C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,CAAC,KAAK,CACX,iEAAiE;YACjE,yEAAyE;YACzE,iDAAiD,CAClD,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,SAAS,CAAC;IAC5D,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7C,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC"}
|
package/dist/logo.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logo.d.ts","sourceRoot":"","sources":["../src/logo.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,SAKxB"}
|
package/dist/logo.js
ADDED
package/dist/logo.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logo.js","sourceRoot":"","sources":["../src/logo.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,SAAS;IACvB,OAAO,CAAC,GAAG,CAAC;;;CAGb,CAAC,CAAC;AACH,CAAC"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAmBpE,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAcxE"}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { ChatApiClient } from './api-client.js';
|
|
3
|
+
import { registerDiscoveryTools } from './tools/discovery.js';
|
|
4
|
+
import { registerConversationTools } from './tools/conversations.js';
|
|
5
|
+
import { registerMessageTools } from './tools/messages.js';
|
|
6
|
+
import { registerSearchTools } from './tools/search.js';
|
|
7
|
+
import { registerAttachmentTools } from './tools/attachments.js';
|
|
8
|
+
const SERVER_INSTRUCTIONS = `You are connected to +Ai Chat. Hierarchy: Workspace → Conversation (DM or group) → Messages.
|
|
9
|
+
|
|
10
|
+
Workflow:
|
|
11
|
+
1. \`list_workspaces\` to see what's available.
|
|
12
|
+
2. \`list_conversations\` for a workspace to see DMs/groups.
|
|
13
|
+
3. \`list_messages\` to read history, \`send_message\` to post.
|
|
14
|
+
|
|
15
|
+
Always call \`get_conversation\` if you need participant info before sending. Use \`search_messages\` to find content across a workspace. For attachments: \`upload_attachment\` first to get an attachment ref, then pass it in \`send_message\`.
|
|
16
|
+
|
|
17
|
+
Editing/deleting only works on your own messages. Sending requires being a member of the conversation.`;
|
|
18
|
+
export function createServer(apiKey, baseUrl) {
|
|
19
|
+
const server = new McpServer({ name: 'addai-chat-mcp', version: '0.1.0' }, { instructions: SERVER_INSTRUCTIONS });
|
|
20
|
+
const client = new ChatApiClient(apiKey, baseUrl);
|
|
21
|
+
registerDiscoveryTools(server, client);
|
|
22
|
+
registerConversationTools(server, client);
|
|
23
|
+
registerMessageTools(server, client);
|
|
24
|
+
registerSearchTools(server, client);
|
|
25
|
+
registerAttachmentTools(server, client);
|
|
26
|
+
return server;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,MAAM,mBAAmB,GAAG;;;;;;;;;uGAS2E,CAAC;AAExG,MAAM,UAAU,YAAY,CAAC,MAAc,EAAE,OAAgB;IAC3D,MAAM,MAAM,GAAG,IAAI,SAAS,CAC1B,EAAE,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,OAAO,EAAE,EAC5C,EAAE,YAAY,EAAE,mBAAmB,EAAE,CACtC,CAAC;IACF,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAElD,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,yBAAyB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,uBAAuB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAExC,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/setup.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":""}
|
package/dist/setup.js
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import * as os from 'os';
|
|
4
|
+
import * as readline from 'readline';
|
|
5
|
+
import { printLogo } from './logo.js';
|
|
6
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
7
|
+
const ask = (q) => new Promise((resolve) => rl.question(q, resolve));
|
|
8
|
+
const MCP_ENTRY = {
|
|
9
|
+
command: 'npx',
|
|
10
|
+
args: ['-y', 'addai-chat-mcp'],
|
|
11
|
+
env: { ADDAI_CHAT_API_KEY: '' },
|
|
12
|
+
};
|
|
13
|
+
function getConfigTargets() {
|
|
14
|
+
const platform = os.platform();
|
|
15
|
+
const home = os.homedir();
|
|
16
|
+
const targets = [];
|
|
17
|
+
// Claude Desktop
|
|
18
|
+
if (platform === 'win32') {
|
|
19
|
+
targets.push({
|
|
20
|
+
name: 'Claude Desktop',
|
|
21
|
+
path: path.join(process.env.APPDATA || path.join(home, 'AppData', 'Roaming'), 'Claude', 'claude_desktop_config.json'),
|
|
22
|
+
wrapperKey: 'mcpServers',
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
else if (platform === 'darwin') {
|
|
26
|
+
targets.push({
|
|
27
|
+
name: 'Claude Desktop',
|
|
28
|
+
path: path.join(home, 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json'),
|
|
29
|
+
wrapperKey: 'mcpServers',
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
// Claude Code (global)
|
|
33
|
+
targets.push({
|
|
34
|
+
name: 'Claude Code (global)',
|
|
35
|
+
path: path.join(home, '.claude.json'),
|
|
36
|
+
wrapperKey: 'mcpServers',
|
|
37
|
+
});
|
|
38
|
+
return targets;
|
|
39
|
+
}
|
|
40
|
+
function readJsonFile(filePath) {
|
|
41
|
+
try {
|
|
42
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
43
|
+
return JSON.parse(content);
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return {};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function writeJsonFile(filePath, data) {
|
|
50
|
+
const dir = path.dirname(filePath);
|
|
51
|
+
if (!fs.existsSync(dir)) {
|
|
52
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
53
|
+
}
|
|
54
|
+
fs.writeFileSync(filePath, JSON.stringify(data, null, 2) + '\n', 'utf-8');
|
|
55
|
+
}
|
|
56
|
+
async function run() {
|
|
57
|
+
printLogo();
|
|
58
|
+
console.log(' This will configure Claude to access your +Ai Chat data.');
|
|
59
|
+
console.log('');
|
|
60
|
+
// Ask for API key
|
|
61
|
+
console.log(' 1. Go to +Ai Chat → Settings → Integrations → New Key');
|
|
62
|
+
console.log(' 2. Create a new key and copy it');
|
|
63
|
+
console.log('');
|
|
64
|
+
const apiKey = (await ask(' Paste your API key (aic_user_...): ')).trim();
|
|
65
|
+
if (!apiKey) {
|
|
66
|
+
console.log('\n No API key provided. Setup cancelled.');
|
|
67
|
+
rl.close();
|
|
68
|
+
process.exit(1);
|
|
69
|
+
}
|
|
70
|
+
if (!apiKey.startsWith('aic_user_')) {
|
|
71
|
+
console.log('\n Warning: Key doesn\'t look like an +Ai Chat key (expected aic_user_*)');
|
|
72
|
+
const cont = (await ask(' Continue anyway? (y/n): ')).trim().toLowerCase();
|
|
73
|
+
if (cont !== 'y') {
|
|
74
|
+
rl.close();
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// Detect available config targets
|
|
79
|
+
const targets = getConfigTargets();
|
|
80
|
+
console.log('');
|
|
81
|
+
console.log(' Where would you like to install?');
|
|
82
|
+
targets.forEach((t, i) => {
|
|
83
|
+
const exists = fs.existsSync(t.path);
|
|
84
|
+
console.log(` ${i + 1}. ${t.name}${exists ? '' : ' (will create config)'}`);
|
|
85
|
+
});
|
|
86
|
+
console.log(` ${targets.length + 1}. Both`);
|
|
87
|
+
console.log('');
|
|
88
|
+
const choice = (await ask(` Choose (1-${targets.length + 1}): `)).trim();
|
|
89
|
+
const choiceNum = parseInt(choice);
|
|
90
|
+
let selectedTargets;
|
|
91
|
+
if (choiceNum === targets.length + 1) {
|
|
92
|
+
selectedTargets = targets;
|
|
93
|
+
}
|
|
94
|
+
else if (choiceNum >= 1 && choiceNum <= targets.length) {
|
|
95
|
+
selectedTargets = [targets[choiceNum - 1]];
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
console.log('\n Invalid choice. Setup cancelled.');
|
|
99
|
+
rl.close();
|
|
100
|
+
process.exit(1);
|
|
101
|
+
}
|
|
102
|
+
// Write config
|
|
103
|
+
const entry = { ...MCP_ENTRY, env: { ADDAI_CHAT_API_KEY: apiKey } };
|
|
104
|
+
for (const target of selectedTargets) {
|
|
105
|
+
const config = readJsonFile(target.path);
|
|
106
|
+
if (!config[target.wrapperKey]) {
|
|
107
|
+
config[target.wrapperKey] = {};
|
|
108
|
+
}
|
|
109
|
+
config[target.wrapperKey]['addai-chat'] = entry;
|
|
110
|
+
writeJsonFile(target.path, config);
|
|
111
|
+
console.log(` ✓ Configured ${target.name}`);
|
|
112
|
+
console.log(` ${target.path}`);
|
|
113
|
+
}
|
|
114
|
+
console.log('');
|
|
115
|
+
console.log(' ✅ Setup complete! Restart Claude to start using +Ai Chat.');
|
|
116
|
+
console.log('');
|
|
117
|
+
console.log(' Try asking Claude:');
|
|
118
|
+
console.log(' "What chat conversations do I have?"');
|
|
119
|
+
console.log(' "Send \'on my way\' to Alex"');
|
|
120
|
+
console.log(' "Search my messages for \'Q3 plan\'"');
|
|
121
|
+
console.log('');
|
|
122
|
+
rl.close();
|
|
123
|
+
}
|
|
124
|
+
run().catch((err) => {
|
|
125
|
+
console.error('Setup failed:', err.message);
|
|
126
|
+
process.exit(1);
|
|
127
|
+
});
|
|
128
|
+
//# sourceMappingURL=setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,EAAE,GAAG,QAAQ,CAAC,eAAe,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;AACtF,MAAM,GAAG,GAAG,CAAC,CAAS,EAAmB,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;AAE9F,MAAM,SAAS,GAAG;IAChB,OAAO,EAAE,KAAK;IACd,IAAI,EAAE,CAAC,IAAI,EAAE,gBAAgB,CAAC;IA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O,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;IACxD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAEhB,EAAE,CAAC,KAAK,EAAE,CAAC;AACb,CAAC;AAED,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IAClB,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IAC5C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachments.d.ts","sourceRoot":"","sources":["../../src/tools/attachments.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAMtD,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,QAkD/E"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { readFile } from 'node:fs/promises';
|
|
3
|
+
import { basename } from 'node:path';
|
|
4
|
+
const wrap = (data) => ({ content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] });
|
|
5
|
+
export function registerAttachmentTools(server, client) {
|
|
6
|
+
server.tool('upload_attachment', 'Upload a local file as a chat attachment. Returns an `attachment` object you can pass into `send_message`.', {
|
|
7
|
+
workspace_id: z.string().uuid().describe('Workspace UUID for storage scoping'),
|
|
8
|
+
file_path: z.string().describe('Absolute path to a local file'),
|
|
9
|
+
content_type: z.string().describe('MIME type, e.g. image/png'),
|
|
10
|
+
}, async ({ workspace_id, file_path, content_type }) => {
|
|
11
|
+
const bytes = await readFile(file_path);
|
|
12
|
+
const filename = basename(file_path);
|
|
13
|
+
// Step 1: ask chat-api for a signed POST policy.
|
|
14
|
+
const signed = await client.post('/v1/attachments/upload-url', {
|
|
15
|
+
workspace_id,
|
|
16
|
+
filename,
|
|
17
|
+
content_type,
|
|
18
|
+
size: bytes.byteLength,
|
|
19
|
+
});
|
|
20
|
+
// Step 2: POST the signed multipart form to GCS.
|
|
21
|
+
const form = new FormData();
|
|
22
|
+
for (const [k, v] of Object.entries(signed.data.upload_fields))
|
|
23
|
+
form.append(k, v);
|
|
24
|
+
// Web fetch accepts a Blob as the file part; cast to satisfy the type.
|
|
25
|
+
const fileBlob = new Blob([new Uint8Array(bytes)], { type: content_type });
|
|
26
|
+
form.append('file', fileBlob, filename);
|
|
27
|
+
const put = await fetch(signed.data.upload_url, { method: 'POST', body: form });
|
|
28
|
+
if (!put.ok) {
|
|
29
|
+
const txt = await put.text();
|
|
30
|
+
throw new Error(`Upload to storage failed: HTTP ${put.status} ${txt}`);
|
|
31
|
+
}
|
|
32
|
+
return wrap({ attachment: signed.data.attachment });
|
|
33
|
+
});
|
|
34
|
+
server.tool('get_attachment', 'Look up an attachment by id.', { attachment_id: z.string() }, async ({ attachment_id }) => wrap(await client.get(`/v1/attachments/${attachment_id}`)));
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=attachments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachments.js","sourceRoot":"","sources":["../../src/tools/attachments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,MAAM,IAAI,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAEhH,MAAM,UAAU,uBAAuB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AC,UAAU,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAChF,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;YACZ,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CAAC,kCAAkC,GAAG,CAAC,MAAM,IAAI,GAAG,EAAE,CAAC,CAAC;QACzE,CAAC;QAED,OAAO,IAAI,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IACtD,CAAC,CACF,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,gBAAgB,EAChB,8BAA8B,EAC9B,EAAE,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,EAC7B,KAAK,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,MAAM,CAAC,GAAG,CAAC,mBAAmB,aAAa,EAAE,CAAC,CAAC,CACxF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { ChatApiClient } from '../api-client.js';
|
|
3
|
+
export declare function registerConversationTools(server: McpServer, client: ChatApiClient): void;
|
|
4
|
+
//# sourceMappingURL=conversations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversations.d.ts","sourceRoot":"","sources":["../../src/tools/conversations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAItD,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,QAsFjF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const wrap = (data) => ({ content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] });
|
|
3
|
+
export function registerConversationTools(server, client) {
|
|
4
|
+
server.tool('list_conversations', 'List DMs and groups in a workspace.', { workspace_id: z.string().uuid() }, async ({ workspace_id }) => wrap(await client.get('/v1/conversations', { workspace_id })));
|
|
5
|
+
server.tool('get_conversation', 'Get details and participants for a conversation.', { conversation_id: z.string().uuid() }, async ({ conversation_id }) => wrap(await client.get(`/v1/conversations/${conversation_id}`)));
|
|
6
|
+
server.tool('create_dm', 'Start a direct message with another user.', { workspace_id: z.string().uuid(), target_user_id: z.string().uuid() }, async (args) => wrap(await client.post('/v1/conversations/dm', args)));
|
|
7
|
+
server.tool('create_group', 'Create a group chat with the named members.', {
|
|
8
|
+
workspace_id: z.string().uuid(),
|
|
9
|
+
name: z.string().min(1),
|
|
10
|
+
member_user_ids: z.array(z.string().uuid()).min(1),
|
|
11
|
+
}, async (args) => wrap(await client.post('/v1/conversations/group', args)));
|
|
12
|
+
server.tool('update_conversation', 'Rename a group or update its description.', {
|
|
13
|
+
conversation_id: z.string().uuid(),
|
|
14
|
+
name: z.string().optional(),
|
|
15
|
+
description: z.string().optional(),
|
|
16
|
+
}, async ({ conversation_id, ...body }) => wrap(await client.patch(`/v1/conversations/${conversation_id}`, body)));
|
|
17
|
+
server.tool('add_members', 'Add members to a group.', {
|
|
18
|
+
conversation_id: z.string().uuid(),
|
|
19
|
+
user_ids: z.array(z.string().uuid()).min(1),
|
|
20
|
+
}, async ({ conversation_id, user_ids }) => wrap(await client.post(`/v1/conversations/${conversation_id}/members`, { user_ids })));
|
|
21
|
+
server.tool('remove_member', 'Remove a member from a group.', { conversation_id: z.string().uuid(), user_id: z.string().uuid() }, async ({ conversation_id, user_id }) => wrap(await client.delete(`/v1/conversations/${conversation_id}/members/${user_id}`)));
|
|
22
|
+
server.tool('leave_conversation', 'Leave a conversation (you remain visible in history).', { conversation_id: z.string().uuid() }, async ({ conversation_id }) => wrap(await client.post(`/v1/conversations/${conversation_id}/leave`)));
|
|
23
|
+
server.tool('mark_read', 'Mark a conversation read up to now.', { conversation_id: z.string().uuid() }, async ({ conversation_id }) => wrap(await client.post(`/v1/conversations/${conversation_id}/read`)));
|
|
24
|
+
server.tool('pin_conversation', 'Pin (or unpin via `pinned=false`) a conversation.', { conversation_id: z.string().uuid(), pinned: z.boolean().default(true) }, async ({ conversation_id, pinned }) => pinned
|
|
25
|
+
? wrap(await client.post(`/v1/conversations/${conversation_id}/pin`))
|
|
26
|
+
: wrap(await client.delete(`/v1/conversations/${conversation_id}/pin`)));
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=conversations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversations.js","sourceRoot":"","sources":["../../src/tools/conversations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,IAAI,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAEhH,MAAM,UAAU,yBAAyB,CAAC,MAAiB,EAAE,MAAqB;IAChF,MAAM,CAAC,IAAI,CACT,oBAAoB,EACpB,qCAAqC,EACrC,EAAE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,EACnC,KAAK,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,MAAM,CAAC,GAAG,CAAC,mBAAmB,EAAE,EAAE,YAAY,EAAE,CAAC,CAAC,CAC1F,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,kBAAkB,EAClB,kDAAkD,EAClD,EAAE,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,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,EAAE,EACtC,KAAK,EAAE,EAAE,eAAe,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,qBAAqB,eAAe,OAAO,CAAC,CAAC,CACpG,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,kBAAkB,EAClB,mDAAmD,EACnD,EAAE,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EACzE,KAAK,EAAE,EAAE,eAAe,EAAE,MAAM,EAAE,EAAE,EAAE,CACpC,MAAM;QACJ,CAAC,CAAC,IAAI,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,qBAAqB,eAAe,MAAM,CAAC,CAAC;QACrE,CAAC,CAAC,IAAI,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,qBAAqB,eAAe,MAAM,CAAC,CAAC,CAC5E,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../src/tools/discovery.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAItD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,QAsB9E"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const wrap = (data) => ({ content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] });
|
|
3
|
+
export function registerDiscoveryTools(server, client) {
|
|
4
|
+
server.tool('me', 'Identify the current API key, its permissions, and accessible workspaces.', {}, async () => wrap(await client.get('/v1/me')));
|
|
5
|
+
server.tool('list_workspaces', 'List workspaces accessible to this key.', {}, async () => wrap(await client.get('/v1/workspaces')));
|
|
6
|
+
server.tool('list_workspace_members', 'List people in a workspace.', { workspace_id: z.string().uuid().describe('Workspace UUID') }, async ({ workspace_id }) => wrap(await client.get(`/v1/workspaces/${workspace_id}/members`)));
|
|
7
|
+
server.tool('get_profile', 'Get a single user profile by id.', { profile_id: z.string().uuid() }, async ({ profile_id }) => wrap(await client.get(`/v1/people/${profile_id}`)));
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=discovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discovery.js","sourceRoot":"","sources":["../../src/tools/discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,IAAI,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAEhH,MAAM,UAAU,sBAAsB,CAAC,MAAiB,EAAE,MAAqB;IAC7E,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,2EAA2E,EAAE,EAAE,EAAE,KAAK,IAAI,EAAE,CAC5G,IAAI,CAAC,MAAM,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CACjC,CAAC;IAEF,MAAM,CAAC,IAAI,CAAC,iBAAiB,EAAE,yCAAyC,EAAE,EAAE,EAAE,KAAK,IAAI,EAAE,CACvF,IAAI,CAAC,MAAM,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CACzC,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,wBAAwB,EACxB,6BAA6B,EAC7B,EAAE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,EAC9D,KAAK,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,MAAM,CAAC,GAAG,CAAC,kBAAkB,YAAY,UAAU,CAAC,CAAC,CAC7F,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,aAAa,EACb,kCAAkC,EAClC,EAAE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,EACjC,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,MAAM,CAAC,GAAG,CAAC,cAAc,UAAU,EAAE,CAAC,CAAC,CAC7E,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/tools/messages.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAItD,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,QA+C5E"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const wrap = (data) => ({ content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] });
|
|
3
|
+
export function registerMessageTools(server, client) {
|
|
4
|
+
server.tool('list_messages', 'List messages in a conversation, newest first. Use `before` (ISO timestamp) to page back.', {
|
|
5
|
+
conversation_id: z.string().uuid(),
|
|
6
|
+
before: z.string().datetime().optional(),
|
|
7
|
+
limit: z.number().int().min(1).max(200).default(50),
|
|
8
|
+
}, async ({ conversation_id, before, limit }) => wrap(await client.get(`/v1/conversations/${conversation_id}/messages`, { before, limit })));
|
|
9
|
+
server.tool('send_message', 'Post a message to a conversation. Attach files by passing their attachment objects from `upload_attachment`.', {
|
|
10
|
+
conversation_id: z.string().uuid(),
|
|
11
|
+
content: z.string(),
|
|
12
|
+
reply_to_id: z.string().uuid().optional(),
|
|
13
|
+
attachments: z.array(z.record(z.unknown())).optional(),
|
|
14
|
+
}, async ({ conversation_id, ...body }) => wrap(await client.post(`/v1/conversations/${conversation_id}/messages`, body)));
|
|
15
|
+
server.tool('edit_message', 'Edit one of your own messages.', { message_id: z.string().uuid(), content: z.string() }, async ({ message_id, content }) => wrap(await client.patch(`/v1/messages/${message_id}`, { content })));
|
|
16
|
+
server.tool('delete_message', 'Delete one of your own messages.', { message_id: z.string().uuid() }, async ({ message_id }) => wrap(await client.delete(`/v1/messages/${message_id}`)));
|
|
17
|
+
server.tool('toggle_reaction', 'Add or remove an emoji reaction on a message.', { message_id: z.string().uuid(), emoji: z.string().min(1) }, async ({ message_id, emoji }) => wrap(await client.post(`/v1/messages/${message_id}/reactions`, { emoji })));
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/tools/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,IAAI,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAEhH,MAAM,UAAU,oBAAoB,CAAC,MAAiB,EAAE,MAAqB;IAC3E,MAAM,CAAC,IAAI,CACT,eAAe,EACf,2FAA2F,EAC3F;QACE,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;QAClC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;QACxC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,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C,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,EACjC,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,gBAAgB,UAAU,EAAE,CAAC,CAAC,CAClF,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,iBAAiB,EACjB,+CAA+C,EAC/C,EAAE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAC3D,KAAK,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,EAAE,CAC9B,IAAI,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,gBAAgB,UAAU,YAAY,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,CAC7E,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAItD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,QAW3E"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const wrap = (data) => ({ content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] });
|
|
3
|
+
export function registerSearchTools(server, client) {
|
|
4
|
+
server.tool('search_messages', 'Full-text search across messages in a workspace (optionally constrained to one conversation).', {
|
|
5
|
+
workspace_id: z.string().uuid(),
|
|
6
|
+
q: z.string().min(1),
|
|
7
|
+
conversation_id: z.string().uuid().optional(),
|
|
8
|
+
}, async (args) => wrap(await client.get('/v1/search/messages', args)));
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,IAAI,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAEhH,MAAM,UAAU,mBAAmB,CAAC,MAAiB,EAAE,MAAqB;IAC1E,MAAM,CAAC,IAAI,CACT,iBAAiB,EACjB,+FAA+F,EAC/F;QACE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;QAC/B,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QACpB,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;KAC9C,EACD,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,MAAM,CAAC,GAAG,CAAC,qBAAqB,EAAE,IAAI,CAAC,CAAC,CACpE,CAAC;AACJ,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export interface ListResponse<T> {
|
|
2
|
+
data: T[];
|
|
3
|
+
pagination?: {
|
|
4
|
+
page: number;
|
|
5
|
+
page_size: number;
|
|
6
|
+
total_count: number;
|
|
7
|
+
total_pages: number;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export interface ItemResponse<T> {
|
|
11
|
+
data: T;
|
|
12
|
+
}
|
|
13
|
+
export interface ApiError {
|
|
14
|
+
error: {
|
|
15
|
+
message: string;
|
|
16
|
+
code: string;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export interface Workspace {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
slug: string;
|
|
23
|
+
}
|
|
24
|
+
export interface Profile {
|
|
25
|
+
id: string;
|
|
26
|
+
full_name: string | null;
|
|
27
|
+
handle: string | null;
|
|
28
|
+
email_address: string | null;
|
|
29
|
+
avatar_url: string | null;
|
|
30
|
+
is_entity: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface Conversation {
|
|
33
|
+
id: string;
|
|
34
|
+
type: 'dm' | 'group' | 'team';
|
|
35
|
+
name: string | null;
|
|
36
|
+
participants: Profile[];
|
|
37
|
+
last_message_preview: string | null;
|
|
38
|
+
last_message_at: string | null;
|
|
39
|
+
}
|
|
40
|
+
export interface Message {
|
|
41
|
+
id: string;
|
|
42
|
+
conversation_id: string;
|
|
43
|
+
sender_id: string;
|
|
44
|
+
content: string;
|
|
45
|
+
attachments: unknown[];
|
|
46
|
+
reply_to_id: string | null;
|
|
47
|
+
created_at: string;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY,CAAC,CAAC;IAAI,IAAI,EAAE,CAAC,EAAE,CAAC;IAAC,UAAU,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE;AAC1I,MAAM,WAAW,YAAY,CAAC,CAAC;IAAI,IAAI,EAAE,CAAC,CAAA;CAAE;AAC5C,MAAM,WAAW,QAAQ;IAAG,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE;AAEtE,MAAM,WAAW,SAAS;IAAG,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE;AACrE,MAAM,WAAW,OAAO;IAAK,EAAE,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE;AACvK,MAAM,WAAW,YAAY;IAAG,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,IAAI,GAAG,OAAO,GAAG,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,YAAY,EAAE,OAAO,EAAE,CAAC;IAAC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE;AAC9L,MAAM,WAAW,OAAO;IAAG,EAAE,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,OAAO,EAAE,CAAC;IAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "addai-chat-mcp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MCP server for +Ai Chat — lets Claude read and send your chats",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": { "addai-chat-mcp": "./dist/index.js" },
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"files": ["dist"],
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "tsc",
|
|
11
|
+
"dev": "tsc --watch",
|
|
12
|
+
"start": "node dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"keywords": ["mcp", "claude", "addai-chat", "chat", "model-context-protocol"],
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@modelcontextprotocol/sdk": "1.27.1",
|
|
18
|
+
"zod": "^3.24.4"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@types/node": "^22.15.3",
|
|
22
|
+
"typescript": "^5.8.3"
|
|
23
|
+
}
|
|
24
|
+
}
|