@sudocode-ai/mcp 0.1.18-dev.0 → 0.1.18

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/index.js CHANGED
@@ -3,6 +3,30 @@
3
3
  * sudocode MCP Server entry point
4
4
  */
5
5
  import { SudocodeMCPServer } from "./server.js";
6
+ import { resolveScopes, hasExtendedScopes, getMissingServerUrlScopes, } from "./scopes.js";
7
+ import { createHash } from "crypto";
8
+ import { basename, resolve } from "path";
9
+ /**
10
+ * Generate a deterministic project ID from a path.
11
+ * Uses the same algorithm as the server's ProjectRegistry.
12
+ * Format: <repo-name>-<8-char-hash>
13
+ */
14
+ function generateProjectId(projectPath) {
15
+ // Resolve to absolute path
16
+ const absolutePath = resolve(projectPath);
17
+ // Extract repo name from path
18
+ const repoName = basename(absolutePath);
19
+ // Create URL-safe version of repo name
20
+ const safeName = repoName
21
+ .toLowerCase()
22
+ .replace(/[^a-z0-9-]/g, "-")
23
+ .replace(/-+/g, "-")
24
+ .replace(/^-|-$/g, "") // Remove leading/trailing dashes
25
+ .slice(0, 32);
26
+ // Generate short hash for uniqueness
27
+ const hash = createHash("sha256").update(absolutePath).digest("hex").slice(0, 8);
28
+ return `${safeName}-${hash}`;
29
+ }
6
30
  function parseArgs() {
7
31
  const config = {};
8
32
  const args = process.argv.slice(2);
@@ -23,6 +47,16 @@ function parseArgs() {
23
47
  case "--no-sync":
24
48
  config.syncOnStartup = false;
25
49
  break;
50
+ case "--scope":
51
+ case "-s":
52
+ config.scope = args[++i];
53
+ break;
54
+ case "--server-url":
55
+ config.serverUrl = args[++i];
56
+ break;
57
+ case "--project-id":
58
+ config.projectId = args[++i];
59
+ break;
26
60
  case "--help":
27
61
  case "-h":
28
62
  console.log(`
@@ -35,12 +69,42 @@ Options:
35
69
  --cli-path <path> Path to sudocode CLI (default: 'sudocode' or SUDOCODE_PATH)
36
70
  --db-path <path> Database path (default: auto-discover or SUDOCODE_DB)
37
71
  --no-sync Skip initial sync on startup (default: sync enabled)
72
+ -s, --scope <scopes> Comma-separated list of scopes to enable (default: "default")
73
+ --server-url <url> Local server URL for extended tools (required if scope != default)
74
+ --project-id <id> Project ID for API calls (auto-discovered from working dir)
38
75
  -h, --help Show this help message
39
76
 
77
+ Scopes:
78
+ default Original 10 CLI-wrapped tools (no server required)
79
+ overview project_status tool
80
+ executions Execution management (list, show, start, follow-up, cancel)
81
+ executions:read Read-only execution tools (list, show)
82
+ executions:write Write execution tools (start, follow-up, cancel)
83
+ inspection Execution inspection (trajectory, changes, chain)
84
+ workflows Workflow orchestration (list, show, status, create, control)
85
+ workflows:read Read-only workflow tools
86
+ workflows:write Write workflow tools
87
+ escalation User communication (escalate, notify)
88
+
89
+ Meta-scopes:
90
+ project-assistant All extended scopes (overview, executions, inspection, workflows, escalation)
91
+ all default + project-assistant
92
+
93
+ Examples:
94
+ # Default behavior (original 10 tools)
95
+ sudocode-mcp --working-dir /path/to/repo
96
+
97
+ # Enable execution monitoring
98
+ sudocode-mcp -w /path/to/repo --scope default,executions:read --server-url http://localhost:3000
99
+
100
+ # Full project assistant mode
101
+ sudocode-mcp -w /path/to/repo --scope all --server-url http://localhost:3000
102
+
40
103
  Environment Variables:
41
104
  SUDOCODE_WORKING_DIR Default working directory
42
105
  SUDOCODE_PATH Default CLI path
43
106
  SUDOCODE_DB Default database path
107
+ SUDOCODE_SERVER_URL Default server URL for extended tools
44
108
  `);
45
109
  process.exit(0);
46
110
  break;
@@ -52,8 +116,47 @@ Environment Variables:
52
116
  }
53
117
  return config;
54
118
  }
