fa-mcp-sdk 0.2.249 → 0.2.258
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/FA-MCP-SDK-DOC/00-FA-MCP-SDK-index.md +45 -161
- package/cli-template/FA-MCP-SDK-DOC/01-getting-started.md +71 -226
- package/cli-template/FA-MCP-SDK-DOC/02-1-tools-and-api.md +80 -360
- package/cli-template/FA-MCP-SDK-DOC/02-2-prompts-and-resources.md +191 -342
- package/cli-template/FA-MCP-SDK-DOC/03-configuration.md +141 -279
- package/cli-template/FA-MCP-SDK-DOC/04-authentication.md +73 -522
- package/cli-template/FA-MCP-SDK-DOC/05-ad-authorization.md +68 -419
- package/cli-template/FA-MCP-SDK-DOC/06-utilities.md +64 -447
- package/cli-template/FA-MCP-SDK-DOC/07-testing-and-operations.md +39 -196
- package/cli-template/package.json +2 -1
- package/config/local.yaml +1 -1
- package/dist/core/_types_/types.d.ts +36 -10
- package/dist/core/_types_/types.d.ts.map +1 -1
- package/dist/core/auth/admin-auth.js +1 -1
- package/dist/core/auth/admin-auth.js.map +1 -1
- package/dist/core/auth/middleware.js +8 -8
- package/dist/core/auth/middleware.js.map +1 -1
- package/dist/core/auth/multi-auth.d.ts.map +1 -1
- package/dist/core/auth/multi-auth.js +15 -14
- package/dist/core/auth/multi-auth.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/mcp/create-mcp-server.js +8 -9
- package/dist/core/mcp/create-mcp-server.js.map +1 -1
- package/dist/core/mcp/prompts.d.ts +10 -5
- package/dist/core/mcp/prompts.d.ts.map +1 -1
- package/dist/core/mcp/prompts.js +17 -15
- package/dist/core/mcp/prompts.js.map +1 -1
- package/dist/core/mcp/resources.d.ts +4 -4
- package/dist/core/mcp/resources.d.ts.map +1 -1
- package/dist/core/mcp/resources.js +21 -20
- package/dist/core/mcp/resources.js.map +1 -1
- package/dist/core/utils/utils.d.ts +2 -1
- package/dist/core/utils/utils.d.ts.map +1 -1
- package/dist/core/utils/utils.js +2 -2
- package/dist/core/utils/utils.js.map +1 -1
- package/dist/core/web/home-api.d.ts.map +1 -1
- package/dist/core/web/home-api.js +4 -3
- package/dist/core/web/home-api.js.map +1 -1
- package/dist/core/web/server-http.d.ts.map +1 -1
- package/dist/core/web/server-http.js +36 -21
- package/dist/core/web/server-http.js.map +1 -1
- package/package.json +1 -1
- package/scripts/update-doc.js +21 -0
- package/src/template/start.ts +1 -1
|
@@ -1,256 +1,99 @@
|
|
|
1
|
-
# Testing
|
|
1
|
+
# Testing and Operations
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Test Clients
|
|
4
4
|
|
|
5
|
-
###
|
|
6
|
-
|
|
7
|
-
Create tests in your `tests/` directory:
|
|
8
|
-
|
|
9
|
-
**`tests/utils.ts`** - Test utilities:
|
|
10
|
-
```typescript
|
|
11
|
-
// Test result interface for tracking test outcomes
|
|
12
|
-
export interface ITestResult {
|
|
13
|
-
fullId: string;
|
|
14
|
-
toolName: string;
|
|
15
|
-
description: string;
|
|
16
|
-
parameters: unknown | null;
|
|
17
|
-
timestamp: string;
|
|
18
|
-
duration: number;
|
|
19
|
-
status: 'pending' | 'passed' | 'failed' | 'skipped' | 'expected_failure';
|
|
20
|
-
response: unknown | null;
|
|
21
|
-
error: string | null;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// Example utility functions for your test suite
|
|
25
|
-
export const formatResultAsMarkdown = (result: ITestResult): string => {
|
|
26
|
-
const statusIcon = result.status === 'passed' ? '✅' : '❌';
|
|
27
|
-
return `${statusIcon} ${result.toolName} - ${result.description}\n` +
|
|
28
|
-
`Duration: ${result.duration}ms\n` +
|
|
29
|
-
(result.error ? `Error: ${result.error}\n` : '');
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export const logResultToFile = async (result: ITestResult): Promise<void> => {
|
|
33
|
-
const fs = await import('fs/promises');
|
|
34
|
-
const path = await import('path');
|
|
35
|
-
const filename = `${result.toolName}.md`;
|
|
36
|
-
const filepath = path.join(process.cwd(), '_logs/mcp', filename);
|
|
37
|
-
await fs.writeFile(filepath, formatResultAsMarkdown(result), 'utf-8');
|
|
38
|
-
};
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### Test Clients
|
|
42
|
-
|
|
43
|
-
Use the provided test clients to test your MCP server:
|
|
44
|
-
|
|
45
|
-
**STDIO Transport Testing:**
|
|
5
|
+
### STDIO Transport
|
|
46
6
|
|
|
47
7
|
```typescript
|
|
48
|
-
// noinspection JSAnnotator
|
|
49
|
-
|
|
50
8
|
import { McpStdioClient } from 'fa-mcp-sdk';
|
|
51
9
|
import { spawn } from 'child_process';
|
|
52
10
|
|
|
53
11
|
const proc = spawn('node', ['dist/start.js', 'stdio'], {
|
|
54
|
-
|
|
55
|
-
|
|
12
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
13
|
+
env: { ...process.env, NODE_ENV: 'test' },
|
|
56
14
|
});
|
|
57
15
|
|
|
58
16
|
const client = new McpStdioClient(proc);
|
|
59
|
-
|
|
60
|
-
// Test tools
|
|
61
|
-
const result = await client.callTool('my_custom_tool', { query: 'test' });
|
|
62
|
-
console.log(result);
|
|
63
|
-
|
|
64
|
-
// Test prompts
|
|
17
|
+
const result = await client.callTool('my_tool', { query: 'test' });
|
|
65
18
|
const prompt = await client.getPrompt('agent_brief');
|
|
66
|
-
console.log(prompt);
|
|
67
19
|
```
|
|
68
20
|
|
|
69
|
-
|
|
21
|
+
### HTTP Transport
|
|
22
|
+
|
|
70
23
|
```typescript
|
|
71
24
|
import { McpHttpClient } from 'fa-mcp-sdk';
|
|
72
25
|
|
|
73
26
|
const client = new McpHttpClient('http://localhost:3000');
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const result = await client.callTool('my_custom_tool', { query: 'test' }, {
|
|
77
|
-
'Authorization': 'Bearer your-jwt-token'
|
|
27
|
+
const result = await client.callTool('my_tool', { query: 'test' }, {
|
|
28
|
+
'Authorization': 'Bearer token'
|
|
78
29
|
});
|
|
79
30
|
```
|
|
80
31
|
|
|
81
|
-
|
|
32
|
+
### SSE Transport
|
|
33
|
+
|
|
82
34
|
```typescript
|
|
83
35
|
import { McpSseClient } from 'fa-mcp-sdk';
|
|
84
36
|
|
|
85
37
|
const client = new McpSseClient('http://localhost:3000');
|
|
86
|
-
const result = await client.callTool('
|
|
38
|
+
const result = await client.callTool('my_tool', { query: 'test' });
|
|
87
39
|
```
|
|
88
40
|
|
|
89
|
-
|
|
41
|
+
### Streamable HTTP (MCP 2025)
|
|
90
42
|
|
|
91
43
|
```typescript
|
|
92
44
|
import { McpStreamableHttpClient } from 'fa-mcp-sdk';
|
|
93
45
|
|
|
94
|
-
// McpStreamableHttpClient - Test client for MCP Streamable HTTP transport
|
|
95
|
-
// Implements the new MCP 2025 streamable HTTP specification with NDJSON
|
|
96
|
-
// Supports long-lived connections, multiple requests/responses, and notifications
|
|
97
|
-
|
|
98
|
-
// Constructor:
|
|
99
|
-
const client = new McpStreamableHttpClient(baseUrl: string, options?: {
|
|
100
|
-
endpointPath?: string; // Default: '/mcp'
|
|
101
|
-
headers?: Record<string, string>;
|
|
102
|
-
requestTimeoutMs?: number; // Default: 120000 (2 minutes)
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
// Example usage:
|
|
106
46
|
const client = new McpStreamableHttpClient('http://localhost:3000', {
|
|
107
|
-
headers: { 'Authorization': 'Bearer
|
|
47
|
+
headers: { 'Authorization': 'Bearer token' },
|
|
108
48
|
requestTimeoutMs: 60000,
|
|
109
49
|
});
|
|
110
50
|
|
|
111
|
-
// Initialize connection (required before other operations)
|
|
112
51
|
await client.initialize({
|
|
113
52
|
protocolVersion: '2024-11-05',
|
|
114
53
|
clientInfo: { name: 'test-client', version: '1.0.0' },
|
|
115
54
|
});
|
|
116
55
|
|
|
117
|
-
|
|
118
|
-
console.log('Capabilities:', client.capabilities);
|
|
119
|
-
|
|
120
|
-
// Call tools
|
|
121
|
-
const toolResult = await client.callTool('my_custom_tool', { query: 'test' });
|
|
122
|
-
console.log('Tool result:', toolResult);
|
|
123
|
-
|
|
124
|
-
// Get prompts
|
|
56
|
+
const result = await client.callTool('my_tool', { query: 'test' });
|
|
125
57
|
const prompt = await client.getPrompt('agent_brief');
|
|
126
|
-
|
|
127
|
-
// List and read resources
|
|
128
58
|
const resources = await client.listResources();
|
|
129
|
-
const content = await client.readResource('custom
|
|
130
|
-
|
|
131
|
-
// Subscribe to notifications
|
|
132
|
-
const unsubscribe = client.onNotification('notifications/tools/list_changed', (params) => {
|
|
133
|
-
console.log('Tools changed:', params);
|
|
134
|
-
});
|
|
59
|
+
const content = await client.readResource('custom://data');
|
|
135
60
|
|
|
136
|
-
//
|
|
137
|
-
const
|
|
61
|
+
// Notifications
|
|
62
|
+
const unsub = client.onNotification('notifications/tools/list_changed', (p) => console.log(p));
|
|
138
63
|
|
|
139
|
-
// Close connection when done
|
|
140
64
|
await client.close();
|
|
141
65
|
```
|
|
142
66
|
|
|
143
|
-
**
|
|
144
|
-
- **NDJSON Streaming**: Newline-delimited JSON over HTTP for efficient communication
|
|
145
|
-
- **Bidirectional**: Supports both requests and server notifications
|
|
146
|
-
- **Persistent Connection**: Single HTTP connection for multiple operations
|
|
147
|
-
- **Timeout Handling**: Configurable request timeouts with automatic cleanup
|
|
148
|
-
|
|
149
|
-
**Available Methods:**
|
|
150
|
-
|
|
151
|
-
| Method | Description |
|
|
152
|
-
|-------------------------------------|-----------------------------------|
|
|
153
|
-
| `initialize(params)` | Initialize MCP session |
|
|
154
|
-
| `close()` | Close connection gracefully |
|
|
155
|
-
| `callTool(name, args, headers?)` | Execute an MCP tool |
|
|
156
|
-
| `getPrompt(name, args?)` | Retrieve a prompt |
|
|
157
|
-
| `listResources()` | List available resources |
|
|
158
|
-
| `readResource(uri)` | Read resource content |
|
|
159
|
-
| `listTools()` | List available tools |
|
|
160
|
-
| `listPrompts()` | List available prompts |
|
|
161
|
-
| `sendRpc(method, params, timeout?)` | Send custom JSON-RPC request |
|
|
162
|
-
| `notify(method, params?)` | Send notification (no response) |
|
|
163
|
-
| `onNotification(method, handler)` | Subscribe to server notifications |
|
|
164
|
-
|
|
165
|
-
### Test Categories and Recommendations
|
|
166
|
-
|
|
167
|
-
1. **Prompt Tests**:
|
|
168
|
-
- Test that prompts are listed correctly
|
|
169
|
-
- Test prompt content retrieval
|
|
170
|
-
- Test dynamic prompt generation
|
|
171
|
-
|
|
172
|
-
2. **Resource Tests**:
|
|
173
|
-
- Test resource listing
|
|
174
|
-
- Test resource content reading
|
|
175
|
-
- Test dynamic resource generation
|
|
176
|
-
|
|
177
|
-
3. **Tool Tests**:
|
|
178
|
-
- Test tool listing
|
|
179
|
-
- Test tool execution with valid parameters
|
|
180
|
-
- Test error handling for invalid parameters
|
|
181
|
-
- Test tool response formatting
|
|
182
|
-
|
|
183
|
-
4. **Transport Tests**:
|
|
184
|
-
- Test all transport types your server supports
|
|
185
|
-
- Test authentication (if enabled)
|
|
186
|
-
- Test error responses
|
|
187
|
-
|
|
188
|
-
Example test implementation:
|
|
189
|
-
```typescript
|
|
190
|
-
// tests/mcp/test-tools.js
|
|
191
|
-
async function testMyCustomTool(client) {
|
|
192
|
-
const name = 'Test my_custom_tool execution';
|
|
193
|
-
try {
|
|
194
|
-
const result = await client.callTool('my_custom_tool', { query: 'test input' });
|
|
195
|
-
const success = result?.response?.includes('Processed');
|
|
196
|
-
return success ?
|
|
197
|
-
{ name, passed: true, details: result } :
|
|
198
|
-
{ name, passed: false, details: result };
|
|
199
|
-
} catch (error) {
|
|
200
|
-
return { name, passed: false, details: { error: error.message } };
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
---
|
|
67
|
+
**Methods:** `initialize`, `close`, `callTool`, `getPrompt`, `listResources`, `readResource`, `listTools`, `listPrompts`, `sendRpc`, `notify`, `onNotification`
|
|
206
68
|
|
|
207
69
|
## Transport Types
|
|
208
70
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
### HTTP Transport
|
|
215
|
-
- Use for web-based integrations
|
|
216
|
-
- Configure with `mcp.transportType: "http"`
|
|
217
|
-
- Supports REST API, authentication, Swagger docs
|
|
218
|
-
- Requires `webServer` configuration
|
|
219
|
-
|
|
220
|
-
### Server-Sent Events (SSE)
|
|
221
|
-
- Real-time streaming over HTTP
|
|
222
|
-
- Good for long-running operations
|
|
223
|
-
- Maintains persistent connections
|
|
224
|
-
|
|
225
|
-
---
|
|
71
|
+
| Transport | Config | Use Case |
|
|
72
|
+
|-----------|--------|----------|
|
|
73
|
+
| STDIO | `mcp.transportType: "stdio"` | CLI, local dev |
|
|
74
|
+
| HTTP | `mcp.transportType: "http"` | Web integrations, REST API |
|
|
75
|
+
| SSE | HTTP transport | Long-running ops, streaming |
|
|
226
76
|
|
|
227
77
|
## Best Practices
|
|
228
78
|
|
|
229
79
|
### Project Organization
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
4. **Configure environments** - Use separate configs for dev/prod
|
|
80
|
+
- One responsibility per tool
|
|
81
|
+
- Use TypeScript throughout
|
|
82
|
+
- Separate configs for dev/prod
|
|
234
83
|
|
|
235
84
|
### Tool Development
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
85
|
+
- Validate all inputs
|
|
86
|
+
- Use `formatToolResult()` for responses
|
|
87
|
+
- Use error classes for failures
|
|
88
|
+
- Log operations with `logger`
|
|
240
89
|
|
|
241
90
|
### Testing
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
4. **Document test cases** - Clear, descriptive test names
|
|
91
|
+
- Test all transport types
|
|
92
|
+
- Include error cases
|
|
93
|
+
- Use provided test clients
|
|
246
94
|
|
|
247
95
|
### Security
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
---
|
|
254
|
-
|
|
255
|
-
This documentation provides everything needed to build, test, and deploy your own
|
|
256
|
-
MCP server using the FA-MCP-SDK framework.
|
|
96
|
+
- Environment variables for secrets
|
|
97
|
+
- Enable auth for production
|
|
98
|
+
- Validate all user inputs
|
|
99
|
+
- Don't leak sensitive info in errors
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"generate-token": "node node_modules/fa-mcp-sdk/dist/core/auth/token-generator/server.js",
|
|
22
22
|
"dead:exports": "ts-prune",
|
|
23
23
|
"dead:files": "knip",
|
|
24
|
+
"update-sdk-docs": "node ../scripts/update-doc.js",
|
|
24
25
|
"postinstall": "node ../scripts/npm/patch_node_modules.js",
|
|
25
26
|
"consul:unreg": "node node_modules/fa-mcp-sdk/dist/core/consul/deregister.js",
|
|
26
27
|
"test": "jest",
|
|
@@ -47,7 +48,7 @@
|
|
|
47
48
|
"dependencies": {
|
|
48
49
|
"@modelcontextprotocol/sdk": "^1.25.2",
|
|
49
50
|
"dotenv": "^17.2.3",
|
|
50
|
-
"fa-mcp-sdk": "^0.2.
|
|
51
|
+
"fa-mcp-sdk": "^0.2.258"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
54
|
"@types/express": "^5.0.6",
|
package/config/local.yaml
CHANGED
|
@@ -82,7 +82,7 @@ webServer:
|
|
|
82
82
|
# Supports 4 authentication methods: permanentServerTokens, basic, jwtToken, ntlm
|
|
83
83
|
# ========================================================================
|
|
84
84
|
adminAuth:
|
|
85
|
-
enabled:
|
|
85
|
+
enabled: false
|
|
86
86
|
# Authentication type for admin panel: 'permanentServerTokens' | 'basic' | 'jwtToken' | 'ntlm'
|
|
87
87
|
# For permanentServerTokens, basic, jwtToken - uses credentials from webServer.auth section
|
|
88
88
|
# For ntlm - uses AD configuration from ad.domains section (no additional credentials needed)
|
|
@@ -42,7 +42,7 @@ export interface IPromptData {
|
|
|
42
42
|
content: IPromptContent;
|
|
43
43
|
requireAuth?: boolean;
|
|
44
44
|
}
|
|
45
|
-
export interface
|
|
45
|
+
export interface IUsedHttpHeader {
|
|
46
46
|
name: string;
|
|
47
47
|
description: string;
|
|
48
48
|
isOptional?: boolean;
|
|
@@ -76,26 +76,57 @@ export type IEndpointsOn404 = Record<string, string | string[]>;
|
|
|
76
76
|
* @returns Promise<AuthResult> or AuthResult with detailed authentication result
|
|
77
77
|
*/
|
|
78
78
|
export type CustomAuthValidator = (req: any) => Promise<AuthResult> | AuthResult;
|
|
79
|
+
export type TransportType = 'stdio' | 'sse' | 'http';
|
|
79
80
|
export interface IToolHandlerParams {
|
|
80
81
|
name: string;
|
|
81
82
|
arguments?: any;
|
|
83
|
+
transport: TransportType;
|
|
82
84
|
headers?: Record<string, string>;
|
|
83
85
|
payload?: {
|
|
84
86
|
user: string;
|
|
85
87
|
[key: string]: any;
|
|
86
88
|
} | undefined;
|
|
87
89
|
}
|
|
90
|
+
export interface IGetToolsArgs {
|
|
91
|
+
transport: TransportType;
|
|
92
|
+
headers?: Record<string, string>;
|
|
93
|
+
payload?: {
|
|
94
|
+
user: string;
|
|
95
|
+
[key: string]: any;
|
|
96
|
+
} | undefined;
|
|
97
|
+
}
|
|
98
|
+
export interface IGetPromptsArgs {
|
|
99
|
+
transport: TransportType;
|
|
100
|
+
headers?: Record<string, string>;
|
|
101
|
+
payload?: {
|
|
102
|
+
user: string;
|
|
103
|
+
[key: string]: any;
|
|
104
|
+
} | undefined;
|
|
105
|
+
}
|
|
106
|
+
export interface IGetResourcesArgs {
|
|
107
|
+
transport: TransportType;
|
|
108
|
+
headers?: Record<string, string>;
|
|
109
|
+
payload?: {
|
|
110
|
+
user: string;
|
|
111
|
+
[key: string]: any;
|
|
112
|
+
} | undefined;
|
|
113
|
+
}
|
|
114
|
+
export interface IGetPromptRequest {
|
|
115
|
+
id?: string | number;
|
|
116
|
+
method: 'prompts/get' | 'prompts/content';
|
|
117
|
+
params: IGetPromptParams;
|
|
118
|
+
}
|
|
88
119
|
/**
|
|
89
120
|
* All data that needs to be passed to initialize the MCP server
|
|
90
121
|
*/
|
|
91
122
|
export interface McpServerData {
|
|
92
|
-
tools: Tool[] | (() => Promise<Tool[]>);
|
|
123
|
+
tools: Tool[] | ((args: IGetToolsArgs) => Promise<Tool[]>);
|
|
93
124
|
toolHandler: (params: IToolHandlerParams) => Promise<any>;
|
|
94
125
|
agentBrief: string;
|
|
95
126
|
agentPrompt: string;
|
|
96
|
-
customPrompts?: IPromptData[];
|
|
97
|
-
|
|
98
|
-
customResources?: IResourceData[] | null;
|
|
127
|
+
customPrompts?: IPromptData[] | ((args: IGetPromptsArgs) => Promise<IPromptData[]>);
|
|
128
|
+
usedHttpHeaders?: IUsedHttpHeader[] | null;
|
|
129
|
+
customResources?: IResourceData[] | ((args: IGetResourcesArgs) => Promise<IResourceData[]>) | null;
|
|
99
130
|
customAuthValidator?: CustomAuthValidator;
|
|
100
131
|
tokenGenAuthHandler?: TokenGenAuthHandler;
|
|
101
132
|
httpComponents?: {
|
|
@@ -107,11 +138,6 @@ export interface McpServerData {
|
|
|
107
138
|
};
|
|
108
139
|
getConsulUIAddress?: (serviceId: string) => string;
|
|
109
140
|
}
|
|
110
|
-
export interface IGetPromptRequest {
|
|
111
|
-
id?: string | number;
|
|
112
|
-
method: 'prompts/get' | 'prompts/content';
|
|
113
|
-
params: IGetPromptParams;
|
|
114
|
-
}
|
|
115
141
|
export type TPromptContentFunction = (request: IGetPromptRequest) => string | Promise<string>;
|
|
116
142
|
export type IPromptContent = string | TPromptContentFunction;
|
|
117
143
|
export interface IGetPromptParams {
|
|
@@ -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,MA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AgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,gBAAgB,CAAC;IACzB,MAAM,EAAE;QACN,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;IACF,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,CAAC,CAAC,EAAE,MAAM,GAAG;QACX,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,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"}
|
|
@@ -75,7 +75,7 @@ export function createAdminAuthMW() {
|
|
|
75
75
|
}];
|
|
76
76
|
}
|
|
77
77
|
const authType = adminAuth.type;
|
|
78
|
-
logger.info(`Admin authentication enabled with type: ${authType}`);
|
|
78
|
+
// logger.info(`Admin authentication enabled with type: ${authType}`);
|
|
79
79
|
// For NTLM, use existing NTLM middleware
|
|
80
80
|
if (authType === 'ntlm') {
|
|
81
81
|
return setupNTLMAuthentication();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-auth.js","sourceRoot":"","sources":["../../../src/core/auth/admin-auth.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,6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AG,CAAC,CAAC,IAAI,CAAC;QACnB,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,YAAY;KACpB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -25,9 +25,9 @@ const debugAuth = (req, code, message) => {
|
|
|
25
25
|
/**
|
|
26
26
|
* Check if a resource URI is public (doesn't require authentication)
|
|
27
27
|
*/
|
|
28
|
-
const isPublicResource = (uri) => {
|
|
28
|
+
const isPublicResource = async (uri) => {
|
|
29
29
|
// Get all resources including built-in and custom
|
|
30
|
-
const allResources = getResourcesList()
|
|
30
|
+
const { resources: allResources } = await getResourcesList({ transport: 'http' });
|
|
31
31
|
const resource = allResources.find(r => r.uri === uri);
|
|
32
32
|
if (!resource) {
|
|
33
33
|
return false; // Unknown resources require auth by default
|
|
@@ -37,9 +37,9 @@ const isPublicResource = (uri) => {
|
|
|
37
37
|
/**
|
|
38
38
|
* Check if a prompt name is public (doesn't require authentication)
|
|
39
39
|
*/
|
|
40
|
-
const isPublicPrompt = (name) => {
|
|
40
|
+
const isPublicPrompt = async (name) => {
|
|
41
41
|
// Get all prompts including built-in and custom
|
|
42
|
-
const allPrompts = getPromptsList()
|
|
42
|
+
const { prompts: allPrompts } = await getPromptsList({ transport: 'http' });
|
|
43
43
|
const prompt = allPrompts.find(p => p.name === name);
|
|
44
44
|
if (!prompt) {
|
|
45
45
|
return false; // Unknown prompts require auth by default
|
|
@@ -49,7 +49,7 @@ const isPublicPrompt = (name) => {
|
|
|
49
49
|
/**
|
|
50
50
|
* Check if the current MCP request is for a public resource or prompt
|
|
51
51
|
*/
|
|
52
|
-
const isPublicMcpRequest = (req) => {
|
|
52
|
+
const isPublicMcpRequest = async (req) => {
|
|
53
53
|
const { method } = req.body || {};
|
|
54
54
|
switch (method) {
|
|
55
55
|
case 'ping':
|
|
@@ -61,11 +61,11 @@ const isPublicMcpRequest = (req) => {
|
|
|
61
61
|
return true;
|
|
62
62
|
case 'resources/read': {
|
|
63
63
|
const uri = req.body?.params?.uri;
|
|
64
|
-
return uri ? isPublicResource(uri) : false;
|
|
64
|
+
return uri ? await isPublicResource(uri) : false;
|
|
65
65
|
}
|
|
66
66
|
case 'prompts/get': {
|
|
67
67
|
const name = req.body?.params?.name;
|
|
68
|
-
return name ? isPublicPrompt(name) : false;
|
|
68
|
+
return name ? await isPublicPrompt(name) : false;
|
|
69
69
|
}
|
|
70
70
|
default:
|
|
71
71
|
// All other methods require authentication
|
|
@@ -102,7 +102,7 @@ export function createAuthMW(options = {}) {
|
|
|
102
102
|
}
|
|
103
103
|
// Check if this is a public MCP request on any of the configured paths
|
|
104
104
|
const isMcpRequest = mcpPaths.includes(req.path);
|
|
105
|
-
if (isMcpRequest && isPublicMcpRequest(req)) {
|
|
105
|
+
if (isMcpRequest && await isPublicMcpRequest(req)) {
|
|
106
106
|
return next();
|
|
107
107
|
}
|
|
108
108
|
// Skip authentication if disabled
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.js","sourceRoot":"","sources":["../../../src/core/auth/middleware.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAIvE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC;AAE1D,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,eAAe,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;AAE3F,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"version":3,"file":"multi-auth.d.ts","sourceRoot":"","sources":["../../../src/core/auth/multi-auth.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGlC,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AA4BvE,eAAO,MAAM,sBAAsB,GAAI,KAAK,OAAO,KAAG;IAAE,MAAM,CAAC,EAAE,QAAQ,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAiB9F,CAAC;AAcF;;GAEG;AACH,wBAAgB,uBAAuB,IAAK,mBAAmB,CA8C9D;
|
|
1
|
+
{"version":3,"file":"multi-auth.d.ts","sourceRoot":"","sources":["../../../src/core/auth/multi-auth.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGlC,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AA4BvE,eAAO,MAAM,sBAAsB,GAAI,KAAK,OAAO,KAAG;IAAE,MAAM,CAAC,EAAE,QAAQ,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAiB9F,CAAC;AAcF;;GAEG;AACH,wBAAgB,uBAAuB,IAAK,mBAAmB,CA8C9D;AAKD;;GAEG;AACH,wBAAsB,cAAc,CAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAsEvE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAK,IAAI,CAa5C;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,IAAK,MAAM,CAuChD"}
|
|
@@ -93,34 +93,35 @@ export function detectAuthConfiguration() {
|
|
|
93
93
|
return result;
|
|
94
94
|
}
|
|
95
95
|
const AUTH_CONFIGURATION = detectAuthConfiguration();
|
|
96
|
+
const E_PFX = 'MCP Auth: ';
|
|
96
97
|
/**
|
|
97
98
|
* Checks auth using all configured authentication methods in ascending CPU load order
|
|
98
99
|
*/
|
|
99
100
|
export async function checkMultiAuth(req) {
|
|
100
101
|
const { configured, configuredSet, configuredTypes } = AUTH_CONFIGURATION;
|
|
101
102
|
if (!configured.length) {
|
|
102
|
-
return { success: false, error:
|
|
103
|
+
return { success: false, error: `${E_PFX}No authentication methods configured` };
|
|
103
104
|
}
|
|
104
105
|
const { scheme: authType, credentials } = getTokenFromHttpHeader(req);
|
|
105
106
|
if (!credentials) {
|
|
106
|
-
return { success: false, error:
|
|
107
|
+
return { success: false, error: `${E_PFX}credentials not provided` };
|
|
107
108
|
}
|
|
108
109
|
if (!authType) {
|
|
109
|
-
return { success: false, error:
|
|
110
|
+
return { success: false, error: `${E_PFX}Cannot detect auth type from Authorization header` };
|
|
110
111
|
}
|
|
111
112
|
logger.debug(`Checking auth types: ${configuredTypes}`);
|
|
112
113
|
if (!configuredSet.has(authType)) {
|
|
113
|
-
return { success: false, error:
|
|
114
|
+
return { success: false, error: `${E_PFX}Detected in Authorisation header auth type ${authType} not configured` };
|
|
114
115
|
}
|
|
115
116
|
let errorResult = undefined;
|
|
116
117
|
try {
|
|
117
118
|
switch (authType) {
|
|
118
119
|
case 'permanentServerTokens': {
|
|
119
|
-
const
|
|
120
|
-
if (!
|
|
120
|
+
const { errorReason } = checkPermanentToken(credentials);
|
|
121
|
+
if (!errorReason) {
|
|
121
122
|
return { success: true, authType };
|
|
122
123
|
}
|
|
123
|
-
errorResult = { success: false, authType, error };
|
|
124
|
+
errorResult = { success: false, authType, error: `${E_PFX}${errorReason}` };
|
|
124
125
|
break;
|
|
125
126
|
}
|
|
126
127
|
case 'basic': {
|
|
@@ -133,21 +134,21 @@ export async function checkMultiAuth(req) {
|
|
|
133
134
|
break;
|
|
134
135
|
}
|
|
135
136
|
case 'jwtToken': {
|
|
136
|
-
const { errorReason
|
|
137
|
-
if (!
|
|
137
|
+
const { errorReason, payload, isTokenDecrypted } = checkJwtToken({ token: credentials });
|
|
138
|
+
if (!errorReason) {
|
|
138
139
|
return { success: true, authType, payload };
|
|
139
140
|
}
|
|
140
|
-
errorResult = { success: false, error
|
|
141
|
+
errorResult = { success: false, error: `${E_PFX}${errorReason}`, authType, isTokenDecrypted };
|
|
141
142
|
break;
|
|
142
143
|
}
|
|
143
144
|
case 'custom':
|
|
144
145
|
break;
|
|
145
146
|
default:
|
|
146
|
-
errorResult = { success: false, error:
|
|
147
|
+
errorResult = { success: false, error: `${E_PFX}Unknown auth type: ${authType}` };
|
|
147
148
|
}
|
|
148
149
|
}
|
|
149
150
|
catch (error) {
|
|
150
|
-
logger.warn(`Auth type ${authType} failed with exception:`, error instanceof Error ? error.message : 'Unknown error');
|
|
151
|
+
logger.warn(`Auth type ${authType} failed with exception:`, error instanceof Error ? E_PFX + error.message : 'Unknown error');
|
|
151
152
|
}
|
|
152
153
|
if (CUSTOM_AUTH_VALIDATOR) {
|
|
153
154
|
const requestWithNormalizedHeaders = { ...req, headers: normalizeHeaders(req.headers || {}) };
|
|
@@ -157,10 +158,10 @@ export async function checkMultiAuth(req) {
|
|
|
157
158
|
}
|
|
158
159
|
catch (error) {
|
|
159
160
|
logger.error('Custom auth validator failed:', error);
|
|
160
|
-
return { success: false, error:
|
|
161
|
+
return { success: false, error: `${E_PFX}Custom authentication validation failed${error instanceof Error ? `: ${error.message}` : ''}` };
|
|
161
162
|
}
|
|
162
163
|
}
|
|
163
|
-
return errorResult || { success: false, error:
|
|
164
|
+
return errorResult || { success: false, error: `${E_PFX}Authentication failed for all configured methods: ${configuredTypes}` };
|
|
164
165
|
}
|
|
165
166
|
/**
|
|
166
167
|
* Logs authentication configuration (for debugging)
|