@tacitai/mcp-server 0.1.1 → 0.2.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/dist/auth.d.ts +32 -0
- package/dist/auth.js +64 -0
- package/dist/client.d.ts +60 -5
- package/dist/client.js +234 -53
- package/dist/index.js +128 -106
- package/dist/oauth.d.ts +115 -0
- package/dist/oauth.js +619 -0
- package/dist/prompts.d.ts +2 -0
- package/dist/prompts.js +12 -0
- package/dist/setup.d.ts +28 -5
- package/dist/setup.js +266 -59
- package/dist/tools/agents.d.ts +277 -0
- package/dist/tools/agents.js +335 -0
- package/dist/tools/annotations.d.ts +117 -0
- package/dist/tools/annotations.js +130 -0
- package/dist/tools/artifacts.d.ts +178 -8
- package/dist/tools/artifacts.js +372 -81
- package/dist/tools/chronicle.d.ts +3 -0
- package/dist/tools/chronicle.js +165 -0
- package/dist/tools/connector_write_back.d.ts +3 -0
- package/dist/tools/connector_write_back.js +27 -0
- package/dist/tools/converse.d.ts +10 -0
- package/dist/tools/converse.js +88 -0
- package/dist/tools/crews.d.ts +3 -0
- package/dist/tools/crews.js +115 -0
- package/dist/tools/drafts.d.ts +83 -0
- package/dist/tools/drafts.js +86 -0
- package/dist/tools/errors.d.ts +15 -0
- package/dist/tools/errors.js +21 -0
- package/dist/tools/export.d.ts +54 -0
- package/dist/tools/export.js +55 -0
- package/dist/tools/gm.d.ts +214 -0
- package/dist/tools/gm.js +198 -0
- package/dist/tools/ingest.d.ts +58 -4
- package/dist/tools/ingest.js +109 -76
- package/dist/tools/kb.d.ts +544 -0
- package/dist/tools/kb.js +687 -0
- package/dist/tools/lake-structure.d.ts +3 -0
- package/dist/tools/lake-structure.js +126 -0
- package/dist/tools/lake.d.ts +932 -0
- package/dist/tools/lake.js +1017 -0
- package/dist/tools/move.d.ts +200 -0
- package/dist/tools/move.js +96 -0
- package/dist/tools/outbox.d.ts +274 -0
- package/dist/tools/outbox.js +223 -0
- package/dist/tools/people.d.ts +3 -0
- package/dist/tools/people.js +59 -0
- package/dist/tools/pyramid.d.ts +554 -0
- package/dist/tools/pyramid.js +758 -0
- package/dist/tools/recall.d.ts +2 -0
- package/dist/tools/recall.js +28 -17
- package/dist/tools/registry.d.ts +17 -0
- package/dist/tools/registry.js +197 -0
- package/dist/tools/research.d.ts +47 -0
- package/dist/tools/research.js +575 -0
- package/dist/tools/search.d.ts +9 -0
- package/dist/tools/search.js +86 -25
- package/dist/tools/sharing.d.ts +63 -0
- package/dist/tools/sharing.js +157 -0
- package/dist/tools/synthesize.d.ts +54 -2
- package/dist/tools/synthesize.js +80 -23
- package/dist/tools/web-url.d.ts +57 -0
- package/dist/tools/web-url.js +74 -0
- package/dist/tools/workspaces.d.ts +3 -0
- package/dist/tools/workspaces.js +47 -0
- package/dist/transport.d.ts +9 -0
- package/dist/transport.js +209 -0
- package/package.json +5 -4
package/dist/tools/recall.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Route: POST /api/v1/mind/recall
|
|
4
4
|
*/
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
6
7
|
import { TacitClient } from '../client.js';
|
|
7
8
|
export declare const recallInputSchema: z.ZodObject<{
|
|
8
9
|
query: z.ZodString;
|
|
@@ -61,3 +62,4 @@ export declare function handleRecall(args: unknown): Promise<{
|
|
|
61
62
|
}>;
|
|
62
63
|
isError?: boolean;
|
|
63
64
|
}>;
|
|
65
|
+
export declare function registerRecallTools(server: McpServer, getClientFn: () => Promise<TacitClient>): void;
|
package/dist/tools/recall.js
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// SPDX-License-Identifier: MIT
|
|
3
2
|
/**
|
|
4
3
|
* tacit_recall — Chronicle event recall (hybrid vector)
|
|
5
4
|
* Route: POST /api/v1/mind/recall
|
|
6
5
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports.recallInputSchema = zod_1.z.object({
|
|
14
|
-
query: zod_1.z.string().min(1).describe('Recall query'),
|
|
15
|
-
portfolio_id: zod_1.z.string().min(1).describe('Portfolio UUID to scope the recall'),
|
|
16
|
-
limit: zod_1.z.number().int().positive().optional().describe('Maximum events to return'),
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import { getClient, TacitApiError, TokenExpiredError } from '../client.js';
|
|
8
|
+
export const recallInputSchema = z.object({
|
|
9
|
+
query: z.string().min(1).describe('Recall query'),
|
|
10
|
+
portfolio_id: z.string().min(1).describe('Portfolio UUID to scope the recall'),
|
|
11
|
+
limit: z.number().int().positive().optional().describe('Maximum events to return'),
|
|
17
12
|
});
|
|
18
|
-
|
|
13
|
+
export const RECALL_TOOL_DEF = {
|
|
19
14
|
name: 'tacit_recall',
|
|
20
15
|
description: 'Recall Chronicle events from Tacit workspace via hybrid vector search. Route: POST /api/v1/mind/recall.',
|
|
21
16
|
inputSchema: {
|
|
@@ -32,7 +27,7 @@ exports.RECALL_TOOL_DEF = {
|
|
|
32
27
|
* Build a recall request object. Call .execute() to perform the HTTP call.
|
|
33
28
|
* Exported for testability (allows injecting a mock TacitClient).
|
|
34
29
|
*/
|
|
35
|
-
function buildRecallRequest(client, input) {
|
|
30
|
+
export function buildRecallRequest(client, input) {
|
|
36
31
|
return {
|
|
37
32
|
async execute() {
|
|
38
33
|
const { query, portfolio_id, limit } = input;
|
|
@@ -45,7 +40,13 @@ function buildRecallRequest(client, input) {
|
|
|
45
40
|
return { content: [{ type: 'text', text: JSON.stringify(result) }] };
|
|
46
41
|
}
|
|
47
42
|
catch (err) {
|
|
48
|
-
if (err instanceof
|
|
43
|
+
if (err instanceof TokenExpiredError) {
|
|
44
|
+
return {
|
|
45
|
+
content: [{ type: 'text', text: err.message }],
|
|
46
|
+
isError: true,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
if (err instanceof TacitApiError) {
|
|
49
50
|
return { content: [{ type: 'text', text: `API error ${err.statusCode}: ${err.body}` }], isError: true };
|
|
50
51
|
}
|
|
51
52
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -54,13 +55,23 @@ function buildRecallRequest(client, input) {
|
|
|
54
55
|
},
|
|
55
56
|
};
|
|
56
57
|
}
|
|
57
|
-
async function handleRecall(args) {
|
|
58
|
-
const parsed =
|
|
58
|
+
export async function handleRecall(args) {
|
|
59
|
+
const parsed = recallInputSchema.safeParse(args);
|
|
59
60
|
if (!parsed.success) {
|
|
60
61
|
return {
|
|
61
62
|
content: [{ type: 'text', text: `Invalid input: ${parsed.error.message}` }],
|
|
62
63
|
isError: true,
|
|
63
64
|
};
|
|
64
65
|
}
|
|
65
|
-
return buildRecallRequest(
|
|
66
|
+
return buildRecallRequest(getClient(), parsed.data).execute();
|
|
67
|
+
}
|
|
68
|
+
export function registerRecallTools(server, getClientFn) {
|
|
69
|
+
server.tool('tacit_recall', 'Recall Chronicle events from Tacit workspace via hybrid vector search. Route: POST /api/v1/mind/recall.', {
|
|
70
|
+
query: z.string().min(1).describe('Recall query'),
|
|
71
|
+
portfolio_id: z.string().min(1).describe('Portfolio UUID to scope the recall'),
|
|
72
|
+
limit: z.number().int().positive().optional().describe('Maximum events to return'),
|
|
73
|
+
}, async (args) => {
|
|
74
|
+
const client = await getClientFn();
|
|
75
|
+
return buildRecallRequest(client, args).execute();
|
|
76
|
+
});
|
|
66
77
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compile-time tool classification. Governs which tools may be called over HTTPS.
|
|
3
|
+
* Partition: 6 stdio_only + 15 admin_only + 2 gate_only + 108 https = 131.
|
|
4
|
+
*/
|
|
5
|
+
export type ToolTransport = 'https' | 'stdio_only' | 'admin_only' | 'gate_only';
|
|
6
|
+
export type ToolClass = 'read' | 'write' | 'admin' | 'dispatch';
|
|
7
|
+
export interface ToolEntry {
|
|
8
|
+
name: string;
|
|
9
|
+
toolClass: ToolClass;
|
|
10
|
+
transport: ToolTransport;
|
|
11
|
+
fs: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const TOOL_REGISTRY: ReadonlyMap<string, ToolEntry>;
|
|
14
|
+
/** Unknown tools are blocked (fail closed). */
|
|
15
|
+
export declare function isBlockedOnHttps(toolName: string): boolean;
|
|
16
|
+
export declare function getBlockedReason(toolName: string): 'stdio_only' | 'admin_only' | 'gate_only' | null;
|
|
17
|
+
export declare function getHttpsEligibleTools(): string[];
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
/**
|
|
3
|
+
* Compile-time tool classification. Governs which tools may be called over HTTPS.
|
|
4
|
+
* Partition: 6 stdio_only + 15 admin_only + 2 gate_only + 108 https = 131.
|
|
5
|
+
*/
|
|
6
|
+
const STDIO_ONLY = [
|
|
7
|
+
'tacit_ingest_file',
|
|
8
|
+
'tacit_outbox_write',
|
|
9
|
+
'tacit_outbox_flush',
|
|
10
|
+
'tacit_outbox_status',
|
|
11
|
+
'tacit_export_to_git',
|
|
12
|
+
'tacit_switch_workspace',
|
|
13
|
+
];
|
|
14
|
+
const ADMIN_ONLY = [
|
|
15
|
+
'tacit_delete_portfolio',
|
|
16
|
+
'tacit_delete_program',
|
|
17
|
+
'tacit_delete_value_stream',
|
|
18
|
+
'tacit_pyramid_delete_dossier',
|
|
19
|
+
'tacit_lake_register_source',
|
|
20
|
+
'tacit_lake_deregister_source',
|
|
21
|
+
'tacit_lake_writeback',
|
|
22
|
+
'tacit_lake_taxonomy_seed',
|
|
23
|
+
'tacit_lake_taxonomy_upsert_node',
|
|
24
|
+
'tacit_lake_apply_structure',
|
|
25
|
+
'tacit_lake_folder_merge',
|
|
26
|
+
'tacit_lake_folder_remove',
|
|
27
|
+
'tacit_lake_delete_catalog_item',
|
|
28
|
+
'tacit_compose',
|
|
29
|
+
'tacit_converse',
|
|
30
|
+
];
|
|
31
|
+
const GATE_ONLY = ['tacit_approve_gate', 'tacit_reject_gate'];
|
|
32
|
+
const READ_TOOLS = [
|
|
33
|
+
'tacit_agent_approvals',
|
|
34
|
+
'tacit_agent_list',
|
|
35
|
+
'tacit_agent_thread',
|
|
36
|
+
'tacit_agent_timeline',
|
|
37
|
+
'tacit_artifact_get',
|
|
38
|
+
'tacit_artifact_html_token',
|
|
39
|
+
'tacit_artifact_list',
|
|
40
|
+
'tacit_artifact_pdf',
|
|
41
|
+
'tacit_artifact_versions',
|
|
42
|
+
'tacit_ask',
|
|
43
|
+
'tacit_chronicle_events',
|
|
44
|
+
'tacit_chronicle_graph',
|
|
45
|
+
'tacit_chronicle_search',
|
|
46
|
+
'tacit_chronicle_timeline',
|
|
47
|
+
'tacit_converse_messages',
|
|
48
|
+
'tacit_converse_sessions',
|
|
49
|
+
'tacit_crew_history',
|
|
50
|
+
'tacit_crew_status',
|
|
51
|
+
'tacit_current_workspace',
|
|
52
|
+
'tacit_draft_search',
|
|
53
|
+
'tacit_entity_search',
|
|
54
|
+
'tacit_get_event',
|
|
55
|
+
'tacit_get_myself',
|
|
56
|
+
'tacit_get_person',
|
|
57
|
+
'tacit_get_value_stream',
|
|
58
|
+
'tacit_kb_browse_tree',
|
|
59
|
+
'tacit_kb_freshness',
|
|
60
|
+
'tacit_kb_get_article',
|
|
61
|
+
'tacit_kb_list_articles',
|
|
62
|
+
'tacit_kb_list_categories',
|
|
63
|
+
'tacit_kb_list_collections',
|
|
64
|
+
'tacit_lake_browse_catalog',
|
|
65
|
+
'tacit_lake_catalog_detail',
|
|
66
|
+
'tacit_lake_folder_list',
|
|
67
|
+
'tacit_lake_list_proposals',
|
|
68
|
+
'tacit_lake_list_sources',
|
|
69
|
+
'tacit_lake_manifest',
|
|
70
|
+
'tacit_lake_resolve',
|
|
71
|
+
'tacit_lake_sync_status',
|
|
72
|
+
'tacit_lake_taxonomy_browse',
|
|
73
|
+
'tacit_list_annotations',
|
|
74
|
+
'tacit_list_deliverables',
|
|
75
|
+
'tacit_list_people',
|
|
76
|
+
'tacit_list_workspaces',
|
|
77
|
+
'tacit_outbox_status',
|
|
78
|
+
'tacit_portfolio_artifacts',
|
|
79
|
+
'tacit_pyramid_get_dossier',
|
|
80
|
+
'tacit_pyramid_list_dossiers',
|
|
81
|
+
'tacit_pyramid_list_portfolios',
|
|
82
|
+
'tacit_pyramid_list_programs',
|
|
83
|
+
'tacit_pyramid_list_value_streams',
|
|
84
|
+
'tacit_recall',
|
|
85
|
+
'tacit_search',
|
|
86
|
+
'tacit_search_events',
|
|
87
|
+
'tacit_search_suggest',
|
|
88
|
+
'tacit_shared_list',
|
|
89
|
+
'tacit_shared_read',
|
|
90
|
+
'tacit_shared_search',
|
|
91
|
+
'tacit_synthesize',
|
|
92
|
+
'tacit_web_url',
|
|
93
|
+
];
|
|
94
|
+
const DISPATCH_TOOLS = [
|
|
95
|
+
'tacit_agent_delegate',
|
|
96
|
+
'tacit_dispatch_crew',
|
|
97
|
+
'tacit_kb_pull_source',
|
|
98
|
+
'tacit_lake_trigger_sync',
|
|
99
|
+
'tacit_research_launch',
|
|
100
|
+
];
|
|
101
|
+
const WRITE_TOOLS = [
|
|
102
|
+
'tacit_agent_decide',
|
|
103
|
+
'tacit_annotate',
|
|
104
|
+
'tacit_approve_gate',
|
|
105
|
+
'tacit_artifact_create',
|
|
106
|
+
'tacit_artifact_delete',
|
|
107
|
+
'tacit_artifact_publish',
|
|
108
|
+
'tacit_artifact_revise',
|
|
109
|
+
'tacit_artifact_update',
|
|
110
|
+
'tacit_create_event',
|
|
111
|
+
'tacit_create_person',
|
|
112
|
+
'tacit_edit_deliverable',
|
|
113
|
+
'tacit_export_to_git',
|
|
114
|
+
'tacit_import_artifact',
|
|
115
|
+
'tacit_ingest_file',
|
|
116
|
+
'tacit_ingest_url',
|
|
117
|
+
'tacit_ingest_url_general',
|
|
118
|
+
'tacit_kb_create_article',
|
|
119
|
+
'tacit_kb_create_category',
|
|
120
|
+
'tacit_kb_create_collection',
|
|
121
|
+
'tacit_kb_delete_collection',
|
|
122
|
+
'tacit_kb_promote_from_artifact',
|
|
123
|
+
'tacit_kb_promote_from_catalog',
|
|
124
|
+
'tacit_kb_register_source',
|
|
125
|
+
'tacit_kb_update_article',
|
|
126
|
+
'tacit_kb_update_collection',
|
|
127
|
+
'tacit_lake_classify',
|
|
128
|
+
'tacit_lake_classify_subject',
|
|
129
|
+
'tacit_lake_confirm_proposal',
|
|
130
|
+
'tacit_lake_folder_add',
|
|
131
|
+
'tacit_lake_folder_rename',
|
|
132
|
+
'tacit_lake_ingest',
|
|
133
|
+
'tacit_lake_propose_structure',
|
|
134
|
+
'tacit_lake_reclassify',
|
|
135
|
+
'tacit_lake_reclassify_subjects',
|
|
136
|
+
'tacit_move',
|
|
137
|
+
'tacit_outbox_flush',
|
|
138
|
+
'tacit_outbox_write',
|
|
139
|
+
'tacit_patch_portfolio',
|
|
140
|
+
'tacit_patch_program',
|
|
141
|
+
'tacit_patch_value_stream',
|
|
142
|
+
'tacit_pyramid_assign_program_to_value_stream',
|
|
143
|
+
'tacit_pyramid_create_dossier',
|
|
144
|
+
'tacit_pyramid_create_portfolio',
|
|
145
|
+
'tacit_pyramid_create_program',
|
|
146
|
+
'tacit_pyramid_create_value_stream',
|
|
147
|
+
'tacit_pyramid_update_dossier',
|
|
148
|
+
'tacit_reject_gate',
|
|
149
|
+
'tacit_research_place',
|
|
150
|
+
'tacit_research_prepare',
|
|
151
|
+
'tacit_share_artifact',
|
|
152
|
+
'tacit_switch_workspace',
|
|
153
|
+
];
|
|
154
|
+
function build() {
|
|
155
|
+
const map = new Map();
|
|
156
|
+
const add = (name, toolClass, transport, fs) => {
|
|
157
|
+
if (map.has(name))
|
|
158
|
+
throw new Error(`duplicate tool classification: ${name}`);
|
|
159
|
+
map.set(name, { name, toolClass, transport, fs });
|
|
160
|
+
};
|
|
161
|
+
const exclusive = new Set([...STDIO_ONLY, ...ADMIN_ONLY, ...GATE_ONLY]);
|
|
162
|
+
const classOf = (name) => {
|
|
163
|
+
if (DISPATCH_TOOLS.includes(name))
|
|
164
|
+
return 'dispatch';
|
|
165
|
+
if (READ_TOOLS.includes(name))
|
|
166
|
+
return 'read';
|
|
167
|
+
return 'write';
|
|
168
|
+
};
|
|
169
|
+
for (const n of STDIO_ONLY)
|
|
170
|
+
add(n, classOf(n), 'stdio_only', true);
|
|
171
|
+
for (const n of ADMIN_ONLY)
|
|
172
|
+
add(n, 'admin', 'admin_only', false);
|
|
173
|
+
for (const n of GATE_ONLY)
|
|
174
|
+
add(n, 'write', 'gate_only', false);
|
|
175
|
+
for (const n of [...READ_TOOLS, ...DISPATCH_TOOLS, ...WRITE_TOOLS]) {
|
|
176
|
+
if (!exclusive.has(n))
|
|
177
|
+
add(n, classOf(n), 'https', false);
|
|
178
|
+
}
|
|
179
|
+
if (map.size !== 131)
|
|
180
|
+
throw new Error(`tool registry expected 131 tools, got ${map.size}`);
|
|
181
|
+
return map;
|
|
182
|
+
}
|
|
183
|
+
export const TOOL_REGISTRY = build();
|
|
184
|
+
/** Unknown tools are blocked (fail closed). */
|
|
185
|
+
export function isBlockedOnHttps(toolName) {
|
|
186
|
+
const entry = TOOL_REGISTRY.get(toolName);
|
|
187
|
+
return !entry || entry.transport !== 'https';
|
|
188
|
+
}
|
|
189
|
+
export function getBlockedReason(toolName) {
|
|
190
|
+
const entry = TOOL_REGISTRY.get(toolName);
|
|
191
|
+
if (!entry || entry.transport === 'https')
|
|
192
|
+
return null;
|
|
193
|
+
return entry.transport;
|
|
194
|
+
}
|
|
195
|
+
export function getHttpsEligibleTools() {
|
|
196
|
+
return [...TOOL_REGISTRY.values()].filter((e) => e.transport === 'https').map((e) => e.name);
|
|
197
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Research tools (MV-1525) — scope discovery + grounded prompt assembly,
|
|
3
|
+
* pyramid/KB placement with T3 confirmation, and async Gemini launch.
|
|
4
|
+
*
|
|
5
|
+
* MV-1138b: principal-scoped task store, TTL eviction, per-principal rate
|
|
6
|
+
* limits, configurable model, hard timeout for running tasks.
|
|
7
|
+
*/
|
|
8
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
9
|
+
import type { TacitClient } from '../client.js';
|
|
10
|
+
export interface ContextSource {
|
|
11
|
+
title: string;
|
|
12
|
+
excerpt: string;
|
|
13
|
+
source_id: string;
|
|
14
|
+
source_type: 'kb' | 'pyramid' | 'lake';
|
|
15
|
+
}
|
|
16
|
+
type TaskStatus = {
|
|
17
|
+
status: 'running';
|
|
18
|
+
startedAt: number;
|
|
19
|
+
} | {
|
|
20
|
+
status: 'completed';
|
|
21
|
+
content: string;
|
|
22
|
+
token_usage: unknown;
|
|
23
|
+
model: string;
|
|
24
|
+
duration_seconds: number;
|
|
25
|
+
completedAt: number;
|
|
26
|
+
} | {
|
|
27
|
+
status: 'failed';
|
|
28
|
+
error: string;
|
|
29
|
+
failedAt: number;
|
|
30
|
+
};
|
|
31
|
+
interface PrincipalTaskState {
|
|
32
|
+
principal: string;
|
|
33
|
+
task: TaskStatus;
|
|
34
|
+
}
|
|
35
|
+
export declare const _testInternals: {
|
|
36
|
+
readonly tasks: Map<string, PrincipalTaskState>;
|
|
37
|
+
readonly dailyLaunches: Map<string, DailyCounter>;
|
|
38
|
+
evictExpired: typeof evictExpired;
|
|
39
|
+
resetForTest(): void;
|
|
40
|
+
};
|
|
41
|
+
interface DailyCounter {
|
|
42
|
+
count: number;
|
|
43
|
+
resetAt: number;
|
|
44
|
+
}
|
|
45
|
+
declare function evictExpired(): void;
|
|
46
|
+
export declare function registerResearchTools(server: McpServer, getClientFn: () => Promise<TacitClient>, getPrincipalFn?: () => string | null): void;
|
|
47
|
+
export {};
|