fa-mcp-sdk 0.2.182 → 0.2.192
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/cli-template/.claude/agents/fa-mcp-sdk.md +158 -0
- package/cli-template/FA-MCP-SDK-DOC/00-FA-MCP-SDK-index.md +216 -0
- package/cli-template/FA-MCP-SDK-DOC/01-getting-started.md +209 -0
- package/cli-template/FA-MCP-SDK-DOC/02-tools-and-api.md +321 -0
- package/cli-template/FA-MCP-SDK-DOC/03-configuration.md +415 -0
- package/cli-template/FA-MCP-SDK-DOC/04-authentication.md +544 -0
- package/cli-template/FA-MCP-SDK-DOC/05-ad-authorization.md +476 -0
- package/cli-template/FA-MCP-SDK-DOC/06-utilities.md +394 -0
- package/cli-template/FA-MCP-SDK-DOC/07-testing-and-operations.md +171 -0
- package/dist/core/_types_/types.d.ts +0 -5
- package/dist/core/_types_/types.d.ts.map +1 -1
- package/dist/core/index.d.ts +2 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/web/home-api.js +1 -1
- package/dist/core/web/home-api.js.map +1 -1
- package/dist/core/web/openapi.d.ts +64 -0
- package/dist/core/web/openapi.d.ts.map +1 -0
- package/dist/core/web/openapi.js +235 -0
- package/dist/core/web/openapi.js.map +1 -0
- package/dist/core/web/server-http.d.ts.map +1 -1
- package/dist/core/web/server-http.js +11 -9
- package/dist/core/web/server-http.js.map +1 -1
- package/dist/core/web/static/home/index.html +4 -2
- package/dist/core/web/static/home/script.js +2 -2
- package/package.json +9 -12
- package/src/template/api/router.ts +66 -4
- package/src/template/start.ts +0 -5
- package/cli-template/FA-MCP-SDK.md +0 -2540
- package/src/template/api/swagger.ts +0 -167
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
# Utilities, Errors, and Logging
|
|
2
|
+
|
|
3
|
+
## Error Handling
|
|
4
|
+
|
|
5
|
+
### Custom Error Classes
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { BaseMcpError, ToolExecutionError, ValidationError } from 'fa-mcp-sdk';
|
|
9
|
+
|
|
10
|
+
// Create custom error types
|
|
11
|
+
class MyCustomError extends BaseMcpError {
|
|
12
|
+
constructor(message: string) {
|
|
13
|
+
super(message, 'CUSTOM_ERROR');
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Use built-in error types
|
|
18
|
+
if (!validInput) {
|
|
19
|
+
throw new ValidationError('Input validation failed');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (toolFailed) {
|
|
23
|
+
throw new ToolExecutionError('my_tool', 'Tool execution failed');
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Error Utilities
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import {
|
|
31
|
+
createJsonRpcErrorResponse,
|
|
32
|
+
toError,
|
|
33
|
+
toStr,
|
|
34
|
+
addErrorMessage
|
|
35
|
+
} from 'fa-mcp-sdk';
|
|
36
|
+
|
|
37
|
+
// createJsonRpcErrorResponse - create JSON-RPC 2.0 error response
|
|
38
|
+
// Function Signature:
|
|
39
|
+
function createJsonRpcErrorResponse (
|
|
40
|
+
error: Error | BaseMcpError,
|
|
41
|
+
requestId?: string | number | null,
|
|
42
|
+
): any {...}
|
|
43
|
+
|
|
44
|
+
// Example:
|
|
45
|
+
try {
|
|
46
|
+
// some operation
|
|
47
|
+
} catch (error) {
|
|
48
|
+
const jsonRpcError = createJsonRpcErrorResponse(error, 'request-123');
|
|
49
|
+
res.json(jsonRpcError);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// toError - safely convert any value to Error object
|
|
53
|
+
// Function Signature:
|
|
54
|
+
const toError = (err: any): Error {...}
|
|
55
|
+
|
|
56
|
+
// Examples:
|
|
57
|
+
const err1 = toError(new Error('Original error')); // Returns original Error
|
|
58
|
+
const err2 = toError('String error message'); // Returns new Error('String error message')
|
|
59
|
+
const err3 = toError({ message: 'Object error' }); // Returns new Error('[object Object]')
|
|
60
|
+
|
|
61
|
+
// toStr - safely convert error to string message
|
|
62
|
+
// Function Signature:
|
|
63
|
+
const toStr = (err: any): string {...}
|
|
64
|
+
|
|
65
|
+
// Examples:
|
|
66
|
+
const msg1 = toStr(new Error('Test error')); // Returns 'Test error'
|
|
67
|
+
const msg2 = toStr('String message'); // Returns 'String message'
|
|
68
|
+
const msg3 = toStr(null); // Returns 'Unknown error'
|
|
69
|
+
|
|
70
|
+
// addErrorMessage - add context to existing error message
|
|
71
|
+
// Function Signature:
|
|
72
|
+
const addErrorMessage = (err: any, msg: string): void {...}
|
|
73
|
+
|
|
74
|
+
// Example:
|
|
75
|
+
const originalError = new Error('Connection failed');
|
|
76
|
+
addErrorMessage(originalError, 'Database operation failed');
|
|
77
|
+
// originalError.message is now: 'Database operation failed. Connection failed'
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Utility Functions
|
|
83
|
+
|
|
84
|
+
### General Utilities
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
import {
|
|
88
|
+
trim,
|
|
89
|
+
isMainModule,
|
|
90
|
+
isNonEmptyObject,
|
|
91
|
+
isObject,
|
|
92
|
+
ppj,
|
|
93
|
+
encodeSvgForDataUri,
|
|
94
|
+
getAsset
|
|
95
|
+
} from 'fa-mcp-sdk';
|
|
96
|
+
|
|
97
|
+
// trim - safely trim string with null/undefined handling
|
|
98
|
+
// Function Signature:
|
|
99
|
+
const trim = (s: any): string {...}
|
|
100
|
+
|
|
101
|
+
// Examples:
|
|
102
|
+
const cleanText1 = trim(' hello '); // Returns 'hello'
|
|
103
|
+
const cleanText2 = trim(null); // Returns ''
|
|
104
|
+
const cleanText3 = trim(undefined); // Returns ''
|
|
105
|
+
const cleanText4 = trim(123); // Returns '123'
|
|
106
|
+
|
|
107
|
+
// isMainModule - check if current module is the main entry point
|
|
108
|
+
// Function Signature:
|
|
109
|
+
const isMainModule = (url: string): boolean {...}
|
|
110
|
+
|
|
111
|
+
// Example:
|
|
112
|
+
if (isMainModule(import.meta.url)) {
|
|
113
|
+
console.log('Running as main module');
|
|
114
|
+
startServer();
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// isObject - check if value is an object (not null, not array)
|
|
118
|
+
// Function Signature:
|
|
119
|
+
const isObject = (o: any): boolean {...}
|
|
120
|
+
|
|
121
|
+
// Examples:
|
|
122
|
+
isObject({}); // Returns true
|
|
123
|
+
isObject({ key: 'value' }); // Returns true
|
|
124
|
+
isObject([]); // Returns false
|
|
125
|
+
isObject(null); // Returns false
|
|
126
|
+
isObject('string'); // Returns false
|
|
127
|
+
|
|
128
|
+
// isNonEmptyObject - check if value is non-empty object with defined values
|
|
129
|
+
// Function Signature:
|
|
130
|
+
const isNonEmptyObject = (o: any): boolean {...}
|
|
131
|
+
|
|
132
|
+
// Examples:
|
|
133
|
+
isNonEmptyObject({ key: 'value' }); // Returns true
|
|
134
|
+
isNonEmptyObject({}); // Returns false
|
|
135
|
+
isNonEmptyObject({ key: undefined }); // Returns false
|
|
136
|
+
isNonEmptyObject([]); // Returns false
|
|
137
|
+
|
|
138
|
+
// ppj - pretty-print JSON with 2-space indentation
|
|
139
|
+
// Function Signature:
|
|
140
|
+
const ppj = (v: any): string {...}
|
|
141
|
+
|
|
142
|
+
// Example:
|
|
143
|
+
const formatted = ppj({ user: 'john', age: 30 });
|
|
144
|
+
// Returns:
|
|
145
|
+
// {
|
|
146
|
+
// "user": "john",
|
|
147
|
+
// "age": 30
|
|
148
|
+
// }
|
|
149
|
+
|
|
150
|
+
// encodeSvgForDataUri - encode SVG content for use in data URI
|
|
151
|
+
// Function Signature:
|
|
152
|
+
const encodeSvgForDataUri = (svg: string): string {...}
|
|
153
|
+
|
|
154
|
+
// Example:
|
|
155
|
+
const svgContent = '<svg xmlns="http://www.w3.org/2000/svg"><circle r="10"/></svg>';
|
|
156
|
+
const encoded = encodeSvgForDataUri(svgContent);
|
|
157
|
+
const dataUri = `data:image/svg+xml,${encoded}`;
|
|
158
|
+
|
|
159
|
+
// getAsset - get asset file content from src/asset folder
|
|
160
|
+
// Function Signature:
|
|
161
|
+
const getAsset = (relPathFromAssetRoot: string): string | undefined {...}
|
|
162
|
+
|
|
163
|
+
// Example:
|
|
164
|
+
const logoContent = getAsset('logo.svg'); // Reads from src/asset/logo.svg
|
|
165
|
+
const iconContent = getAsset('icons/star.svg'); // Reads from src/asset/icons/star.svg
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Network Utilities
|
|
169
|
+
|
|
170
|
+
```typescript
|
|
171
|
+
import { isPortAvailable, checkPortAvailability } from 'fa-mcp-sdk';
|
|
172
|
+
|
|
173
|
+
// isPortAvailable - check if port is available for binding
|
|
174
|
+
// Function Signature:
|
|
175
|
+
function isPortAvailable (port: number, host: string = '0.0.0.0'): Promise<boolean> {...}
|
|
176
|
+
|
|
177
|
+
// Examples:
|
|
178
|
+
const available1 = await isPortAvailable(3000); // Check on all interfaces
|
|
179
|
+
const available2 = await isPortAvailable(3000, 'localhost'); // Check on localhost
|
|
180
|
+
const available3 = await isPortAvailable(8080, '192.168.1.10'); // Check on specific IP
|
|
181
|
+
|
|
182
|
+
if (available1) {
|
|
183
|
+
console.log('Port 3000 is available');
|
|
184
|
+
} else {
|
|
185
|
+
console.log('Port 3000 is occupied');
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// checkPortAvailability - check port with error handling
|
|
189
|
+
// Function Signature:
|
|
190
|
+
async function checkPortAvailability (
|
|
191
|
+
port: number,
|
|
192
|
+
host: string = '0.0.0.0',
|
|
193
|
+
exitOnError: boolean = true
|
|
194
|
+
): Promise<void> {...}
|
|
195
|
+
|
|
196
|
+
// Examples:
|
|
197
|
+
try {
|
|
198
|
+
// Throws error if port is busy
|
|
199
|
+
await checkPortAvailability(3000, 'localhost', true);
|
|
200
|
+
console.log('Port is available, can start server');
|
|
201
|
+
} catch (error) {
|
|
202
|
+
console.log('Port is busy:', error.message);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// Don't exit process on busy port
|
|
206
|
+
try {
|
|
207
|
+
await checkPortAvailability(3000, 'localhost', false);
|
|
208
|
+
console.log('Port is available');
|
|
209
|
+
} catch (error) {
|
|
210
|
+
console.log('Port is occupied, will use different port');
|
|
211
|
+
// Continue execution instead of exiting
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Tool Result Formatting
|
|
216
|
+
|
|
217
|
+
```typescript
|
|
218
|
+
import { formatToolResult, getJsonFromResult } from 'fa-mcp-sdk';
|
|
219
|
+
|
|
220
|
+
// formatToolResult - format tool execution results based on configuration
|
|
221
|
+
// Function Signature:
|
|
222
|
+
function formatToolResult (json: any): any {...}
|
|
223
|
+
|
|
224
|
+
// Behavior depends on appConfig.mcp.toolAnswerAs setting:
|
|
225
|
+
// - 'structuredContent': Returns { structuredContent: json }
|
|
226
|
+
// - 'text': Returns { content: [{ type: 'text', text: JSON.stringify(json, null, 2) }] }
|
|
227
|
+
|
|
228
|
+
// Examples:
|
|
229
|
+
const result = {
|
|
230
|
+
message: 'Operation completed',
|
|
231
|
+
data: { count: 42, items: ['a', 'b'] },
|
|
232
|
+
timestamp: new Date().toISOString(),
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
const formattedResult = formatToolResult(result);
|
|
236
|
+
|
|
237
|
+
// If toolAnswerAs = 'structuredContent':
|
|
238
|
+
// {
|
|
239
|
+
// structuredContent: {
|
|
240
|
+
// message: 'Operation completed',
|
|
241
|
+
// data: { count: 42, items: ['a', 'b'] },
|
|
242
|
+
// timestamp: '2025-01-01T12:00:00.000Z'
|
|
243
|
+
// }
|
|
244
|
+
// }
|
|
245
|
+
|
|
246
|
+
// If toolAnswerAs = 'text':
|
|
247
|
+
// {
|
|
248
|
+
// content: [{
|
|
249
|
+
// type: 'text',
|
|
250
|
+
// text: '{\n "message": "Operation completed",\n "data": {\n "count": 42,\n "items": ["a", "b"]\n },\n "timestamp": "2025-01-01T12:00:00.000Z"\n}'
|
|
251
|
+
// }]
|
|
252
|
+
// }
|
|
253
|
+
|
|
254
|
+
// getJsonFromResult - extract original JSON from formatted result
|
|
255
|
+
// Function Signature:
|
|
256
|
+
const getJsonFromResult = <T = any> (result: any): T {...}
|
|
257
|
+
|
|
258
|
+
// Examples:
|
|
259
|
+
const originalData1 = getJsonFromResult<MyDataType>(formattedResult);
|
|
260
|
+
|
|
261
|
+
// Works with both response formats:
|
|
262
|
+
const structuredResponse = { structuredContent: { user: 'john', age: 30 } };
|
|
263
|
+
const textResponse = {
|
|
264
|
+
content: [{ type: 'text', text: '{"user":"john","age":30}' }]
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
const data1 = getJsonFromResult(structuredResponse); // { user: 'john', age: 30 }
|
|
268
|
+
const data2 = getJsonFromResult(textResponse); // { user: 'john', age: 30 }
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## Logging
|
|
274
|
+
|
|
275
|
+
```typescript
|
|
276
|
+
import { logger, fileLogger } from 'fa-mcp-sdk';
|
|
277
|
+
|
|
278
|
+
// Console logging
|
|
279
|
+
logger.info('Server started successfully');
|
|
280
|
+
logger.warn('Warning message');
|
|
281
|
+
logger.error('Error occurred', error);
|
|
282
|
+
|
|
283
|
+
// File logging (if configured)
|
|
284
|
+
fileLogger.info('This goes to file');
|
|
285
|
+
|
|
286
|
+
// Ensure file logs are written before shutdown
|
|
287
|
+
await fileLogger.asyncFinish();
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## Event System
|
|
293
|
+
|
|
294
|
+
```typescript
|
|
295
|
+
import { eventEmitter } from 'fa-mcp-sdk';
|
|
296
|
+
|
|
297
|
+
// Listen for events
|
|
298
|
+
eventEmitter.on('server:started', (data) => {
|
|
299
|
+
console.log('Server started with config:', data);
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
// Emit custom events
|
|
303
|
+
eventEmitter.emit('custom:event', { data: 'example' });
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
## Consul Integration
|
|
309
|
+
|
|
310
|
+
If using Consul for service discovery:
|
|
311
|
+
|
|
312
|
+
```typescript
|
|
313
|
+
import {
|
|
314
|
+
getConsulAPI,
|
|
315
|
+
accessPointUpdater,
|
|
316
|
+
deregisterServiceFromConsul
|
|
317
|
+
} from 'fa-mcp-sdk';
|
|
318
|
+
|
|
319
|
+
// getConsulAPI - get configured Consul client instance
|
|
320
|
+
// Function Signature:
|
|
321
|
+
const getConsulAPI = async (): Promise<any> {...}
|
|
322
|
+
|
|
323
|
+
// Returns Consul API client configured from appConfig.consul settings
|
|
324
|
+
// Example:
|
|
325
|
+
const consulApi = await getConsulAPI();
|
|
326
|
+
const services = await consulApi.catalog.service.list();
|
|
327
|
+
console.log('Available services:', services);
|
|
328
|
+
|
|
329
|
+
// deregisterServiceFromConsul - remove service registration from Consul
|
|
330
|
+
// Function Signature:
|
|
331
|
+
const deregisterServiceFromConsul = async (): Promise<void> {...}
|
|
332
|
+
|
|
333
|
+
// Note: This function reads serviceId from command line arguments (process.argv)
|
|
334
|
+
// Usage in command line context:
|
|
335
|
+
// node script.js <serviceId> [agentHost] [agentPort]
|
|
336
|
+
|
|
337
|
+
// Example programmatic usage:
|
|
338
|
+
await deregisterServiceFromConsul();
|
|
339
|
+
|
|
340
|
+
// accessPointUpdater - manage access point lifecycle
|
|
341
|
+
// Object with start/stop methods:
|
|
342
|
+
const accessPointUpdater = {
|
|
343
|
+
start(): void; // Start automatic access point updates
|
|
344
|
+
stop(): void; // Stop automatic access point updates
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// Examples:
|
|
348
|
+
accessPointUpdater.start(); // Automatically starts if appConfig.accessPoints configured
|
|
349
|
+
accessPointUpdater.stop(); // Stop updates (called automatically on shutdown)
|
|
350
|
+
|
|
351
|
+
// Access point configuration in config/default.yaml:
|
|
352
|
+
// accessPoints:
|
|
353
|
+
// myService:
|
|
354
|
+
// title: 'My remote service'
|
|
355
|
+
// host: <host>
|
|
356
|
+
// port: 9999
|
|
357
|
+
// token: '***'
|
|
358
|
+
// noConsul: true
|
|
359
|
+
// consulServiceName: <consulServiceName>
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
---
|
|
363
|
+
|
|
364
|
+
## Graceful Shutdown
|
|
365
|
+
|
|
366
|
+
```typescript
|
|
367
|
+
import { gracefulShutdown } from 'fa-mcp-sdk';
|
|
368
|
+
|
|
369
|
+
// gracefulShutdown - perform graceful application shutdown
|
|
370
|
+
// Function Signature:
|
|
371
|
+
async function gracefulShutdown (signal: string, exitCode: number = 0): Promise<void> {...}
|
|
372
|
+
|
|
373
|
+
// Automatically handles:
|
|
374
|
+
// - Stopping Consul service registration
|
|
375
|
+
// - Closing database connections
|
|
376
|
+
// - Flushing file logs
|
|
377
|
+
// - Stopping access point updater
|
|
378
|
+
// - Process exit with specified code
|
|
379
|
+
|
|
380
|
+
// Examples:
|
|
381
|
+
// Manual shutdown
|
|
382
|
+
process.on('SIGUSR2', () => {
|
|
383
|
+
gracefulShutdown('SIGUSR2', 0);
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
// Emergency shutdown
|
|
387
|
+
process.on('uncaughtException', (error) => {
|
|
388
|
+
console.error('Uncaught exception:', error);
|
|
389
|
+
gracefulShutdown('UNCAUGHT_EXCEPTION', 1);
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
// Note: SDK automatically registers SIGINT and SIGTERM handlers
|
|
393
|
+
// in initMcpServer(), so manual registration is only needed for custom signals
|
|
394
|
+
```
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# Testing, Transports, and Best Practices
|
|
2
|
+
|
|
3
|
+
## Testing Your MCP Server
|
|
4
|
+
|
|
5
|
+
### Test Structure
|
|
6
|
+
|
|
7
|
+
Create tests in your `tests/` directory:
|
|
8
|
+
|
|
9
|
+
**`tests/utils.ts`** - Test utilities:
|
|
10
|
+
```typescript
|
|
11
|
+
import { ITestResult, logResultToFile, formatResultAsMarkdown } from 'fa-mcp-sdk';
|
|
12
|
+
|
|
13
|
+
export interface ITestResult {
|
|
14
|
+
fullId: string;
|
|
15
|
+
toolName: string;
|
|
16
|
+
description: string;
|
|
17
|
+
parameters: unknown | null;
|
|
18
|
+
timestamp: string;
|
|
19
|
+
duration: number;
|
|
20
|
+
status: 'pending' | 'passed' | 'failed' | 'skipped' | 'expected_failure';
|
|
21
|
+
response: unknown | null;
|
|
22
|
+
error: string | null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Log test results
|
|
26
|
+
await logResultToFile(testResult);
|
|
27
|
+
|
|
28
|
+
// Format as markdown
|
|
29
|
+
const markdown = formatResultAsMarkdown(testResult);
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Test Clients
|
|
33
|
+
|
|
34
|
+
Use the provided test clients to test your MCP server:
|
|
35
|
+
|
|
36
|
+
**STDIO Transport Testing:**
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
// noinspection JSAnnotator
|
|
40
|
+
|
|
41
|
+
import { McpStdioClient } from 'fa-mcp-sdk';
|
|
42
|
+
import { spawn } from 'child_process';
|
|
43
|
+
|
|
44
|
+
const proc = spawn('node', ['dist/start.js', 'stdio'], {
|
|
45
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
46
|
+
env: { ...process.env, NODE_ENV: 'test' },
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const client = new McpStdioClient(proc);
|
|
50
|
+
|
|
51
|
+
// Test tools
|
|
52
|
+
const result = await client.callTool('my_custom_tool', { query: 'test' });
|
|
53
|
+
console.log(result);
|
|
54
|
+
|
|
55
|
+
// Test prompts
|
|
56
|
+
const prompt = await client.getPrompt('agent_brief');
|
|
57
|
+
console.log(prompt);
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**HTTP Transport Testing:**
|
|
61
|
+
```typescript
|
|
62
|
+
import { McpHttpClient } from 'fa-mcp-sdk';
|
|
63
|
+
|
|
64
|
+
const client = new McpHttpClient('http://localhost:3000');
|
|
65
|
+
|
|
66
|
+
// Test with authentication headers
|
|
67
|
+
const result = await client.callTool('my_custom_tool', { query: 'test' }, {
|
|
68
|
+
'Authorization': 'Bearer your-jwt-token'
|
|
69
|
+
});
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**SSE Transport Testing:**
|
|
73
|
+
```typescript
|
|
74
|
+
import { McpSseClient } from 'fa-mcp-sdk';
|
|
75
|
+
|
|
76
|
+
const client = new McpSseClient('http://localhost:3000');
|
|
77
|
+
const result = await client.callTool('my_custom_tool', { query: 'test' });
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Test Categories and Recommendations
|
|
81
|
+
|
|
82
|
+
1. **Prompt Tests**:
|
|
83
|
+
- Test that prompts are listed correctly
|
|
84
|
+
- Test prompt content retrieval
|
|
85
|
+
- Test dynamic prompt generation
|
|
86
|
+
|
|
87
|
+
2. **Resource Tests**:
|
|
88
|
+
- Test resource listing
|
|
89
|
+
- Test resource content reading
|
|
90
|
+
- Test dynamic resource generation
|
|
91
|
+
|
|
92
|
+
3. **Tool Tests**:
|
|
93
|
+
- Test tool listing
|
|
94
|
+
- Test tool execution with valid parameters
|
|
95
|
+
- Test error handling for invalid parameters
|
|
96
|
+
- Test tool response formatting
|
|
97
|
+
|
|
98
|
+
4. **Transport Tests**:
|
|
99
|
+
- Test all transport types your server supports
|
|
100
|
+
- Test authentication (if enabled)
|
|
101
|
+
- Test error responses
|
|
102
|
+
|
|
103
|
+
Example test implementation:
|
|
104
|
+
```typescript
|
|
105
|
+
// tests/mcp/test-tools.js
|
|
106
|
+
async function testMyCustomTool(client) {
|
|
107
|
+
const name = 'Test my_custom_tool execution';
|
|
108
|
+
try {
|
|
109
|
+
const result = await client.callTool('my_custom_tool', { query: 'test input' });
|
|
110
|
+
const success = result?.response?.includes('Processed');
|
|
111
|
+
return success ?
|
|
112
|
+
{ name, passed: true, details: result } :
|
|
113
|
+
{ name, passed: false, details: result };
|
|
114
|
+
} catch (error) {
|
|
115
|
+
return { name, passed: false, details: { error: error.message } };
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Transport Types
|
|
123
|
+
|
|
124
|
+
### STDIO Transport
|
|
125
|
+
- Use for CLI tools and local development
|
|
126
|
+
- Configure with `mcp.transportType: "stdio"`
|
|
127
|
+
- Lightweight, no HTTP overhead
|
|
128
|
+
|
|
129
|
+
### HTTP Transport
|
|
130
|
+
- Use for web-based integrations
|
|
131
|
+
- Configure with `mcp.transportType: "http"`
|
|
132
|
+
- Supports REST API, authentication, Swagger docs
|
|
133
|
+
- Requires `webServer` configuration
|
|
134
|
+
|
|
135
|
+
### Server-Sent Events (SSE)
|
|
136
|
+
- Real-time streaming over HTTP
|
|
137
|
+
- Good for long-running operations
|
|
138
|
+
- Maintains persistent connections
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Best Practices
|
|
143
|
+
|
|
144
|
+
### Project Organization
|
|
145
|
+
1. **Keep tools focused** - One responsibility per tool
|
|
146
|
+
2. **Use TypeScript** - Leverage type safety throughout
|
|
147
|
+
3. **Organize by feature** - Group related functionality
|
|
148
|
+
4. **Configure environments** - Use separate configs for dev/prod
|
|
149
|
+
|
|
150
|
+
### Tool Development
|
|
151
|
+
1. **Validate inputs** - Always check required parameters
|
|
152
|
+
2. **Use formatToolResult()** - Consistent response formatting
|
|
153
|
+
3. **Handle errors gracefully** - Use appropriate error classes
|
|
154
|
+
4. **Log operations** - Use the provided logger
|
|
155
|
+
|
|
156
|
+
### Testing
|
|
157
|
+
1. **Test all transports** - Ensure compatibility
|
|
158
|
+
2. **Include error cases** - Test failure scenarios
|
|
159
|
+
3. **Use provided clients** - Leverage built-in test utilities
|
|
160
|
+
4. **Document test cases** - Clear, descriptive test names
|
|
161
|
+
|
|
162
|
+
### Security
|
|
163
|
+
1. **Environment variables** - Never hardcode secrets
|
|
164
|
+
2. **Authentication** - Enable for production HTTP servers
|
|
165
|
+
3. **Input validation** - Validate all user inputs
|
|
166
|
+
4. **Error messages** - Don't leak sensitive information
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
This documentation provides everything needed to build, test, and deploy your own
|
|
171
|
+
MCP server using the FA-MCP-SDK framework.
|
|
@@ -70,10 +70,6 @@ export interface IResource {
|
|
|
70
70
|
];
|
|
71
71
|
}
|
|
72
72
|
export type IEndpointsOn404 = Record<string, string | string[]>;
|
|
73
|
-
export interface ISwaggerData {
|
|
74
|
-
swaggerSpecs: any;
|
|
75
|
-
swaggerUi: any;
|
|
76
|
-
}
|
|
77
73
|
/**
|
|
78
74
|
* Custom Authentication validation function
|
|
79
75
|
* @param req - Express request object containing all authentication information
|
|
@@ -104,7 +100,6 @@ export interface McpServerData {
|
|
|
104
100
|
httpComponents?: {
|
|
105
101
|
apiRouter?: Router | null;
|
|
106
102
|
endpointsOn404?: IEndpointsOn404;
|
|
107
|
-
swagger?: ISwaggerData | null;
|
|
108
103
|
};
|
|
109
104
|
assets?: {
|
|
110
105
|
logoSvg?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/_types_/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0DAA0D;IAC1D,OAAO,CAAC,EAAE,MAAM,CAA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OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;KAClB,CAAC;CACH;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,QAAQ,CAAC;IACf,UAAU,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAEhC,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB"}
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type { AppConfig } from './_types_/config.js';
|
|
2
2
|
export type { IADConfig, IDcConfig } from './_types_/active-directory-config.js';
|
|
3
|
-
export type { McpServerData, IGetPromptParams, IGetPromptRequest, IPromptContent, IPromptData, TPromptContentFunction, IResource, TResourceContentFunction, IResourceContent, IReadResourceRequest, IResourceInfo, IResourceData, IEndpointsOn404,
|
|
3
|
+
export type { McpServerData, IGetPromptParams, IGetPromptRequest, IPromptContent, IPromptData, TPromptContentFunction, IResource, TResourceContentFunction, IResourceContent, IReadResourceRequest, IResourceInfo, IResourceData, IEndpointsOn404, IRequiredHttpHeader, IToolProperties, IToolInputSchema, CustomAuthValidator, TokenGenAuthHandler, TokenGenAuthInput, } from './_types_/types.js';
|
|
4
4
|
export { appConfig } from './bootstrap/init-config.js';
|
|
5
5
|
export { accessPointUpdater } from './consul/access-points-updater.js';
|
|
6
6
|
export { deregisterServiceFromConsul } from './consul/deregister.js';
|
|
@@ -29,4 +29,5 @@ export { McpSseClient } from './utils/testing/McpSseClient.js';
|
|
|
29
29
|
export { McpStdioClient } from './utils/testing/McpStdioClient.js';
|
|
30
30
|
export { McpStreamableHttpClient } from './utils/testing/McpStreamableHttpClient.js';
|
|
31
31
|
export { initADGroupChecker } from './ad/group-checker.js';
|
|
32
|
+
export { configureOpenAPI, createSwaggerUIAssetsMiddleware, type OpenAPISpecResponse, type SwaggerUIConfig, } from './web/openapi.js';
|
|
32
33
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACjF,YAAY,EACV,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,WAAW,EACX,sBAAsB,EAEtB,SAAS,EACT,wBAAwB,EACxB,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,aAAa,EAEb,eAAe,EACf,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACjF,YAAY,EACV,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,WAAW,EACX,sBAAsB,EAEtB,SAAS,EACT,wBAAwB,EACxB,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,aAAa,EAEb,eAAe,EACf,mBAAmB,EAEnB,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EACL,QAAQ,EACR,WAAW,EACX,SAAS,E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AE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AAErF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAG3D,OAAO,EACL,gBAAgB,EAChB,+BAA+B,EAC/B,KAAK,mBAAmB,EACxB,KAAK,eAAe,GACrB,MAAM,kBAAkB,CAAC"}
|
package/dist/core/index.js
CHANGED
|
@@ -28,4 +28,6 @@ export { McpSseClient } from './utils/testing/McpSseClient.js';
|
|
|
28
28
|
export { McpStdioClient } from './utils/testing/McpStdioClient.js';
|
|
29
29
|
export { McpStreamableHttpClient } from './utils/testing/McpStreamableHttpClient.js';
|
|
30
30
|
export { initADGroupChecker } from './ad/group-checker.js';
|
|
31
|
+
// OpenAPI/Swagger utilities
|
|
32
|
+
export { configureOpenAPI, createSwaggerUIAssetsMiddleware, } from './web/openapi.js';
|
|
31
33
|
//# sourceMappingURL=index.js.map
|
package/dist/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AA2BA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAC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