119
+ /**
120
+ * Validate configuration and resolve scopes.
121
+ */
122
+ function validateConfig(config) {
123
+ // Default scope if not specified
124
+ const scopeArg = config.scope || "default";
125
+ // Use env var for server URL if not specified
126
+ if (!config.serverUrl && process.env.SUDOCODE_SERVER_URL) {
127
+ config.serverUrl = process.env.SUDOCODE_SERVER_URL;
128
+ }
129
+ // Auto-discover project ID from working directory if not specified
130
+ if (!config.projectId && config.workingDir) {
131
+ config.projectId = generateProjectId(config.workingDir);
132
+ console.error(`[mcp] Auto-discovered project ID: ${config.projectId}`);
133
+ }
134
+ else if (!config.projectId) {
135
+ // Try current working directory as fallback
136
+ config.projectId = generateProjectId(process.cwd());
137
+ console.error(`[mcp] Auto-discovered project ID from cwd: ${config.projectId}`);
138
+ }
139
+ try {
140
+ // Validate and resolve scopes
141
+ const scopeConfig = resolveScopes(scopeArg, config.serverUrl, config.projectId);
142
+ // Check if extended scopes are enabled without server URL
143
+ if (hasExtendedScopes(scopeConfig.enabledScopes) && !config.serverUrl) {
144
+ const missingScopes = getMissingServerUrlScopes(scopeConfig.enabledScopes);
145
+ console.error("");
146
+ console.error(`⚠️ WARNING: Extended scopes require --server-url to be configured`);
147
+ console.error(` The following scopes will be disabled: ${missingScopes.join(", ")}`);
148
+ console.error(` Only 'default' scope tools will be available.`);
149
+ console.error("");
150
+ }
151
+ }
152
+ catch (error) {
153
+ console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
154
+ process.exit(1);
155
+ }
156
+ }
55
157
  async function main() {
56
158
  const config = parseArgs();
159
+ validateConfig(config);
57
160
  const server = new SudocodeMCPServer(config);
58
161
  await server.run();
59
162
  }
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;GAEG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD,SAAS,SAAS;IAChB,MAAM,MAAM,GAAyB,EAAE,CAAC;IACxC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAEnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAEpB,QAAQ,GAAG,EAAE,CAAC;YAC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I,CAAC,EAAE,CACxE,CAAC;YACF,OAAO,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAC;YAClE,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACpB,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CACX,UAAU,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACnE,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,KAAK,UAAU,IAAI;IACjB,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,cAAc,CAAC,MAAM,CAAC,CAAC;IACvB,MAAM,MAAM,GAAG,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC7C,MAAM,MAAM,CAAC,GAAG,EAAE,CAAC;AACrB,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Scope System for sudocode MCP Server
3
+ *
4
+ * Provides opt-in tool categories via the --scope argument.
5
+ * Default scope includes the original 10 CLI-wrapped tools.
6
+ * Extended scopes require --server-url for HTTP API access.
7
+ */
8
+ /**
9
+ * Individual scope identifiers.
10
+ * - `default`: Original CLI-wrapped tools (no server required)
11
+ * - Extended scopes: Require server URL for HTTP API
12
+ */
13
+ export type Scope = "default" | "overview" | "executions" | "executions:read" | "executions:write" | "inspection" | "workflows" | "workflows:read" | "workflows:write" | "voice";
14
+ /**
15
+ * Meta-scopes that expand to multiple scopes.
16
+ */
17
+ export type MetaScope = "project-assistant" | "all";
18
+ /**
19
+ * All valid scope identifiers (scopes + meta-scopes).
20
+ */
21
+ export type ScopeIdentifier = Scope | MetaScope;
22
+ /**
23
+ * All individual scopes (excluding meta-scopes).
24
+ */
25
+ export declare const ALL_SCOPES: Scope[];
26
+ /**
27
+ * Scopes that require --server-url to be configured.
28
+ */
29
+ export declare const SERVER_REQUIRED_SCOPES: Scope[];
30
+ /**
31
+ * Meta-scope expansions.
32
+ */
33
+ export declare const META_SCOPE_EXPANSIONS: Record<MetaScope, Scope[]>;
34
+ /**
35
+ * Parent scope expansions (e.g., "executions" -> "executions:read" + "executions:write").
36
+ */
37
+ export declare const PARENT_SCOPE_EXPANSIONS: Record<string, Scope[]>;
38
+ /**
39
+ * Tools available in each scope.
40
+ */
41
+ export declare const SCOPE_TOOLS: Record<Scope, string[]>;
42
+ /**
43
+ * Configuration for scope-based tool filtering.
44
+ */
45
+ export interface ScopeConfig {
46
+ /** Resolved set of enabled scopes */
47
+ enabledScopes: Set<Scope>;
48
+ /** Server URL for extended tools (required if extended scopes enabled) */
49
+ serverUrl?: string;
50
+ /** Project ID for API calls */
51
+ projectId?: string;
52
+ }
53
+ /**
54
+ * Check if a string is a valid scope identifier.
55
+ */
56
+ export declare function isValidScope(scope: string): scope is ScopeIdentifier;
57
+ /**
58
+ * Parse a comma-separated scope string into individual identifiers.
59
+ *
60
+ * @param scopeArg - Comma-separated scope string (e.g., "default,executions")
61
+ * @returns Array of scope identifiers
62
+ * @throws Error if any scope is invalid
63
+ */
64
+ export declare function parseScopes(scopeArg: string): ScopeIdentifier[];
65
+ /**
66
+ * Expand meta-scopes and parent scopes to their constituent scopes.
67
+ *
68
+ * @param scopes - Array of scope identifiers (may include meta-scopes)
69
+ * @returns Set of resolved individual scopes
70
+ */
71
+ export declare function expandScopes(scopes: ScopeIdentifier[]): Set<Scope>;
72
+ /**
73
+ * Resolve a scope argument string to a ScopeConfig.
74
+ *
75
+ * @param scopeArg - Comma-separated scope string
76
+ * @param serverUrl - Optional server URL
77
+ * @param projectId - Optional project ID
78
+ * @returns Resolved ScopeConfig
79
+ */
80
+ export declare function resolveScopes(scopeArg: string, serverUrl?: string, projectId?: string): ScopeConfig;
81
+ /**
82
+ * Check if any extended scopes are enabled (scopes that require server URL).
83
+ */
84
+ export declare function hasExtendedScopes(enabledScopes: Set<Scope>): boolean;
85
+ /**
86
+ * Get the list of extended scopes that are enabled but missing server URL.
87
+ */
88
+ export declare function getMissingServerUrlScopes(enabledScopes: Set<Scope>): Scope[];
89
+ /**
90
+ * Filter enabled scopes to only those that can be used (have required prerequisites).
91
+ *
92
+ * @param enabledScopes - Set of enabled scopes
93
+ * @param serverUrl - Server URL (if configured)
94
+ * @returns Set of scopes that can actually be used
95
+ */
96
+ export declare function getUsableScopes(enabledScopes: Set<Scope>, serverUrl?: string): Set<Scope>;
97
+ /**
98
+ * Get all tools available for the given scopes.
99
+ *
100
+ * @param scopes - Set of enabled scopes
101
+ * @returns Array of tool names
102
+ */
103
+ export declare function getToolsForScopes(scopes: Set<Scope>): string[];
104
+ /**
105
+ * Get the scope that a tool belongs to.
106
+ *
107
+ * @param toolName - Name of the tool
108
+ * @returns The scope containing this tool, or undefined
109
+ */
110
+ export declare function getScopeForTool(toolName: string): Scope | undefined;
111
+ /**
112
+ * Check if a tool is available given the current scope configuration.
113
+ *
114
+ * @param toolName - Name of the tool
115
+ * @param usableScopes - Set of usable scopes (after filtering by prerequisites)
116
+ * @returns true if the tool can be invoked
117
+ */
118
+ export declare function isToolAvailable(toolName: string, usableScopes: Set<Scope>): boolean;
119
+ /**
120
+ * Check if a tool requires the server URL.
121
+ *
122
+ * @param toolName - Name of the tool
123
+ * @returns true if the tool requires server URL
124
+ */
125
+ export declare function toolRequiresServer(toolName: string): boolean;
126
+ //# sourceMappingURL=scopes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scopes.d.ts","sourceRoot":"","sources":["../src/scopes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH;;;;GAIG;AACH,MAAM,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,MAAM,EAChB,SAAS,CAAC,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,GACjB,WAAW,CASb;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,GAAG,CAAC,KAAK,CAAC,GAAG,OAAO,CAOpE;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,aAAa,EAAE,GAAG,CAAC,KAAK,CAAC,GAAG,KAAK,EAAE,CAI5E;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,aAAa,EAAE,GAAG,CAAC,KAAK,CAAC,EACzB,SAAS,CAAC,EAAE,MAAM,GACjB,GAAG,CAAC,KAAK,CAAC,CAiBZ;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,GAAG,MAAM,EAAE,CAU9D;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAOnE;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,GAAG,CAAC,KAAK,CAAC,GACvB,OAAO,CAIT;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAI5D"}
package/dist/scopes.js ADDED
@@ -0,0 +1,282 @@
1
+ /**
2
+ * Scope System for sudocode MCP Server
3
+ *
4
+ * Provides opt-in tool categories via the --scope argument.
5
+ * Default scope includes the original 10 CLI-wrapped tools.
6
+ * Extended scopes require --server-url for HTTP API access.
7
+ */
8
+ // =============================================================================
9
+ // Scope Constants
10
+ // =============================================================================
11
+ /**
12
+ * All individual scopes (excluding meta-scopes).
13
+ */
14
+ export const ALL_SCOPES = [
15
+ "default",
16
+ "overview",
17
+ "executions",
18
+ "executions:read",
19
+ "executions:write",
20
+ "inspection",
21
+ "workflows",
22
+ "workflows:read",
23
+ "workflows:write",
24
+ "voice",
25
+ ];
26
+ /**
27
+ * Scopes that require --server-url to be configured.
28
+ */
29
+ export const SERVER_REQUIRED_SCOPES = [
30
+ "overview",
31
+ "executions",
32
+ "executions:read",
33
+ "executions:write",
34
+ "inspection",
35
+ "workflows",
36
+ "workflows:read",
37
+ "workflows:write",
38
+ "voice",
39
+ ];
40
+ /**
41
+ * Meta-scope expansions.
42
+ */
43
+ export const META_SCOPE_EXPANSIONS = {
44
+ "project-assistant": [
45
+ "overview",
46
+ "executions",
47
+ "inspection",
48
+ "workflows",
49
+ ],
50
+ all: [
51
+ "default",
52
+ "overview",
53
+ "executions",
54
+ "inspection",
55
+ "workflows",
56
+ ],
57
+ };
58
+ /**
59
+ * Parent scope expansions (e.g., "executions" -> "executions:read" + "executions:write").
60
+ */
61
+ export const PARENT_SCOPE_EXPANSIONS = {
62
+ executions: ["executions:read", "executions:write"],
63
+ workflows: ["workflows:read", "workflows:write"],
64
+ };
65
+ /**
66
+ * Tools available in each scope.
67
+ */
68
+ export const SCOPE_TOOLS = {
69
+ // Default scope - original CLI-wrapped tools
70
+ default: [
71
+ "ready",
72
+ "list_issues",
73
+ "show_issue",
74
+ "upsert_issue",
75
+ "list_specs",
76
+ "show_spec",
77
+ "upsert_spec",
78
+ "link",
79
+ "add_reference",
80
+ "add_feedback",
81
+ ],
82
+ // Overview scope
83
+ overview: ["project_status"],
84
+ // Execution scopes
85
+ executions: [], // Parent scope, tools in children
86
+ "executions:read": ["list_executions", "show_execution"],
87
+ "executions:write": [
88
+ "start_execution",
89
+ "start_adhoc_execution",
90
+ "create_follow_up",
91
+ "cancel_execution",
92
+ ],
93
+ // Inspection scope
94
+ inspection: ["execution_trajectory", "execution_changes", "execution_chain"],
95
+ // Workflow scopes
96
+ workflows: [], // Parent scope, tools in children
97
+ "workflows:read": ["list_workflows", "show_workflow", "workflow_status"],
98
+ "workflows:write": [
99
+ "create_workflow",
100
+ "start_workflow",
101
+ "pause_workflow",
102
+ "cancel_workflow",
103
+ "resume_workflow",
104
+ ],
105
+ // Voice scope - for explicit agent narration
106
+ voice: ["speak"],
107
+ };
108
+ // =============================================================================
109
+ // Scope Resolution Functions
110
+ // =============================================================================
111
+ /**
112
+ * Check if a string is a valid scope identifier.
113
+ */
114
+ export function isValidScope(scope) {
115
+ return (ALL_SCOPES.includes(scope) ||
116
+ scope === "project-assistant" ||
117
+ scope === "all");
118
+ }
119
+ /**
120
+ * Parse a comma-separated scope string into individual identifiers.
121
+ *
122
+ * @param scopeArg - Comma-separated scope string (e.g., "default,executions")
123
+ * @returns Array of scope identifiers
124
+ * @throws Error if any scope is invalid
125
+ */
126
+ export function parseScopes(scopeArg) {
127
+ const parts = scopeArg
128
+ .split(",")
129
+ .map((s) => s.trim().toLowerCase())
130
+ .filter((s) => s.length > 0);
131
+ const invalid = parts.filter((p) => !isValidScope(p));
132
+ if (invalid.length > 0) {
133
+ throw new Error(`Unknown scope(s): ${invalid.join(", ")}. Valid scopes: ${ALL_SCOPES.join(", ")}, project-assistant, all`);
134
+ }
135
+ return parts;
136
+ }
137
+ /**
138
+ * Expand meta-scopes and parent scopes to their constituent scopes.
139
+ *
140
+ * @param scopes - Array of scope identifiers (may include meta-scopes)
141
+ * @returns Set of resolved individual scopes
142
+ */
143
+ export function expandScopes(scopes) {
144
+ const result = new Set();
145
+ for (const scope of scopes) {
146
+ // Handle meta-scopes
147
+ if (scope === "project-assistant" || scope === "all") {
148
+ for (const expanded of META_SCOPE_EXPANSIONS[scope]) {
149
+ result.add(expanded);
150
+ // Also expand parent scopes
151
+ if (expanded in PARENT_SCOPE_EXPANSIONS) {
152
+ for (const child of PARENT_SCOPE_EXPANSIONS[expanded]) {
153
+ result.add(child);
154
+ }
155
+ }
156
+ }
157
+ continue;
158
+ }
159
+ // Handle parent scopes (executions, workflows)
160
+ if (scope in PARENT_SCOPE_EXPANSIONS) {
161
+ result.add(scope);
162
+ for (const child of PARENT_SCOPE_EXPANSIONS[scope]) {
163
+ result.add(child);
164
+ }
165
+ continue;
166
+ }
167
+ // Regular scope
168
+ result.add(scope);
169
+ }
170
+ return result;
171
+ }
172
+ /**
173
+ * Resolve a scope argument string to a ScopeConfig.
174
+ *
175
+ * @param scopeArg - Comma-separated scope string
176
+ * @param serverUrl - Optional server URL
177
+ * @param projectId - Optional project ID
178
+ * @returns Resolved ScopeConfig
179
+ */
180
+ export function resolveScopes(scopeArg, serverUrl, projectId) {
181
+ const parsed = parseScopes(scopeArg);
182
+ const enabledScopes = expandScopes(parsed);
183
+ return {
184
+ enabledScopes,
185
+ serverUrl,
186
+ projectId,
187
+ };
188
+ }
189
+ /**
190
+ * Check if any extended scopes are enabled (scopes that require server URL).
191
+ */
192
+ export function hasExtendedScopes(enabledScopes) {
193
+ for (const scope of enabledScopes) {
194
+ if (SERVER_REQUIRED_SCOPES.includes(scope)) {
195
+ return true;
196
+ }
197
+ }
198
+ return false;
199
+ }
200
+ /**
201
+ * Get the list of extended scopes that are enabled but missing server URL.
202
+ */
203
+ export function getMissingServerUrlScopes(enabledScopes) {
204
+ return Array.from(enabledScopes).filter((scope) => SERVER_REQUIRED_SCOPES.includes(scope));
205
+ }
206
+ /**
207
+ * Filter enabled scopes to only those that can be used (have required prerequisites).
208
+ *
209
+ * @param enabledScopes - Set of enabled scopes
210
+ * @param serverUrl - Server URL (if configured)
211
+ * @returns Set of scopes that can actually be used
212
+ */
213
+ export function getUsableScopes(enabledScopes, serverUrl) {
214
+ const usable = new Set();
215
+ for (const scope of enabledScopes) {
216
+ // Default scope always usable
217
+ if (scope === "default") {
218
+ usable.add(scope);
219
+ continue;
220
+ }
221
+ // Extended scopes require server URL
222
+ if (SERVER_REQUIRED_SCOPES.includes(scope) && serverUrl) {
223
+ usable.add(scope);
224
+ }
225
+ }
226
+ return usable;
227
+ }
228
+ /**
229
+ * Get all tools available for the given scopes.
230
+ *
231
+ * @param scopes - Set of enabled scopes
232
+ * @returns Array of tool names
233
+ */
234
+ export function getToolsForScopes(scopes) {
235
+ const tools = new Set();
236
+ for (const scope of scopes) {
237
+ for (const tool of SCOPE_TOOLS[scope]) {
238
+ tools.add(tool);
239
+ }
240
+ }
241
+ return Array.from(tools);
242
+ }
243
+ /**
244
+ * Get the scope that a tool belongs to.
245
+ *
246
+ * @param toolName - Name of the tool
247
+ * @returns The scope containing this tool, or undefined
248
+ */
249
+ export function getScopeForTool(toolName) {
250
+ for (const [scope, tools] of Object.entries(SCOPE_TOOLS)) {
251
+ if (tools.includes(toolName)) {
252
+ return scope;
253
+ }
254
+ }
255
+ return undefined;
256
+ }
257
+ /**
258
+ * Check if a tool is available given the current scope configuration.
259
+ *
260
+ * @param toolName - Name of the tool
261
+ * @param usableScopes - Set of usable scopes (after filtering by prerequisites)
262
+ * @returns true if the tool can be invoked
263
+ */
264
+ export function isToolAvailable(toolName, usableScopes) {
265
+ const scope = getScopeForTool(toolName);
266
+ if (!scope)
267
+ return false;
268
+ return usableScopes.has(scope);
269
+ }
270
+ /**
271
+ * Check if a tool requires the server URL.
272
+ *
273
+ * @param toolName - Name of the tool
274
+ * @returns true if the tool requires server URL
275
+ */
276
+ export function toolRequiresServer(toolName) {
277
+ const scope = getScopeForTool(toolName);
278
+ if (!scope)
279
+ return false;
280
+ return SERVER_REQUIRED_SCOPES.includes(scope);
281
+ }
282
+ //# sourceMappingURL=scopes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scopes.js","sourceRoot":"","sources":["../src/scopes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAmCH,gFAAgF;AAChF,kBAAkB;AAClB,gFAAgF;AAEhF;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAY;IACjC,SAAS;IACT,UAAU;IACV,YAAY;IACZ,iBAAiB;IACjB,kBAAkB;IAClB,YAAY;IACZ,WAAW;IACX,gBAAgB;IAChB,iBAAiB;IACjB,OAAO;CACR,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAY;IAC7C,UAAU;IACV,YAAY;IACZ,iBAAiB;IACjB,kBA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QACxB,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAC7B,QAAgB,EAChB,YAAwB;IAExB,MAAM,KAAK,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IACxC,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IACzB,OAAO,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACjC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,QAAgB;IACjD,MAAM,KAAK,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IACxC,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IACzB,OAAO,sBAAsB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAChD,CAAC"}
package/dist/server.d.ts CHANGED
@@ -3,14 +3,25 @@
3
3
  *
