@2kw/ai-mcp-server 6.0.0 → 6.1.0-dev.10

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.
@@ -120,5 +120,68 @@ export function register(server, client) {
120
120
  };
121
121
  }
122
122
  });
123
+ // ── sessions ────────────────────────────────────────────────────────────
124
+ server.tool("2kw_list_trace_sessions", "List sessions (spans grouped by an exporter-stamped session id) in the org, with turn/error counts, duration, tokens and cost. Optional free-text search across session id and name, and a start-time range.", {
125
+ search: z.string().optional().describe("Free-text search across session id and name"),
126
+ from: z.string().optional().describe("Start of time range (ISO-8601)"),
127
+ to: z.string().optional().describe("End of time range (ISO-8601)"),
128
+ page: z.number().int().min(0).optional().describe("Page index (0-based)"),
129
+ size: z.number().int().min(1).max(100).optional().describe("Page size"),
130
+ }, async (params) => {
131
+ try {
132
+ const { data } = await client.GET("/v1/traces/sessions", {
133
+ params: {
134
+ query: {
135
+ search: params.search,
136
+ from: params.from,
137
+ to: params.to,
138
+ page: params.page ?? 0,
139
+ size: params.size ?? 20,
140
+ },
141
+ },
142
+ });
143
+ const result = data;
144
+ const lines = (result.content ?? []).map((s) => {
145
+ const services = Array.isArray(s.sourceServices)
146
+ ? s.sourceServices.join(", ")
147
+ : "";
148
+ return `- ${s.sessionId} ${s.name ?? "(unnamed)"} · ${s.durationMs}ms · ${s.turnCount} turns · ${s.errorCount} errors · ${services}`;
149
+ });
150
+ return {
151
+ content: [
152
+ {
153
+ type: "text",
154
+ text: `Sessions (${result.totalElements ?? 0} total, page ${(result.number ?? 0) + 1}/${result.totalPages ?? 1}):\n${lines.join("\n") || "(none)"}`,
155
+ },
156
+ ],
157
+ };
158
+ }
159
+ catch (error) {
160
+ return {
161
+ content: [{ type: "text", text: formatErrorForMcp(error) }],
162
+ isError: true,
163
+ };
164
+ }
165
+ });
166
+ server.tool("2kw_get_trace_session", "Get every span recorded under a session, flat and sorted by start time — reconstruct the conversation chronologically. The id is the external session id stamped by the exporter.", {
167
+ sessionId: z.string().describe("Session id"),
168
+ }, async (params) => {
169
+ try {
170
+ const { data } = await client.GET("/v1/traces/sessions/{sessionId}", {
171
+ params: { path: { sessionId: params.sessionId } },
172
+ });
173
+ return {
174
+ content: [
175
+ { type: "text", text: JSON.stringify(data, null, 2) },
176
+ ],
177
+ };
178
+ }
179
+ catch (error) {
180
+ return {
181
+ content: [{ type: "text", text: formatErrorForMcp(error) }],
182
+ isError: true,
183
+ };
184
+ }
185
+ });
123
186
  }
124
187
  //# sourceMappingURL=tracing.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@2kw/ai-mcp-server",
3
- "version": "6.0.0",
4
- "description": "MCP server for 2kw.ai — EU-hosted AI platform: OpenAI-compatible LLM gateway, schema-driven document extraction, transcription, and cost observability. 86 tools for Claude Code, Cursor, and Windsurf.",
3
+ "version": "6.1.0-dev.10",
4
+ "description": "MCP server for 2kw.ai — EU-hosted AI platform: OpenAI-compatible LLM gateway, schema-driven document extraction, transcription, agents with a knowledge base, and cost observability. 158 tools for Claude Code, Cursor, and Windsurf.",
5
5
  "mcpName": "ai.2kw/mcp-server",
6
6
  "keywords": [
7
7
  "mcp",
@@ -40,6 +40,7 @@
40
40
  "check:spec": "tsx --env-file=.env openapi/scripts/check-drift.ts",
41
41
  "check:generated": "tsx openapi/scripts/check-generated.ts",
42
42
  "fix:generated": "tsx openapi/scripts/check-generated.ts --write",
43
+ "check:coverage": "tsx ../cli/openapi/scripts/check-coverage.ts",
43
44
  "typecheck": "tsc --noEmit"
44
45
  },
45
46
  "dependencies": {