fa-mcp-sdk 0.2.184 → 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.
Files changed (31) hide show
  1. package/cli-template/.claude/agents/fa-mcp-sdk.md +158 -0
  2. package/cli-template/FA-MCP-SDK-DOC/00-FA-MCP-SDK-index.md +216 -0
  3. package/cli-template/FA-MCP-SDK-DOC/01-getting-started.md +209 -0
  4. package/cli-template/FA-MCP-SDK-DOC/02-tools-and-api.md +321 -0
  5. package/cli-template/FA-MCP-SDK-DOC/03-configuration.md +415 -0
  6. package/cli-template/FA-MCP-SDK-DOC/04-authentication.md +544 -0
  7. package/cli-template/FA-MCP-SDK-DOC/05-ad-authorization.md +476 -0
  8. package/cli-template/FA-MCP-SDK-DOC/06-utilities.md +394 -0
  9. package/cli-template/FA-MCP-SDK-DOC/07-testing-and-operations.md +171 -0
  10. package/dist/core/_types_/types.d.ts +0 -5
  11. package/dist/core/_types_/types.d.ts.map +1 -1
  12. package/dist/core/index.d.ts +2 -1
  13. package/dist/core/index.d.ts.map +1 -1
  14. package/dist/core/index.js +2 -0
  15. package/dist/core/index.js.map +1 -1
  16. package/dist/core/web/home-api.js +1 -1
  17. package/dist/core/web/home-api.js.map +1 -1
  18. package/dist/core/web/openapi.d.ts +64 -0
  19. package/dist/core/web/openapi.d.ts.map +1 -0
  20. package/dist/core/web/openapi.js +235 -0
  21. package/dist/core/web/openapi.js.map +1 -0
  22. package/dist/core/web/server-http.d.ts.map +1 -1
  23. package/dist/core/web/server-http.js +11 -9
  24. package/dist/core/web/server-http.js.map +1 -1
  25. package/dist/core/web/static/home/index.html +4 -2
  26. package/dist/core/web/static/home/script.js +2 -2
  27. package/package.json +8 -7
  28. package/src/template/api/router.ts +66 -4
  29. package/src/template/start.ts +0 -5
  30. package/cli-template/FA-MCP-SDK.md +0 -2540
  31. package/src/template/api/swagger.ts +0 -167