4
4
  * This module sets up the MCP server with tools and resources.
5
5
  */
6
- import { SudocodeClientConfig } from "./types.js";
6
+ import { SudocodeMCPServerConfig } from "./types.js";
7
7
  export declare class SudocodeMCPServer {
8
8
  private server;
9
9
  private client;
10
+ private apiClient;
10
11
  private config;
12
+ private scopeConfig;
13
+ private usableScopes;
11
14
  private isInitialized;
12
- constructor(config?: SudocodeClientConfig);
15
+ constructor(config?: SudocodeMCPServerConfig);
13
16
  private setupHandlers;
17
+ /**
18
+ * Handle CLI-based tools (default scope).
19
+ */
20
+ private handleCliTool;
21
+ /**
22
+ * Handle API-based tools (extended scopes).
23
+ */
24
+ private handleApiTool;
14
25
  /**
15
26
  * Check for .sudocode directory and required files
16
27
  * Returns initialization status and handles auto-import if needed
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAgBH,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAIlD,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,aAAa,CAAkB;gBAE3B,MAAM,CAAC,EAAE,oBAAoB;IAmBzC,OAAO,CAAC,aAAa;IAggBrB;;;OAGG;YACW,YAAY;IA2E1B;;;OAGG;YACW,mBAAmB;IA8B3B,GAAG;CAQV"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAgBH,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAiBrD,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,SAAS,CAAkC;IACnD,OAAO,CAAC,MAAM,CAA0B;IACxC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,YAAY,CAAa;IACjC,OAAO,CAAC,aAAa,CAAkB;gBAE3B,MAAM,CAAC,EAAE,uBAAuB;IA6C5C,OAAO,CAAC,aAAa;IAgLrB;;OAEG;YACW,aAAa;IA8B3B;;OAEG;YACW,aAAa;IAgE3B;;;OAGG;YACW,YAAY;IA2E1B;;;OAGG;YACW,mBAAmB;IA8B3B,GAAG;CAyCV"}