talon-agent 1.3.0 → 1.4.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/package.json +3 -1
- package/src/__tests__/compose-tools.test.ts +216 -0
- package/src/__tests__/fuzz.test.ts +0 -2
- package/src/__tests__/gateway-actions.test.ts +1 -423
- package/src/backend/claude-sdk/index.ts +39 -54
- package/src/backend/opencode/index.ts +5 -20
- package/src/bootstrap.ts +70 -6
- package/src/core/gateway-actions.ts +0 -87
- package/src/core/tools/bridge.ts +40 -0
- package/src/core/tools/chat.ts +52 -0
- package/src/core/tools/history.ts +80 -0
- package/src/core/tools/index.ts +82 -0
- package/src/core/tools/mcp-server.ts +64 -0
- package/src/core/tools/media.ts +23 -0
- package/src/core/tools/members.ts +46 -0
- package/src/core/tools/messaging.ts +300 -0
- package/src/core/tools/scheduling.ts +89 -0
- package/src/core/tools/stickers.ts +143 -0
- package/src/core/tools/types.ts +60 -0
- package/src/core/tools/web.ts +26 -0
- package/src/frontend/telegram/actions.ts +10 -1
- package/src/plugins/github/index.ts +106 -0
- package/src/plugins/playwright/index.ts +82 -0
- package/src/storage/sessions.ts +0 -10
- package/src/util/config.ts +20 -1
- package/src/util/log.ts +3 -1
- package/src/backend/claude-sdk/tools.ts +0 -651
- package/src/frontend/teams/tools.ts +0 -175
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* MCP server — Teams tools for the Claude Agent SDK.
|
|
4
|
-
* Communicates with the main bot process via HTTP bridge.
|
|
5
|
-
*
|
|
6
|
-
* Teams-specific: only exposes tools that work via Power Automate webhooks.
|
|
7
|
-
* No reactions, no media uploads, no message editing/deletion.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
11
|
-
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
12
|
-
import { z } from "zod";
|
|
13
|
-
|
|
14
|
-
const BRIDGE_URL = process.env.TALON_BRIDGE_URL || "http://127.0.0.1:19876";
|
|
15
|
-
const CHAT_ID = process.env.TALON_CHAT_ID || "";
|
|
16
|
-
|
|
17
|
-
async function callBridge(
|
|
18
|
-
action: string,
|
|
19
|
-
params: Record<string, unknown>,
|
|
20
|
-
): Promise<unknown> {
|
|
21
|
-
const resp = await fetch(`${BRIDGE_URL}/action`, {
|
|
22
|
-
method: "POST",
|
|
23
|
-
headers: { "Content-Type": "application/json" },
|
|
24
|
-
body: JSON.stringify({ action, _chatId: CHAT_ID, ...params }),
|
|
25
|
-
signal: AbortSignal.timeout(120_000),
|
|
26
|
-
});
|
|
27
|
-
if (!resp.ok) {
|
|
28
|
-
const text = await resp.text();
|
|
29
|
-
throw new Error(`Bridge error (${resp.status}): ${text}`);
|
|
30
|
-
}
|
|
31
|
-
return resp.json();
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function textResult(result: unknown): {
|
|
35
|
-
content: Array<{ type: "text"; text: string }>;
|
|
36
|
-
} {
|
|
37
|
-
const r = result as { text?: string; error?: string };
|
|
38
|
-
return {
|
|
39
|
-
content: [
|
|
40
|
-
{ type: "text" as const, text: r.text ?? JSON.stringify(result) },
|
|
41
|
-
],
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const server = new McpServer({ name: "teams-tools", version: "1.0.0" });
|
|
46
|
-
|
|
47
|
-
// ── Send message ─────────────────────────────────────────────────────────────
|
|
48
|
-
|
|
49
|
-
server.tool(
|
|
50
|
-
"send_message",
|
|
51
|
-
`Send a message to the Teams chat. Supports Markdown formatting.
|
|
52
|
-
|
|
53
|
-
Examples:
|
|
54
|
-
send_message(text="Hello!")
|
|
55
|
-
send_message(text="Here's a **bold** message with \`code\`")`,
|
|
56
|
-
{
|
|
57
|
-
text: z.string().describe("Message text. Supports Markdown."),
|
|
58
|
-
},
|
|
59
|
-
async (params) => textResult(await callBridge("send_message", params)),
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
server.tool(
|
|
63
|
-
"send_message_with_buttons",
|
|
64
|
-
`Send a message with clickable link buttons. Buttons appear below the message as Adaptive Card actions.
|
|
65
|
-
|
|
66
|
-
Example: send_message_with_buttons(text="Choose:", rows=[[{"text":"Docs","url":"https://..."}]])`,
|
|
67
|
-
{
|
|
68
|
-
text: z.string().describe("Message text"),
|
|
69
|
-
rows: z
|
|
70
|
-
.array(
|
|
71
|
-
z.array(
|
|
72
|
-
z.object({
|
|
73
|
-
text: z.string().describe("Button label"),
|
|
74
|
-
url: z.string().optional().describe("URL to open when clicked"),
|
|
75
|
-
}),
|
|
76
|
-
),
|
|
77
|
-
)
|
|
78
|
-
.describe("Button rows"),
|
|
79
|
-
},
|
|
80
|
-
async (params) =>
|
|
81
|
-
textResult(await callBridge("send_message_with_buttons", params)),
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
// ── Chat info ────────────────────────────────────────────────────────────────
|
|
85
|
-
|
|
86
|
-
server.tool("get_chat_info", "Get info about the current chat.", {}, async () =>
|
|
87
|
-
textResult(await callBridge("get_chat_info", {})),
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
// ── Web tools ────────────────────────────────────────────────────────────────
|
|
91
|
-
|
|
92
|
-
server.tool(
|
|
93
|
-
"web_search",
|
|
94
|
-
"Search the web. Returns titles, URLs, and snippets.",
|
|
95
|
-
{
|
|
96
|
-
query: z.string().describe("Search query"),
|
|
97
|
-
limit: z.number().optional().describe("Max results (default 5, max 10)"),
|
|
98
|
-
},
|
|
99
|
-
async (params) => textResult(await callBridge("web_search", params)),
|
|
100
|
-
);
|
|
101
|
-
|
|
102
|
-
server.tool(
|
|
103
|
-
"fetch_url",
|
|
104
|
-
"Fetch a URL — web pages return text content, images are downloaded to workspace.",
|
|
105
|
-
{
|
|
106
|
-
url: z.string().describe("The URL to fetch"),
|
|
107
|
-
},
|
|
108
|
-
async (params) => textResult(await callBridge("fetch_url", params)),
|
|
109
|
-
);
|
|
110
|
-
|
|
111
|
-
// ── Cron jobs ────────────────────────────────────────────────────────────────
|
|
112
|
-
|
|
113
|
-
server.tool(
|
|
114
|
-
"create_cron_job",
|
|
115
|
-
`Create a persistent recurring scheduled job. Jobs survive restarts.
|
|
116
|
-
|
|
117
|
-
Cron format: "minute hour day month weekday" (5 fields)
|
|
118
|
-
Examples:
|
|
119
|
-
"0 9 * * *" = every day at 9:00 AM
|
|
120
|
-
"*/15 * * * *" = every 15 minutes
|
|
121
|
-
|
|
122
|
-
Type "message" sends the content as a text message.
|
|
123
|
-
Type "query" runs the content as a Claude prompt with full tool access.`,
|
|
124
|
-
{
|
|
125
|
-
name: z.string().describe("Human-readable name for the job"),
|
|
126
|
-
schedule: z.string().describe("Cron expression (5-field)"),
|
|
127
|
-
type: z.enum(["message", "query"]).describe("Job type"),
|
|
128
|
-
content: z.string().describe("Message text or query prompt"),
|
|
129
|
-
timezone: z.string().optional().describe("IANA timezone"),
|
|
130
|
-
},
|
|
131
|
-
async (params) => textResult(await callBridge("create_cron_job", params)),
|
|
132
|
-
);
|
|
133
|
-
|
|
134
|
-
server.tool(
|
|
135
|
-
"list_cron_jobs",
|
|
136
|
-
"List all cron jobs in the current chat.",
|
|
137
|
-
{},
|
|
138
|
-
async () => textResult(await callBridge("list_cron_jobs", {})),
|
|
139
|
-
);
|
|
140
|
-
|
|
141
|
-
server.tool(
|
|
142
|
-
"edit_cron_job",
|
|
143
|
-
"Edit an existing cron job.",
|
|
144
|
-
{
|
|
145
|
-
job_id: z.string().describe("Job ID to edit"),
|
|
146
|
-
name: z.string().optional(),
|
|
147
|
-
schedule: z.string().optional(),
|
|
148
|
-
type: z.enum(["message", "query"]).optional(),
|
|
149
|
-
content: z.string().optional(),
|
|
150
|
-
enabled: z.boolean().optional(),
|
|
151
|
-
timezone: z.string().optional(),
|
|
152
|
-
},
|
|
153
|
-
async (params) => textResult(await callBridge("edit_cron_job", params)),
|
|
154
|
-
);
|
|
155
|
-
|
|
156
|
-
server.tool(
|
|
157
|
-
"delete_cron_job",
|
|
158
|
-
"Delete a cron job permanently.",
|
|
159
|
-
{
|
|
160
|
-
job_id: z.string().describe("Job ID to delete"),
|
|
161
|
-
},
|
|
162
|
-
async (params) => textResult(await callBridge("delete_cron_job", params)),
|
|
163
|
-
);
|
|
164
|
-
|
|
165
|
-
// ── Start ────────────────────────────────────────────────────────────────────
|
|
166
|
-
|
|
167
|
-
async function main() {
|
|
168
|
-
const transport = new StdioServerTransport();
|
|
169
|
-
await server.connect(transport);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
main().catch((err) => {
|
|
173
|
-
console.error("MCP server error:", err);
|
|
174
|
-
process.exit(1);
|
|
175
|
-
});
|