@@ -0,0 +1,158 @@
1
+ ---
2
+ name: fa-mcp-sdk
3
+ description: Expert for building MCP servers with FA-MCP-SDK framework. Creates tools, REST APIs, authentication, database integrations, and tests.
4
+ tools: Read, Write, Edit, MultiEdit, Bash, Grep, Glob, LS, TodoWrite
5
+ model: sonnet
6
+ color: green
7
+ ---
8
+
9
+ You are the FA-MCP-SDK Expert Agent, specialized in building Model Context Protocol (MCP) servers using the FA-MCP-SDK TypeScript framework.
10
+
11
+ ## Core Principle
12
+
13
+ **ALWAYS read the relevant documentation before implementation.** Documentation is located in `FA-MCP-SDK-DOC/`.
14
+
15
+ ## Documentation Map
16
+
17
+ | User Task | Read These Files First |
18
+ |-----------|------------------------|
19
+ | Create new MCP server | `00-FA-MCP-SDK-index.md` → `01-getting-started.md` |
20
+ | Add MCP tools | `02-tools-and-api.md` (Tool Development section) |
21
+ | Add REST API endpoints | `02-tools-and-api.md` (REST API Endpoints section) |
22
+ | Configure server | `03-configuration.md` |
23
+ | Use database (PostgreSQL) | `03-configuration.md` (Database Integration section) |
24
+ | Use caching | `03-configuration.md` (Cache Management section) |
25
+ | Setup authentication | `04-authentication.md` |
26
+ | Add AD group authorization | `05-ad-authorization.md` |
27
+ | Error handling, logging | `06-utilities.md` |
28
+ | Write tests | `07-testing-and-operations.md` |
29
+
30
+ ## Workflow
31
+
32
+ 1. **Understand** - Parse user requirements
33
+ 2. **Reference** - Read relevant doc files from `FA-MCP-SDK-DOC/`
34
+ 3. **Plan** - Use TodoWrite for multi-step tasks
35
+ 4. **Implement** - Follow patterns exactly as shown in documentation
36
+ 5. **Validate** - Ensure code matches SDK conventions
37
+
38
+ ## Quick Reference
39
+
40
+ ### Project Structure
41
+ ```
42
+ my-mcp-server/
43
+ ├── config/
44
+ │ ├── default.yaml # Base configuration
45
+ │ ├── development.yaml # Development overrides
46
+ │ ├── local.yaml # Local secrets (gitignored)
47
+ │ └── production.yaml # Production overrides
48
+ ├── src/
49
+ │ ├── _types_/
50
+ │ │ ├── common.d.ts # Common type declarations
51
+ │ │ └── custom-config.ts # Custom config interface
52
+ │ ├── api/
53
+ │ │ └── router.ts # REST endpoints (tsoa decorators)
54
+ │ ├── asset/
55
+ │ │ └── logo.svg # Static assets
56
+ │ ├── prompts/
57
+ │ │ ├── agent-brief.ts # Short agent description
58
+ │ │ ├── agent-prompt.ts # Full agent system prompt
59
+ │ │ └── custom-prompts.ts # Additional prompts
60
+ │ ├── tools/
61
+ │ │ ├── handle-tool-call.ts # Tool execution logic
62
+ │ │ └── tools.ts # Tool definitions
63
+ │ ├── custom-resources.ts # Custom MCP resources
64
+ │ └── start.ts # Entry point
65
+ ├── swagger/
66
+ │ └── openapi.yaml # Auto-generated (gitignored)
67
+ └── tests/
68
+ ```
69
+
70
+ ### Key Imports
71
+ ```typescript
72
+ // Initialization
73
+ import { initMcpServer, McpServerData } from 'fa-mcp-sdk';
74
+
75
+ // Configuration
76
+ import { appConfig } from 'fa-mcp-sdk';
77
+
78
+ // Tools
79
+ import { formatToolResult, ToolExecutionError } from 'fa-mcp-sdk';
80
+
81
+ // Authentication
82
+ import { createAuthMW, checkJwtToken, generateToken } from 'fa-mcp-sdk';
83
+
84
+ // Database
85
+ import { queryMAIN, execMAIN, oneRowMAIN } from 'fa-mcp-sdk';
86
+
87
+ // Cache
88
+ import { getCache } from 'fa-mcp-sdk';
89
+
90
+ // Logging
91
+ import { logger, fileLogger } from 'fa-mcp-sdk';
92
+
93
+ // Testing
94
+ import { McpHttpClient, McpStdioClient, getAuthHeadersForTests } from 'fa-mcp-sdk';
95
+ ```
96
+
97
+ ### Minimal Tool Example
98
+ ```typescript
99
+ // tools.ts
100
+ export const tools: Tool[] = [{
101
+ name: 'my_tool',
102
+ description: 'Tool description',
103
+ inputSchema: {
104
+ type: 'object',
105
+ properties: {
106
+ param: { type: 'string', description: 'Parameter description' }
107
+ },
108
+ required: ['param']
109
+ }
110
+ }];
111
+
112
+ // handle-tool-call.ts
113
+ export const handleToolCall = async (params: {
114
+ name: string;
115
+ arguments?: any;
116
+ headers?: Record<string, string>;
117
+ payload?: any;
118
+ }): Promise<any> => {
119
+ const { name, arguments: args } = params;
120
+ switch (name) {
121
+ case 'my_tool':
122
+ return formatToolResult({ result: args.param });
123
+ default:
124
+ throw new ToolExecutionError(name, `Unknown tool: ${name}`);
125
+ }
126
+ };
127
+ ```
128
+
129
+ ### REST API Example (tsoa)
130
+ ```typescript
131
+ import { Route, Get, Post, Body, Tags, Controller } from 'tsoa';
132
+
133
+ @Route('api')
134
+ export class MyController extends Controller {
135
+ @Get('endpoint')
136
+ @Tags('MyTag')
137
+ public async getEndpoint(): Promise<{ data: string }> {
138
+ return { data: 'response' };
139
+ }
140
+ }
141
+ ```
142
+
143
+ ## Output Format
144
+
145
+ **IMPLEMENTATION COMPLETED**
146
+
147
+ **Files Created/Modified:**
148
+ - `path/to/file.ts`: Description of changes
149
+
150
+ **Key Decisions:**
151
+ - Why specific patterns were chosen
152
+
153
+ **Usage:**
154
+ - How to use the implemented functionality
155
+
156
+ **Next Steps (if any):**
157
+ - Additional configuration needed
158
+ - Tests to run
@@ -0,0 +1,216 @@
1
+ # FA-MCP-SDK Documentation Index
2
+
3
+ ## Overview
4
+
5
+ The FA-MCP-SDK is a comprehensive TypeScript framework for building Model Context Protocol (MCP) servers. This is the documentation index - read the relevant sections based on your task.
6
+
7
+ ## Using with Claude Code
8
+
9
+ This project includes a specialized agent `.claude/agents/fa-mcp-sdk.md` for Claude Code. The agent automatically reads relevant documentation sections and follows SDK patterns.
10
+
11
+ ### Example Prompts
12
+
13
+ **Creating tools:**
14
+ ```
15
+ Use the fa-mcp-sdk subagent to add a tool "get_user" that fetches user data by ID from the database
16
+ ```
17
+
18
+ **Adding REST API:**
19
+ ```
20
+ Use the fa-mcp-sdk subagent to create REST endpoint POST /api/users for user registration with validation
21
+ ```
22
+
23
+ **Setting up authentication:**
24
+ ```
25
+ Use the fa-mcp-sdk subagent to configure JWT authentication with 1 hour token expiration
26
+ ```
27
+
28
+ **Database integration:**
29
+ ```
30
+ Use the fa-mcp-sdk subagent to add PostgreSQL integration and create a tool to query orders table
31
+ ```
32
+
33
+ **Complex tasks:**
34
+ ```
35
+ Use the fa-mcp-sdk subagent to create an MCP server for managing TODO lists with:
36
+ - tools: add_todo, list_todos, complete_todo, delete_todo
37
+ - PostgreSQL storage
38
+ - JWT authentication
39
+ - REST API for web client
40
+ ```
41
+
42
+ The agent will read the appropriate documentation files and implement the functionality following SDK conventions.
43
+
44
+ ## Quick Start
45
+
46
+ ```bash
47
+ npm install fa-mcp-sdk
48
+ ```
49
+
50
+ ## Documentation Structure
51
+
52
+ | File | Content | Read When |
53
+ |------|---------|-----------|
54
+ | [01-getting-started.md](01-getting-started.md) | Installation, project structure, `initMcpServer()`, core types (`McpServerData`, `IPromptData`, `IResourceData`) | Starting a new project, understanding project structure |
55
+ | [02-tools-and-api.md](02-tools-and-api.md) | Tool definitions, `toolHandler`, HTTP headers, REST API with tsoa decorators, OpenAPI/Swagger auto-generation | Creating MCP tools, adding REST endpoints |
56
+ | [03-configuration.md](03-configuration.md) | `appConfig`, YAML configuration, cache management, database integration (PostgreSQL) | Configuring the server, using cache or database |
57
+ | [04-authentication.md](04-authentication.md) | Multi-auth system, JWT tokens, Basic auth, server tokens, custom validators, `createAuthMW()` | Setting up authentication |
58
+ | [05-ad-authorization.md](05-ad-authorization.md) | AD group-based authorization examples: HTTP level, all tools, per-tool | Implementing AD group restrictions |
59
+ | [06-utilities.md](06-utilities.md) | Error handling, utility functions, logging, events, Consul integration, graceful shutdown | Error handling, logging, service discovery |
60
+ | [07-testing-and-operations.md](07-testing-and-operations.md) | Test clients (STDIO, HTTP, SSE), transport types, best practices | Testing, deployment, operations |
61
+
62
+ ## Common Tasks Quick Reference
63
+
64
+ ### Create a new MCP server
65
+ Read: `01-getting-started.md` → `02-tools-and-api.md`
66
+
67
+ ### Add MCP tools
68
+ Read: `02-tools-and-api.md` (Tool Development section)
69
+
70
+ ### Add REST API endpoints
71
+ Read: `02-tools-and-api.md` (REST API Endpoints section)
72
+ - Use tsoa decorators (`@Route`, `@Get`, `@Post`, `@Tags`)
73
+ - Swagger generates automatically if `swagger/openapi.yaml` doesn't exist
74
+
75
+ ### Configure authentication
76
+ Read: `04-authentication.md`
77
+ - Enable in `config/default.yaml` under `webServer.auth`
78
+ - Options: `permanentServerTokens`, `jwtToken`, `basic`, custom validator
79
+
80
+ ### Add AD group authorization
81
+ Read: `05-ad-authorization.md`
82
+ - HTTP level (block at entry)
83
+ - Tool level (restrict all or specific tools)
84
+
85
+ ### Use database
86
+ Read: `03-configuration.md` (Database Integration section)
87
+ - Set `db.postgres.dbs.main.host` in config
88
+ - Use `queryMAIN()`, `execMAIN()`, `oneRowMAIN()`
89
+
90
+ ### Use caching
91
+ Read: `03-configuration.md` (Cache Management section)
92
+ - `getCache()` → `cache.get()`, `cache.set()`, `cache.getOrSet()`
93
+
94
+ ### Write tests
95
+ Read: `07-testing-and-operations.md`
96
+ - Use `McpHttpClient`, `McpStdioClient`, `McpSseClient`
97
+ - Use `getAuthHeadersForTests()` for auth headers
98
+
99
+ ## Key Exports from fa-mcp-sdk
100
+
101
+ ```typescript
102
+ // Initialization
103
+ import { initMcpServer, McpServerData } from 'fa-mcp-sdk';
104
+
105
+ // Configuration
106
+ import { appConfig } from 'fa-mcp-sdk';
107
+
108
+ // Authentication
109
+ import { createAuthMW, checkJwtToken, generateToken, getAuthHeadersForTests } from 'fa-mcp-sdk';
110
+
111
+ // Tools
112
+ import { formatToolResult, ToolExecutionError } from 'fa-mcp-sdk';
113
+
114
+ // Database
115
+ import { queryMAIN, execMAIN, oneRowMAIN, checkMainDB } from 'fa-mcp-sdk';
116
+
117
+ // Cache
118
+ import { getCache } from 'fa-mcp-sdk';
119
+
120
+ // Logging
121
+ import { logger, fileLogger } from 'fa-mcp-sdk';
122
+
123
+ // Utilities
124
+ import { trim, ppj, toError, toStr } from 'fa-mcp-sdk';
125
+
126
+ // Test clients
127
+ import { McpHttpClient, McpStdioClient, McpSseClient } from 'fa-mcp-sdk';
128
+
129
+ // AD Groups
130
+ import { initADGroupChecker } from 'fa-mcp-sdk';
131
+ ```
132
+
133
+ ## Project Structure
134
+
135
+ ```
136
+ my-mcp-server/
137
+ ├── config/
138
+ │ ├── default.yaml # Base configuration
139
+ │ ├── development.yaml # Development overrides
140
+ │ ├── local.yaml # Local secrets (gitignored)
141
+ │ └── production.yaml # Production overrides
142
+ ├── src/
143
+ │ ├── _types_/
144
+ │ │ ├── common.d.ts # Common type declarations
145
+ │ │ └── custom-config.ts # Custom config interface
146
+ │ ├── api/
147
+ │ │ └── router.ts # REST endpoints with tsoa decorators
148
+ │ ├── asset/
149
+ │ │ └── logo.svg # Static assets
150
+ │ ├── prompts/
151
+ │ │ ├── agent-brief.ts # Short agent description
152
+ │ │ ├── agent-prompt.ts # Full agent system prompt
153
+ │ │ └── custom-prompts.ts # Additional prompts
154
+ │ ├── tools/
155
+ │ │ ├── handle-tool-call.ts # Tool execution logic
156
+ │ │ └── tools.ts # Tool definitions
157
+ │ ├── custom-resources.ts # Custom MCP resources
158
+ │ └── start.ts # Entry point
159
+ ├── swagger/
160
+ │ └── openapi.yaml # Auto-generated (gitignored)
161
+ └── tests/
162
+ ```
163
+
164
+
165
+ ## Minimal Example
166
+
167
+ **`src/start.ts`:**
168
+ ```typescript
169
+ import { initMcpServer, McpServerData } from 'fa-mcp-sdk';
170
+ import { tools } from './tools/tools.js';
171
+ import { handleToolCall } from './tools/handle-tool-call.js';
172
+
173
+ const serverData: McpServerData = {
174
+ tools,
175
+ toolHandler: handleToolCall,
176
+ agentBrief: 'My MCP Server',
177
+ agentPrompt: 'You are a helpful assistant.',
178
+ };
179
+
180
+ await initMcpServer(serverData);
181
+ ```
182
+
183
+ **`src/tools/tools.ts`:**
184
+ ```typescript
185
+ import { Tool } from '@modelcontextprotocol/sdk/types.js';
186
+
187
+ export const tools: Tool[] = [
188
+ {
189
+ name: 'hello',
190
+ description: 'Say hello',
191
+ inputSchema: {
192
+ type: 'object',
193
+ properties: {
194
+ name: { type: 'string', description: 'Name to greet' }
195
+ },
196
+ required: ['name']
197
+ }
198
+ }
199
+ ];
200
+ ```
201
+
202
+ **`src/tools/handle-tool-call.ts`:**
203
+ ```typescript
204
+ import { formatToolResult, ToolExecutionError } from 'fa-mcp-sdk';
205
+
206
+ export const handleToolCall = async (params: { name: string; arguments?: any }): Promise<any> => {
207
+ const { name, arguments: args } = params;
208
+
209
+ switch (name) {
210
+ case 'hello':
211
+ return formatToolResult({ message: `Hello, ${args.name}!` });
212
+ default:
213
+ throw new ToolExecutionError(name, `Unknown tool: ${name}`);
214
+ }
215
+ };
216
+ ```
@@ -0,0 +1,209 @@
1
+ # Getting Started with FA-MCP-SDK
2
+
3
+ ## Overview
4
+
5
+ The FA-MCP-SDK is a comprehensive TypeScript framework for building Model Context
6
+ Protocol (MCP) servers. This documentation covers how to use the SDK
7
+ to create your own MCP server project.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ npm install fa-mcp-sdk
13
+ ```
14
+
15
+ ## Project Structure
16
+
17
+ When creating a new MCP server, your project structure should follow this pattern:
18
+
19
+ ```
20
+ my-mcp-server/
21
+ ├── config/ # Environment configurations
22
+ │ ├── default.yaml # Base configuration
23
+ │ ├── development.yaml # Development settings
24
+ │ ├── production.yaml # Production settings
25
+ │ └── test.yaml # Test environment
26
+ ├── src/ # Source code
27
+ │ ├── _types_/ # TypeScript type definitions
28
+ │ ├── api/ # REST API routes (HTTP transport)
29
+ │ │ └── router.ts # Express router with tsoa controllers
30
+ │ ├── prompts/ # Agent prompts
31
+ │ │ ├── agent-brief.ts # Agent brief
32
+ │ │ ├── agent-prompt.ts # Main agent prompt
33
+ │ │ └── custom-prompts.ts # Custom prompts
34
+ │ ├── tools/ # MCP tool implementations
35
+ │ │ ├── handle-tool-call.ts # Tool execution handler
36
+ │ │ └── tools.ts # Tool definitions
37
+ │ ├── custom-resources.ts # Custom MCP resources
38
+ │ └── start.ts # Application entry point
39
+ ├── tests/ # Test suites
40
+ │ ├── mcp/ # MCP protocol tests
41
+ │ └── utils.ts # Test utilities
42
+ ├── .env # Environment variables
43
+ ├── package.json # NPM package configuration
44
+ └── tsconfig.json # TypeScript configuration
45
+ ```
46
+
47
+ ## Main Initialization Function
48
+
49
+ ### `initMcpServer(data: McpServerData): Promise<void>`
50
+
51
+ The primary function for starting your MCP server.
52
+
53
+ **Example Usage in `src/start.ts`:**
54
+
55
+ ```typescript
56
+ import { initMcpServer, McpServerData, CustomAuthValidator } from 'fa-mcp-sdk';
57
+ import { tools } from './tools/tools.js';
58
+ import { handleToolCall } from './tools/handle-tool-call.js';
59
+ import { AGENT_BRIEF } from './prompts/agent-brief.js';
60
+ import { AGENT_PROMPT } from './prompts/agent-prompt.js';
61
+
62
+ // Optional: Custom Authentication validator (black box function)
63
+ const customAuthValidator: CustomAuthValidator = async (req): Promise<AuthResult> => {
64
+ // Your custom authentication logic here - full request object available
65
+ // Can access headers, IP, user-agent, etc.
66
+ const authHeader = req.headers.authorization;
67
+ const userID = req.headers['x-user-id'];
68
+ const clientIP = req.headers['x-real-ip'] || req.connection?.remoteAddress;
69
+
70
+ // Implement any authentication logic (database, LDAP, API, custom rules, etc.)
71
+ const isAuthenticated = await authenticateRequest(req);
72
+
73
+ if (isAuthenticated) {
74
+ return {
75
+ success: true,
76
+ authType: 'basic',
77
+ username: userID || 'unknown',
78
+ };
79
+ } else {
80
+ return {
81
+ success: false,
82
+ error: 'Custom authentication failed',
83
+ };
84
+ }
85
+ };
86
+
87
+ const serverData: McpServerData = {
88
+ tools,
89
+ toolHandler: handleToolCall,
90
+ agentBrief: AGENT_BRIEF,
91
+ agentPrompt: AGENT_PROMPT,
92
+
93
+ // Optional: Provide custom authentication function
94
+ customAuthValidator: customAuthValidator,
95
+
96
+ // ... other configuration
97
+ };
98
+
99
+ await initMcpServer(serverData);
100
+ ```
101
+
102
+ ## Core Types and Interfaces
103
+
104
+ ### `McpServerData`
105
+
106
+ Main configuration interface for your MCP server.
107
+
108
+ ```typescript
109
+ interface McpServerData {
110
+ // MCP Core Components
111
+ tools: Tool[]; // Your tool definitions
112
+ toolHandler: (params: { name: string; arguments?: any; headers?: Record<string, string> }) => Promise<any>; // Tool execution function
113
+
114
+ // Agent Configuration
115
+ agentBrief: string; // Brief description of your agent
116
+ agentPrompt: string; // System prompt for your agent
117
+ customPrompts?: IPromptData[]; // Additional custom prompts
118
+
119
+ // Resources
120
+ requiredHttpHeaders?: IRequiredHttpHeader[] | null; // HTTP headers for authentication
121
+ customResources?: IResourceData[] | null; // Custom resource definitions
122
+
123
+ // Authentication
124
+ customAuthValidator?: CustomAuthValidator; // Custom authentication validator function
125
+
126
+ // HTTP Server Components (for HTTP transport)
127
+ httpComponents?: {
128
+ apiRouter?: Router | null; // Express router for additional endpoints
129
+ endpointsOn404?: IEndpointsOn404; // Custom 404 handling
130
+ swagger?: ISwaggerData | null; // OpenAPI/Swagger configuration
131
+ };
132
+
133
+ // UI Assets
134
+ assets?: {
135
+ favicon?: string; // SVG content for favicon
136
+ maintainerHtml?: string; // Support contact HTML snippet
137
+ };
138
+
139
+ // Consul Integration
140
+ getConsulUIAddress?: (serviceId: string) => string; // Function to generate Consul UI URLs
141
+ }
142
+ ```
143
+
144
+ ### `IPromptData`
145
+
146
+ Configuration for custom prompts in `src/prompts/custom-prompts.ts`.
147
+
148
+ ```typescript
149
+ interface IPromptData {
150
+ name: string; // Unique prompt identifier
151
+ description: string; // Human-readable description
152
+ arguments: []; // Expected arguments (currently empty array)
153
+ content: IPromptContent; // Static string or dynamic function
154
+ requireAuth?: boolean; // Whether authentication is required
155
+ }
156
+
157
+ type IPromptContent = string | TPromptContentFunction;
158
+ type TPromptContentFunction = (request: IGetPromptRequest) => string | Promise<string>;
159
+ ```
160
+
161
+ Example `src/prompts/custom-prompts.ts`:
162
+ ```typescript
163
+ import { IPromptData } from 'fa-mcp-sdk';
164
+
165
+ export const customPrompts: IPromptData[] = [
166
+ {
167
+ name: 'custom_prompt',
168
+ description: 'A custom prompt for specific tasks',
169
+ arguments: [],
170
+ content: (request) => {
171
+ const { sample } = request.params.arguments || {};
172
+ return `Custom prompt content with parameter: ${sample}`;
173
+ },
174
+ },
175
+ ];
176
+ ```
177
+
178
+ ### `IResourceData`
179
+
180
+ Configuration for custom resources in `src/custom-resources.ts`.
181
+
182
+ ```typescript
183
+ interface IResourceData {
184
+ uri: string; // Unique resource URI (e.g., "custom-resource://data1")
185
+ name: string; // Resource name
186
+ title?: string; // Optional display title
187
+ description: string; // Human-readable description
188
+ mimeType: string; // MIME type (e.g., "text/plain", "application/json")
189
+ content: IResourceContent; // Static content or dynamic function
190
+ requireAuth?: boolean; // Whether authentication is required
191
+ }
192
+ ```
193
+
194
+ Example `src/custom-resources.ts`:
195
+ ```typescript
196
+ import { IResourceData } from 'fa-mcp-sdk';
197
+
198
+ export const customResources: IResourceData[] = [
199
+ {
200
+ uri: 'custom-resource://resource1',
201
+ name: 'resource1',
202
+ description: 'Example resource with dynamic content',
203
+ mimeType: 'text/plain',
204
+ content: (uri) => {
205
+ return `Dynamic content for ${uri} at ${new Date().toISOString()}`;
206
+ },
207
+ },
208
+ ];
209
+ ```