fa-mcp-sdk 0.2.222 → 0.2.225
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/README.md +196 -239
- package/bin/fa-mcp.js +1 -0
- package/cli-template/package.json +1 -1
- package/cli-template/prompt-example-new-MCP.md +77 -0
- package/dist/core/web/openapi.d.ts.map +1 -1
- package/dist/core/web/openapi.js +1 -2
- package/dist/core/web/openapi.js.map +1 -1
- package/package.json +1 -1
- package/scripts/publish.sh +78 -0
package/README.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
# fa-mcp
|
|
1
|
+
# MCP Server Template Generator (`fa-mcp`)
|
|
2
2
|
|
|
3
|
-
Production-ready core framework for building MCP (Model Context Protocol) servers with comprehensive
|
|
3
|
+
Production-ready core framework for building MCP (Model Context Protocol) servers with comprehensive
|
|
4
4
|
infrastructure support.
|
|
5
5
|
|
|
6
|
+
CLI utility that creates ready-to-use MCP (Model Context Protocol) server projects from the official template.
|
|
7
|
+
|
|
6
8
|
## Overview
|
|
7
9
|
|
|
8
10
|
This framework provides complete infrastructure for building enterprise-grade MCP servers with support for:
|
|
@@ -18,284 +20,239 @@ This framework provides complete infrastructure for building enterprise-grade MC
|
|
|
18
20
|
|
|
19
21
|
The framework uses dependency injection to keep the core completely agnostic of project-specific implementations.
|
|
20
22
|
|
|
21
|
-
## Project Structure
|
|
22
|
-
|
|
23
|
-
```
|
|
24
|
-
fa-mcp-sdk/
|
|
25
|
-
├── src/core/ # Core framework (published to npm)
|
|
26
|
-
│ ├── bootstrap/ # Configuration and startup
|
|
27
|
-
│ ├── mcp/ # MCP protocol implementation
|
|
28
|
-
│ ├── web/ # HTTP server and endpoints
|
|
29
|
-
│ ├── db/ # PostgreSQL integration
|
|
30
|
-
│ ├── cache/ # Caching system with node-cache wrapper
|
|
31
|
-
│ ├── consul/ # Service discovery
|
|
32
|
-
│ ├── token/ # Authentication
|
|
33
|
-
│ ├── errors/ # Error handling
|
|
34
|
-
│ ├── utils/ # Utilities
|
|
35
|
-
│ └── index.ts # Public API
|
|
36
|
-
│
|
|
37
|
-
└── src/template/ # Reference implementation
|
|
38
|
-
├── tools/ # Example MCP tools
|
|
39
|
-
├── prompts/ # Agent prompts
|
|
40
|
-
├── api/ # Custom HTTP endpoints
|
|
41
|
-
└── start.ts # Entry point
|
|
42
|
-
```
|
|
43
23
|
|
|
44
|
-
##
|
|
24
|
+
## Steps to Get Started
|
|
45
25
|
|
|
46
|
-
|
|
26
|
+
1) Install `fa-mcp-sdk` globally:
|
|
47
27
|
|
|
48
|
-
```bash
|
|
49
|
-
npm install
|
|
50
|
-
```
|
|
28
|
+
```bash
|
|
29
|
+
npm install -g fa-mcp-sdk
|
|
30
|
+
```
|
|
51
31
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
Create configuration files in `config/`:
|
|
55
|
-
|
|
56
|
-
See [config/default.yaml](config/default.yaml) for all available options.
|
|
57
|
-
See [config/_local.yaml](config/_local.yaml) for template of local configuration.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
### 3. Basic Usage
|
|
61
|
-
|
|
62
|
-
```typescript
|
|
63
|
-
import { initMcpServer, isMainModule, McpServerData } from '../core/index.js';
|
|
64
|
-
import { readFileSync } from 'fs';
|
|
65
|
-
import { join } from 'path';
|
|
66
|
-
|
|
67
|
-
export async function startProject(): Promise<void> {
|
|
68
|
-
// Read favicon from assets
|
|
69
|
-
const faviconPath = join(process.cwd(), 'src/template/asset/favicon.svg');
|
|
70
|
-
let favicon: string;
|
|
71
|
-
|
|
72
|
-
try {
|
|
73
|
-
favicon = readFileSync(faviconPath, 'utf-8');
|
|
74
|
-
} catch (_error) {
|
|
75
|
-
// Fallback if favicon not found
|
|
76
|
-
favicon = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16">
|
|
77
|
-
<rect width="16" height="16" fill="#007ACC"/>
|
|
78
|
-
</svg>`;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// Assemble all data to pass to the core
|
|
82
|
-
const serverData: McpServerData = {
|
|
83
|
-
// Required: MCP components
|
|
84
|
-
tools: [
|
|
85
|
-
{
|
|
86
|
-
name: 'example_tool',
|
|
87
|
-
description: 'Example tool',
|
|
88
|
-
inputSchema: {
|
|
89
|
-
type: 'object',
|
|
90
|
-
properties: {
|
|
91
|
-
query: { type: 'string', description: 'Query parameter' }
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
],
|
|
96
|
-
toolHandler: async (params) => {
|
|
97
|
-
const { name, arguments: args } = params;
|
|
98
|
-
if (name === 'example_tool') {
|
|
99
|
-
return `Result: ${args.query}`;
|
|
100
|
-
}
|
|
101
|
-
throw new Error(`Unknown tool: ${name}`);
|
|
102
|
-
},
|
|
103
|
-
|
|
104
|
-
// Required: Agent identification
|
|
105
|
-
agentBrief: "My MCP Server - Brief description for agent selection",
|
|
106
|
-
agentPrompt: "Detailed system prompt for the agent",
|
|
107
|
-
|
|
108
|
-
// Optional: Custom prompts and resources
|
|
109
|
-
customPrompts: [],
|
|
110
|
-
customResources: [],
|
|
111
|
-
|
|
112
|
-
// Optional: HTTP components
|
|
113
|
-
httpComponents: {
|
|
114
|
-
apiRouter, // Express router for custom endpoints
|
|
115
|
-
},
|
|
116
|
-
|
|
117
|
-
// Optional: Assets
|
|
118
|
-
assets: { favicon },
|
|
119
|
-
|
|
120
|
-
// Optional: Function to get Consul UI address
|
|
121
|
-
getConsulUIAddress: (serviceId: string) =>
|
|
122
|
-
`https://consul.my.ui/ui/dc-dev/services/${serviceId}/instances`,
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
// Start MCP server with assembled data
|
|
126
|
-
await initMcpServer(serverData);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// Auto-start if this file is run directly
|
|
130
|
-
if (isMainModule(import.meta.url)) {
|
|
131
|
-
startProject().catch(error => {
|
|
132
|
-
console.error('Failed to start project:', error);
|
|
133
|
-
process.exit(1);
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
```
|
|
32
|
+
2) Run the CLI, specify the target directory, and follow the interactive prompts:
|
|
137
33
|
|
|
138
|
-
|
|
34
|
+
```bash
|
|
35
|
+
fa-mcp
|
|
36
|
+
```
|
|
139
37
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
38
|
+
3) Launching the template MCP server:
|
|
39
|
+
- Navigate to the target directory: `cd <targetPath>`
|
|
40
|
+
- Install dependencies: `npm install`
|
|
41
|
+
- Build the project: `npm run build`
|
|
42
|
+
- Start the server: `npm start`
|
|
144
43
|
|
|
145
|
-
|
|
44
|
+
4) Vibe-coding your MCP server logic:
|
|
45
|
+
- Create an instruction file (prompt) for your preferred AI coding assistant.
|
|
46
|
+
`fa-mcp-sdk` comes ready for use with `Claude Code`.
|
|
47
|
+
You can find an example prompt for creating an MCP server (e.g., a currency exchange rate provider) in `cli-template/prompt-example-new-MCP.md`.
|
|
48
|
+
- Launch your AI coder and provide it with the instructions to build your new MCP server.
|
|
146
49
|
|
|
147
|
-
|
|
50
|
+
`
|
|
148
51
|
|
|
149
|
-
|
|
52
|
+
### Using Configuration File
|
|
150
53
|
|
|
151
54
|
```bash
|
|
152
|
-
|
|
153
|
-
mcp.transportType: stdio
|
|
154
|
-
|
|
155
|
-
# Or via command line
|
|
156
|
-
npm start stdio
|
|
55
|
+
fa-mcp config.yaml
|
|
157
56
|
```
|
|
158
57
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
### HTTP Mode (Web Integration)
|
|
162
|
-
|
|
163
|
-
For web applications and API access:
|
|
164
|
-
|
|
165
|
-
```bash
|
|
166
|
-
# Default mode
|
|
167
|
-
npm start
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
Provides endpoints:
|
|
171
|
-
|
|
172
|
-
- `GET /` - Home page with server info
|
|
173
|
-
- `GET /health` - Health check
|
|
174
|
-
- `GET /sse` - Server-Sent Events for MCP communication
|
|
175
|
-
- `POST /mcp` - Direct MCP JSON-RPC endpoint
|
|
176
|
-
- `GET /docs` - Swagger API documentation
|
|
177
|
-
- `/api/*` - Custom API endpoints
|
|
178
|
-
|
|
179
|
-
## Core Features
|
|
180
|
-
|
|
181
|
-
### Database Integration
|
|
182
|
-
|
|
183
|
-
Built-in PostgreSQL support with connection pooling:
|
|
184
|
-
|
|
185
|
-
All available functions see [src/core/db/pg-db.ts](src/core/db/pg-db.ts)
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
## Template Project
|
|
190
|
-
|
|
191
|
-
The `src/template/` directory contains a complete reference implementation:
|
|
58
|
+
## Configuration
|
|
192
59
|
|
|
193
|
-
|
|
60
|
+
The CLI collects required and optional parameters through interactive prompts or configuration file.
|
|
61
|
+
|
|
62
|
+
### Required Parameters
|
|
63
|
+
|
|
64
|
+
| Parameter | Description | Example |
|
|
65
|
+
|-----------------------|-------------|---------|
|
|
66
|
+
| `project.name` | Package.json name and MCP server identification | `"my-mcp-server"` |
|
|
67
|
+
| `project.description` | Package.json description | `"A custom MCP server"` |
|
|
68
|
+
| `project.productName` | Display name for UI and documentation | `"My MCP Server"` |
|
|
69
|
+
| `port` | Web server port for HTTP and MCP protocol | `"3000"` |
|
|
70
|
+
|
|
71
|
+
### Optional Parameters
|
|
72
|
+
|
|
73
|
+
| Parameter | Description | Default |
|
|
74
|
+
|-------------------------------------|-------------|---------|
|
|
75
|
+
| `author.name` | Package.json author name | `""` |
|
|
76
|
+
| `author.email` | Package.json author email | `""` |
|
|
77
|
+
| `git-base-url` | Git repository base URL | `"github.com/username"` |
|
|
78
|
+
| `consul.service.enable` | Enable Consul service registration | `"false"` |
|
|
79
|
+
| `consul.agent.reg.token` | Token for registering service with Consul | `"***"` |
|
|
80
|
+
| `consul.envCode.dev` | Development environment code | `"<envCode.dev>"` |
|
|
81
|
+
| `consul.envCode.prod` | Production environment code | `"<envCode.prod>"` |
|
|
82
|
+
| `consul.agent.dev.dc` | Development Consul datacenter | `""` |
|
|
83
|
+
| `consul.agent.dev.host` | Development Consul UI host | `"consul.my.ui"` |
|
|
84
|
+
| `consul.agent.dev.token` | Development Consul access token | `"***"` |
|
|
85
|
+
| `consul.agent.prd.dc` | Production Consul datacenter | `""` |
|
|
86
|
+
| `consul.agent.prd.host` | Production Consul UI host | `"consul.my.ui"` |
|
|
87
|
+
| `consul.agent.prd.token` | Production Consul access token | `"***"` |
|
|
88
|
+
| `mcp.domain` | Domain name for nginx configuration | `""` |
|
|
89
|
+
| `ssl-wildcard.conf.rel.path` | Relative path to SSL config in /etc/nginx | `"snippets/ssl-wildcard.conf"` |
|
|
90
|
+
| `webServer.auth.enabled` | Enable token authorization | `"false"` |
|
|
91
|
+
| `webServer.auth.token.checkMCPName` | Check MCP name in token | `"false"` |
|
|
92
|
+
| `isProduction` | Production mode flag | `"false"` |
|
|
93
|
+
| `SERVICE_INSTANCE` | Service name suffix for Consul and PM2 | `""` |
|
|
94
|
+
| `maintainerUrl` | Support/maintainer URL | `""` |
|
|
95
|
+
| `logger.useFileLogger` | Enable file logging | `""` |
|
|
96
|
+
|
|
97
|
+
### Configuration File Examples
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
> **[YAML Example with detailed comments](https://github.com/Bazilio-san/fa-mcp-sdk/blob/master/cli-config.example.yaml)**
|
|
101
|
+
|
|
102
|
+
The utility supports both **JSON** and **YAML** configuration formats.
|
|
103
|
+
Use either `.json`, `.yaml`, or `.yml` file extensions.
|
|
104
|
+
|
|
105
|
+
#### Usage:
|
|
194
106
|
|
|
195
107
|
```bash
|
|
196
|
-
#
|
|
197
|
-
|
|
108
|
+
# Interactive setup (will prompt for all parameters)
|
|
109
|
+
fa-mcp
|
|
198
110
|
|
|
199
|
-
#
|
|
200
|
-
|
|
111
|
+
# Using JSON configuration
|
|
112
|
+
fa-mcp config.json
|
|
113
|
+
fa-mcp --config=my-config.json
|
|
201
114
|
|
|
202
|
-
#
|
|
203
|
-
|
|
115
|
+
# Using YAML configuration (NEW!)
|
|
116
|
+
fa-mcp config.yaml
|
|
117
|
+
fa-mcp --config=my-config.yml
|
|
204
118
|
```
|
|
205
119
|
|
|
206
|
-
### Template Structure
|
|
207
120
|
|
|
208
|
-
|
|
209
|
-
- **Handlers**: `src/template/tools/handle-tool-call.ts` - Implement tool logic
|
|
210
|
-
- **Prompts**: `src/template/prompts/` - Agent system prompts
|
|
211
|
-
- **API**: `src/template/api/router.ts` - Custom HTTP endpoints
|
|
212
|
-
- **Config**: `config/` - Configuration files
|
|
121
|
+
## Generated Project Features
|
|
213
122
|
|
|
214
|
-
|
|
123
|
+
- TypeScript MCP server with HTTP/STDIO transport
|
|
124
|
+
- Express.js web server with Swagger documentation
|
|
125
|
+
- JWT authentication support (optional)
|
|
126
|
+
- Consul service discovery integration (optional)
|
|
127
|
+
- File and console logging
|
|
128
|
+
- ESLint configuration and Jest testing
|
|
129
|
+
- PM2 deployment scripts
|
|
130
|
+
- Nginx configuration templates
|
|
215
131
|
|
|
216
|
-
### Environment Variables
|
|
217
132
|
|
|
218
|
-
|
|
133
|
+
## Project Structure
|
|
219
134
|
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
135
|
+
```
|
|
136
|
+
my-mcp-server/
|
|
137
|
+
├── .claude/ # Settings, Agents, Hooks for Claude Code
|
|
138
|
+
│ ├── agents/ # Folder with Claude Code agents. Including the agent fa-mcp-sdk
|
|
139
|
+
│ ├── hooks/ # Code formatting hook after changes made by Claude Code
|
|
140
|
+
│ └── settings.json # Claude Code settings
|
|
141
|
+
├── .run/ # JetBrains IDE run configurations
|
|
142
|
+
├── config/ # Environment configurations
|
|
143
|
+
│ ├── _local.yaml # Local configuration template
|
|
144
|
+
│ ├── custom-environment-variables.yaml # Environment mapping
|
|
145
|
+
│ ├── default.yaml # Base configuration
|
|
146
|
+
│ ├── development.yaml # Development settings
|
|
147
|
+
│ ├── local.yaml # Local configuration
|
|
148
|
+
│ ├── production.yaml # Production settings
|
|
149
|
+
│ └── test.yaml # Test environment
|
|
150
|
+
├── deploy/ # Deployment configurations
|
|
151
|
+
│ ├── .gitkeep # Git directory keeper
|
|
152
|
+
│ ├── NGINX/ # Nginx configuration templates
|
|
153
|
+
│ │ ├── sites-enabled/ # Nginx site configurations
|
|
154
|
+
│ │ └── snippets/ # Nginx configuration snippets
|
|
155
|
+
│ ├── config.example.yml # Deployment config example
|
|
156
|
+
│ ├── pm2.config.js # PM2 process manager config
|
|
157
|
+
│ ├── pm2reg.sh # PM2 registration script
|
|
158
|
+
│ ├── srv.cjs # Server management script
|
|
159
|
+
│ └── srv.sh.readme.md # Server script documentation
|
|
160
|
+
├── FA-MCP-SDK-DOC/ # FA-MCP-SDK Documentation
|
|
161
|
+
├── scripts/ # Utility scripts
|
|
162
|
+
│ ├── npm/ # NPM utility scripts
|
|
163
|
+
│ ├── kill-port.js # Port cleanup utility
|
|
164
|
+
│ ├── pre-commit # Git pre-commit hook
|
|
165
|
+
│ └── remove-nul.js # File cleanup utility
|
|
166
|
+
├── src/ # Source code
|
|
167
|
+
│ ├── _types_/ # TypeScript type definitions
|
|
168
|
+
│ ├── api/ # REST API routes
|
|
169
|
+
│ │ └── router.ts # Express router
|
|
170
|
+
│ ├── asset/ # Static assets
|
|
171
|
+
│ │ └── logo.svg # Application logo/favicon
|
|
172
|
+
│ ├── prompts/ # Agent prompts
|
|
173
|
+
│ │ ├── agent-brief.ts # Agent brief
|
|
174
|
+
│ │ ├── agent-prompt.ts # Main agent prompt
|
|
175
|
+
│ │ └── custom-prompts.ts # Custom prompts
|
|
176
|
+
│ ├── tools/ # MCP tool implementations
|
|
177
|
+
│ │ ├── handle-tool-call.ts # Tool execution handler
|
|
178
|
+
│ │ └── tools.ts # Tool definitions
|
|
179
|
+
│ ├── custom-resources.ts # Custom MCP resources
|
|
180
|
+
│ └── start.ts # Application entry point
|
|
181
|
+
├── swagger/
|
|
182
|
+
│ └── openapi.yaml # API description. Generated if none
|
|
183
|
+
├── tests/ # Test suites
|
|
184
|
+
│ ├── mcp/ # MCP protocol tests
|
|
185
|
+
│ ├── jest-simple-reporter.js # Custom Jest reporter
|
|
186
|
+
│ └── utils.ts # Test utilities
|
|
187
|
+
├── .editorconfig # Editor configuration
|
|
188
|
+
├── .env # Environment variables
|
|
189
|
+
├── .env.example # Environment variables template
|
|
190
|
+
├── .envrc # direnv configuration
|
|
191
|
+
├── .gitignore # Git ignore rules
|
|
192
|
+
├── eslint.config.js # ESLint configuration
|
|
193
|
+
├── jest.config.js # Jest test configuration
|
|
194
|
+
├── LICENSE # MIT license file
|
|
195
|
+
├── package.json # NPM package configuration
|
|
196
|
+
├── prompt-example-new-MCP.md # Example of instructions for Claude Code for vibe coding of a custom MCP server
|
|
197
|
+
├── README.md
|
|
198
|
+
├── tsconfig.json # TypeScript configuration
|
|
199
|
+
└── update.cjs # Project update script
|
|
228
200
|
```
|
|
229
201
|
|
|
230
|
-
|
|
202
|
+
Note: The `dist/` directory (compiled JavaScript) is created after running `npm run build`.
|
|
231
203
|
|
|
232
|
-
|
|
233
|
-
2. Environment-specific YAML (`development.yaml`, `production.yaml`)
|
|
234
|
-
3. `config/default.yaml`
|
|
235
|
-
4. Package.json metadata
|
|
204
|
+
## Available Scripts
|
|
236
205
|
|
|
237
|
-
|
|
206
|
+
| Script | Description |
|
|
207
|
+
|--------|-------------|
|
|
208
|
+
| `npm start` | Start compiled MCP server |
|
|
209
|
+
| `npm run build` | Compile TypeScript |
|
|
210
|
+
| `npm run cb` | Clean and build |
|
|
211
|
+
| `npm run ci` | Install dependencies |
|
|
212
|
+
| `npm run reinstall` | Reinstall all dependencies |
|
|
213
|
+
| `npm run lint` | Run ESLint |
|
|
214
|
+
| `npm run lint:fix` | Fix ESLint issues |
|
|
215
|
+
| `npm run test:mcp` | Test MCP tools |
|
|
216
|
+
| `npm run test:mcp-http` | Test HTTP transport |
|
|
217
|
+
| `npm run test:mcp-sse` | Test SSE transport |
|
|
218
|
+
| `npm run test:mcp-stdio` | Test STDIO transport |
|
|
219
|
+
| `npm run generate-token` | Generate JWT tokens |
|
|
220
|
+
| `npm run consul:unreg` | Deregister from Consul |
|
|
238
221
|
|
|
239
|
-
### Building
|
|
240
222
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
223
|
+
## Server runs at
|
|
224
|
+
`http://localhost:3000` with:
|
|
225
|
+
- MCP endpoints at `/mcp/*`
|
|
226
|
+
- Swagger UI at `/docs`
|
|
227
|
+
- Health check at `/health`
|
|
246
228
|
|
|
247
|
-
|
|
229
|
+
## Directory Requirements
|
|
248
230
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
```
|
|
231
|
+
- **Empty directories only** - CLI aborts if files exist
|
|
232
|
+
- Allowed files: `.git`, `.idea`, `.vscode`, `.DS_Store`, `node_modules`, `dist`, `__misc`, `_tmp`, `.swp`, `.swo`, `.sublime-project`, `.sublime-workspace`, `~last-cli-config.json`
|
|
233
|
+
- Use absolute paths for target directory
|
|
253
234
|
|
|
254
|
-
|
|
235
|
+
## Deployment
|
|
255
236
|
|
|
237
|
+
### PM2 Production
|
|
256
238
|
```bash
|
|
257
|
-
npm run
|
|
239
|
+
npm run build
|
|
240
|
+
pm2 start deploy/pm2.config.js
|
|
258
241
|
```
|
|
259
242
|
|
|
260
|
-
###
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
import { McpSseClient } from 'fa-mcp-sdk';
|
|
266
|
-
|
|
267
|
-
// For npm package usage - prevents unhandledRejection
|
|
268
|
-
const client = McpSseClient.createWithErrorHandler('http://localhost:3000');
|
|
269
|
-
|
|
270
|
-
try {
|
|
271
|
-
const response = await client.callTool('tool_name', { param: 'value' });
|
|
272
|
-
console.log('Success:', response);
|
|
273
|
-
} catch (error) {
|
|
274
|
-
console.log('Error:', error.message); // Properly caught
|
|
275
|
-
} finally {
|
|
276
|
-
await client.close();
|
|
277
|
-
}
|
|
243
|
+
### Systemd Service
|
|
244
|
+
```bash
|
|
245
|
+
npm run build
|
|
246
|
+
chmod +x deploy/srv.cjs
|
|
247
|
+
./deploy/srv.cjs install
|
|
278
248
|
```
|
|
279
249
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
## API Reference
|
|
283
|
-
|
|
284
|
-
### McpServerData Interface
|
|
285
|
-
|
|
286
|
-
See: [src/core/_types_/types.ts](src/core/_types_/types.ts)
|
|
287
|
-
|
|
288
|
-
### Core Exports
|
|
289
|
-
|
|
290
|
-
See: [src/core/index.ts](src/core/index.ts)
|
|
291
|
-
|
|
292
|
-
## Requirements
|
|
250
|
+
### Consul Registration
|
|
251
|
+
Set `consul.service.enable: true` and provide required tokens for automatic service registration.
|
|
293
252
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
- **PostgreSQL**: >= 12 (optional)
|
|
297
|
-
- **Consul**: Any version (optional)
|
|
253
|
+
### Nginx Configuration
|
|
254
|
+
Generated nginx configuration files in `deploy/NGINX/` for domain-based routing.
|
|
298
255
|
|
|
299
256
|
## License
|
|
300
257
|
|
|
301
|
-
MIT
|
|
258
|
+
MIT License
|
package/bin/fa-mcp.js
CHANGED
|
@@ -907,6 +907,7 @@ certificate's public and private keys`,
|
|
|
907
907
|
const scriptsTargetPath = path.join(targetPath, 'scripts');
|
|
908
908
|
await this.copyDirectory(path.join(PROJ_ROOT, 'scripts'), scriptsTargetPath);
|
|
909
909
|
await fs.rm(path.join(targetPath, 'scripts/copy-static.js'), { force: true });
|
|
910
|
+
await fs.rm(path.join(targetPath, 'scripts/publish.sh'), { force: true });
|
|
910
911
|
|
|
911
912
|
// Rename all .xml files in .run directory to .run.xml
|
|
912
913
|
const runDirPath = path.join(targetPath, '.run');
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Goal
|
|
2
|
+
Write the code for MCP server tools that implement retrieving the current cross-rate for a specified pair of currencies.
|
|
3
|
+
|
|
4
|
+
## Instructions
|
|
5
|
+
|
|
6
|
+
### Currency Cross-Rate API
|
|
7
|
+
|
|
8
|
+
#### Available Currencies
|
|
9
|
+
Currency codes (ISO 4217 code Alpha-3): ALL, ARS, AUD, BGN, BRL, BYN, CAD, CHF, CLP, CNY, CZK, DKK, EUR, GBP, HKD, HRK, HUF, IDR, INR, ISK, JOD, JPY, KRW, KZT, LAK, LKR, MKD, MMK, MXN, MYR, NOK, NPR, NZD, PHP, PLN, RON, RSD, RUB, SEK, SGD, THB, TRY, TWD, UAH, USD, VND, ZAR
|
|
10
|
+
|
|
11
|
+
#### Endpoint
|
|
12
|
+
|
|
13
|
+
```http request
|
|
14
|
+
GET http://<appConfig.accessPoints.currencyService.host>:<appConfig.accessPoints.currencyService.port>/currency-service/?rate=<QUOTE_CURRENCY><BASE_CURRENCY>
|
|
15
|
+
Authorization: Bearer <appConfig.accessPoints.currencyService.token>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Example:
|
|
19
|
+
|
|
20
|
+
```http request
|
|
21
|
+
GET http://smart-trade-ml.com:5002/currency-service/?rate=THBRUB
|
|
22
|
+
Authorization: Bearer <appConfig.accessPoints.currencyService.token>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Response:
|
|
26
|
+
|
|
27
|
+
```json
|
|
28
|
+
{"symbol": "THBRUB", "rate": 2.424167346170733}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Possible error codes: 400, 401, 404, 502
|
|
32
|
+
|
|
33
|
+
### Addition to config/default.yaml
|
|
34
|
+
|
|
35
|
+
```yaml
|
|
36
|
+
accessPoints:
|
|
37
|
+
currencyService:
|
|
38
|
+
host: smart-trade-ml.com
|
|
39
|
+
port: 5002
|
|
40
|
+
token: '***'
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
### Create config/local.yaml
|
|
45
|
+
|
|
46
|
+
Create a file config/local.yaml with the following content:
|
|
47
|
+
|
|
48
|
+
```yaml
|
|
49
|
+
accessPoints:
|
|
50
|
+
currencyService:
|
|
51
|
+
token: '88888888-4444-4444-4444-bbbbbbbbbbbb'
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
### Code Style
|
|
56
|
+
Write code concisely. Avoid unnecessary logging.
|
|
57
|
+
Follow DRY and KISS principles.
|
|
58
|
+
|
|
59
|
+
### Use the fa-mcp-sdk agent
|
|
60
|
+
Follow the recommendations in the file FA-MCP-SDK-DOC/00-FA-MCP-SDK-index.md
|
|
61
|
+
|
|
62
|
+
# Task
|
|
63
|
+
|
|
64
|
+
1) Instead of the test tool 'example_tool', add a tool to get the current currency cross-rate.
|
|
65
|
+
Tool parameters:
|
|
66
|
+
- quoteCurrency - Currency code (ISO 4217 code Alpha-3) - required parameter
|
|
67
|
+
- baseCurrency - Currency code (ISO 4217 code Alpha-3) - optional parameter, default is USD
|
|
68
|
+
|
|
69
|
+
2) Copy the file __misc/asset/logo.svg to src/asset
|
|
70
|
+
|
|
71
|
+
3) Instead of the test resource 'custom-resource://resource1', add a resource to get the list of available currencies
|
|
72
|
+
|
|
73
|
+
4) Instead of the test examples in tests/mcp/test-cases.js, write tests for our case
|
|
74
|
+
|
|
75
|
+
5) Formulate the prompt AGENT_BRIEF in src/prompts/agent-brief.ts and AGENT_PROMPT in src/prompts/agent-prompt.ts
|
|
76
|
+
|
|
77
|
+
6) Instead of the endpoint /api/example (/example) in the file src/api/router.ts, create the endpoint get-curr-rate as a proxy to http://<appConfig.accessPoints.currencyService.host>:<appConfig.accessPoints.currencyService.port>/currency-service/?rate=<QUOTE_CURRENCY><BASE_CURRENCY>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../../../src/core/web/openapi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAqB,MAAM,SAAS,CAAC;AAOpD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EA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GD;;GAEG;AACH,wBAAgB,+BAA+B,mJAE9C"}
|
package/dist/core/web/openapi.js
CHANGED
|
@@ -19,9 +19,8 @@ async function generateSpecOnDemand(specPath) {
|
|
|
19
19
|
controllerPathGlobs = ['./src/template/api/*.ts'];
|
|
20
20
|
entryFile = './src/template/api/router.ts';
|
|
21
21
|
}
|
|
22
|
-
// перед generateSpec
|
|
23
22
|
const needsAuth = !!appConfig.webServer?.auth?.enabled;
|
|
24
|
-
const servers = buildServersArray();
|
|
23
|
+
const servers = buildServersArray();
|
|
25
24
|
// ExtendedSpecConfig structure for generateSpec
|
|
26
25
|
const specConfig = {
|
|
27
26
|
outputDirectory: specDir,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi.js","sourceRoot":"","sources":["../../../src/core/web/openapi.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACzD,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,IAAI,MAAM,SAAS,CAAC;AAChC,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AA8C1D;;GAEG;AACH,KAAK,UAAU,oBAAoB,CAAE,QAAgB;IACnD,IAAI,CAAC;QACH,0BAA0B;QAC1B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACvC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YACzB,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1C,CAAC;QACD,IAAI,mBAAmB,GAAG,CAAC,gBAAgB,CAAC,CAAC;QAC7C,IAAI,SAAS,GAAG,qBAAqB,CAAC;QACtC,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,4BAA4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
|
1
1
|
{
|
|
2
2
|
"name": "fa-mcp-sdk",
|
|
3
3
|
"productName": "FA MCP SDK",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.225",
|
|
5
5
|
"description": "Core infrastructure and templates for building Model Context Protocol (MCP) servers with TypeScript",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/core/index.js",
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
expected_branch="master"
|
|
4
|
+
|
|
5
|
+
c='\033[0;35m'
|
|
6
|
+
y='\033[0;33m'
|
|
7
|
+
r='\033[0;31m'
|
|
8
|
+
c0='\033[0;0m'
|
|
9
|
+
g='\033[0;32m'
|
|
10
|
+
|
|
11
|
+
echo_r() { /bin/echo -e ${r}"$1"${c0}; };
|
|
12
|
+
|
|
13
|
+
# shellcheck disable=SC2120
|
|
14
|
+
exit_on_error(){
|
|
15
|
+
if [[ $? -ne 0 ]] ; then
|
|
16
|
+
if [[ -n "$1" ]]; then
|
|
17
|
+
echo_r "$1";
|
|
18
|
+
else
|
|
19
|
+
echo -e "${r}**** ERROR ****${c0}"
|
|
20
|
+
fi;
|
|
21
|
+
read -p "Press any key to resume ..."
|
|
22
|
+
exit 0
|
|
23
|
+
fi
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
set +e
|
|
27
|
+
|
|
28
|
+
branch_name=$(git symbolic-ref --short HEAD)
|
|
29
|
+
exit_on_error "$y**** Version will not be bumped since retcode is not equals 0 ****$c0"
|
|
30
|
+
|
|
31
|
+
if [[ "$branch_name" != "$expected_branch" ]] ; then
|
|
32
|
+
echo -e "${y}**** git branch should be ${c}{$expected_branch}${y}, current: ${c}${branch_name}${y} ****$c0"
|
|
33
|
+
read -p "Press any key to resume ..."
|
|
34
|
+
exit 0
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
npm run cb
|
|
38
|
+
exit_on_error "$y**** Typescript build failed ****$c0"
|
|
39
|
+
|
|
40
|
+
old_version=''
|
|
41
|
+
new_version=''
|
|
42
|
+
|
|
43
|
+
update_version(){
|
|
44
|
+
old_version=`cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]'`
|
|
45
|
+
echo -e "$c**** Old version is $g$old_version$c ****$c0"
|
|
46
|
+
version_split=( ${old_version//./ } )
|
|
47
|
+
major=${version_split[0]:-0}
|
|
48
|
+
minor=${version_split[1]:-0}
|
|
49
|
+
patch=${version_split[2]:-0}
|
|
50
|
+
let "patch=patch+1"
|
|
51
|
+
new_version="${major}.${minor}.${patch}"
|
|
52
|
+
|
|
53
|
+
repo=`cat package.json | grep name | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]'`
|
|
54
|
+
echo -e "$c**** Bumping version of $g$repo$c: $y$old_version$c -> $g$new_version$c ****$c0"
|
|
55
|
+
sed -i -e "0,/$old_version/s/$old_version/$new_version/" package.json
|
|
56
|
+
# Update the dependency version in cli-template/package.json: "fa-mcp-sdk": "^<new_version>"
|
|
57
|
+
# Version match is built on a regular expression that allows any current version (with an optional ^)
|
|
58
|
+
sed -i -E "s/(\"fa-mcp-sdk\":\s*\")\^?[^\"]+(\"[,\r\n\s]*)/\1^${new_version}\2/" cli-template/package.json
|
|
59
|
+
echo -e "$g"
|
|
60
|
+
npm version 2>&1 | head -2 | tail -1
|
|
61
|
+
echo -e "$c0"
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
update_version
|
|
66
|
+
exit_on_error
|
|
67
|
+
|
|
68
|
+
git add --all
|
|
69
|
+
exit_on_error
|
|
70
|
+
|
|
71
|
+
git commit --no-verify -m "$new_version"
|
|
72
|
+
exit_on_error
|
|
73
|
+
|
|
74
|
+
git push origin refs/heads/${expected_branch}:${expected_branch}
|
|
75
|
+
exit_on_error
|
|
76
|
+
# npm pack --dry-run
|
|
77
|
+
npm publish
|
|
78
|
+
read -p "Press any key to resume ..."
|