fa-mcp-sdk 0.4.30 → 0.4.33
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* text=auto eol=lf
|
package/cli-template/CLAUDE.md
CHANGED
|
@@ -10,26 +10,26 @@ An MCP (Model Context Protocol) server built on the `fa-mcp-sdk` framework. It e
|
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
12
|
# Build & run
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
yarn build # tsc
|
|
14
|
+
yarn cb # clean dist/ + build
|
|
15
|
+
yarn start # node dist/src/start.js (HTTP mode)
|
|
16
16
|
node dist/src/start.js stdio # STDIO mode (Claude Desktop)
|
|
17
17
|
|
|
18
18
|
# Lint & typecheck
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
yarn lint # eslint
|
|
20
|
+
yarn lint:fix # eslint --fix
|
|
21
|
+
yarn typecheck # tsc --noEmit
|
|
22
22
|
|
|
23
23
|
# Tests
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
yarn test # jest (all tests)
|
|
25
|
+
yarn test:mcp # STDIO transport tests
|
|
26
|
+
yarn test:mcp-http # HTTP transport tests
|
|
27
|
+
yarn test:mcp-sse # SSE transport tests
|
|
28
28
|
npx jest tests/path/to/file.test.ts # single test file
|
|
29
29
|
|
|
30
30
|
# Utilities
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
yarn check-llm # Validate OpenAI API key for Agent Tester
|
|
32
|
+
yarn generate-token # JWT token generator UI
|
|
33
33
|
|
|
34
34
|
# JWT token generation (CLI)
|
|
35
35
|
node scripts/generate-jwt.js -u <username> -ttl <duration> [-s <service>] [-p <params>]
|
|
@@ -39,7 +39,7 @@ node scripts/generate-jwt.js -u <username> -ttl <duration> [-s <service>] [-p <p
|
|
|
39
39
|
# JWT generation API (HTTP endpoint, requires webServer.genJwtApiEnable: true)
|
|
40
40
|
# POST /gen-jwt {"username":"user","ttl":"30d","service":"svc","params":"key=val"}
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
yarn consul:unreg # deregister from Consul
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
## JWT Token Generation (Skill /gen-jwt)
|
|
@@ -47,7 +47,7 @@ npm run consul:unreg # deregister from Consul
|
|
|
47
47
|
Generate JWT tokens for MCP server authentication using the `/gen-jwt` skill.
|
|
48
48
|
Triggers: user asks to generate/create a JWT token, mentions "jwt", "token for user", "токен для", "сгенерируй токен для".
|
|
49
49
|
|
|
50
|
-
**Start/stop the server**: `
|
|
50
|
+
**Start/stop the server**: `yarn build && yarn start`. Stop with Ctrl+C. Port is in `config/default.yaml` → `webServer.port`. Force stop: `node scripts/kill-port.js <port>`.
|
|
51
51
|
|
|
52
52
|
**Server endpoints** (HTTP mode): `/mcp/*` (MCP protocol), `/docs` (Swagger UI), `/admin` (token generator), `/health`, `/agent-tester` (chat UI for testing tools).
|
|
53
53
|
|
|
@@ -119,6 +119,7 @@ Detailed fa-mcp-sdk docs are in `FA-MCP-SDK-DOC/`:
|
|
|
119
119
|
| `02-2-prompts-and-resources.md` | Prompts, resources, `ITransportContext` |
|
|
120
120
|
| `03-configuration.md` | `appConfig`, YAML config, DB, cache |
|
|
121
121
|
| `04-authentication.md` | JWT, Basic auth, permanent tokens |
|
|
122
|
+
| `05-ad-authorization.md` | AD group authorization, AD config |
|
|
122
123
|
| `06-utilities.md` | Error handling, logging, Consul |
|
|
123
124
|
| `07-testing-and-operations.md` | Test clients (STDIO, HTTP, SSE, Streamable HTTP) |
|
|
124
125
|
| `08-agent-tester-and-headless-api.md` | Agent Tester, Headless API, structured logging, automated testing |
|
|
@@ -145,7 +146,7 @@ agentTester:
|
|
|
145
146
|
apiKey: sk-...
|
|
146
147
|
```
|
|
147
148
|
|
|
148
|
-
**IMPORTANT for Claude Code**: When the development prompt or instructions mention testing with Headless API or Agent Tester, run `
|
|
149
|
+
**IMPORTANT for Claude Code**: When the development prompt or instructions mention testing with Headless API or Agent Tester, run `yarn check-llm` before starting any Agent Tester work. This script validates that the OpenAI API key is configured and functional. If it fails (exit code 1 = key missing, exit code 2 = key invalid or API error), inform the user about the issue and ask them to fix the configuration before proceeding with Agent Tester tests. See `08-agent-tester-and-headless-api.md` → "LLM Availability Check" for details.
|
|
149
150
|
|
|
150
151
|
**Disabled state**: If `agentTester.enabled` is `false`, the server returns HTTP 404 on any `/agent-tester/*` request (including the Headless API). When you receive this 404 response, do **NOT** enable Agent Tester yourself — only inform the developer that Agent Tester may be disabled, and that it can be enabled via `agentTester.enabled: true` in `config/local.yaml` or ENV `AGENT_TESTER_ENABLED=true`. The developer decides whether to enable it. However, if the developer's prompt or instructions explicitly state that you should not mention Agent Tester enablement, respect that and do not bring it up.
|
|
151
152
|
|
|
@@ -205,9 +206,9 @@ What to cover in test cases:
|
|
|
205
206
|
|
|
206
207
|
Run tests per transport:
|
|
207
208
|
```bash
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
209
|
+
yarn test:mcp # STDIO
|
|
210
|
+
yarn test:mcp-http # HTTP
|
|
211
|
+
yarn test:mcp-sse # SSE
|
|
211
212
|
```
|
|
212
213
|
|
|
213
214
|
→ See `07-testing-and-operations.md`.
|
|
@@ -215,13 +216,13 @@ npm run test:mcp-sse # SSE
|
|
|
215
216
|
#### Step 5: Build, Lint, Verify
|
|
216
217
|
|
|
217
218
|
```bash
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
219
|
+
yarn cb # Clean build — fix all compilation errors
|
|
220
|
+
yarn lint:fix # ESLint — fix all lint errors
|
|
221
|
+
yarn typecheck # tsc --noEmit — fix all type errors
|
|
222
|
+
yarn start # Start server — verify clean startup, no runtime errors
|
|
223
|
+
yarn test:mcp # STDIO transport tests
|
|
224
|
+
yarn test:mcp-http # HTTP transport tests
|
|
225
|
+
yarn test:mcp-sse # SSE transport tests
|
|
225
226
|
```
|
|
226
227
|
|
|
227
228
|
**Goal**: zero build errors, zero lint errors, zero type errors, clean server startup, all tests green.
|
|
@@ -237,7 +238,7 @@ Use `gpt-5.2` as the model in Agent Tester — it provides the best balance of t
|
|
|
237
238
|
- **Handler logic** — if tool results confuse the LLM or lack needed information
|
|
238
239
|
- **Error messages** — if failures produce unhelpful agent responses
|
|
239
240
|
|
|
240
|
-
Each iteration: observe → diagnose root cause → fix → `
|
|
241
|
+
Each iteration: observe → diagnose root cause → fix → `yarn cb && yarn start` → re-test.
|
|
241
242
|
|
|
242
243
|
#### Step 7: Development Report
|
|
243
244
|
|
|
@@ -256,7 +257,7 @@ When all tools are implemented, tests pass, and agent testing is complete, creat
|
|
|
256
257
|
Direct HTTP calls — no browser needed. Provides structured trace data.
|
|
257
258
|
|
|
258
259
|
```
|
|
259
|
-
1.
|
|
260
|
+
1. yarn cb && yarn start
|
|
260
261
|
2. GET /agent-tester/api/mcp/status → verify tools loaded
|
|
261
262
|
3. POST /agent-tester/api/chat/test → send message, get response + trace
|
|
262
263
|
4. Analyze trace: correct tool? correct args? expected result?
|
|
@@ -269,7 +270,7 @@ Query params: `?verbose=true` (LLM details per turn), `?maxResultChars=8000`, `?
|
|
|
269
270
|
|
|
270
271
|
**Prompt control in headless requests.** The `agentPrompt` field sets the system prompt sent to the LLM — when provided, it **replaces** the MCP server's built-in `agent_prompt`. Use it to iterate on prompt variations: read the current `AGENT_PROMPT` from `src/prompts/agent-prompt.ts`, send modified versions via `agentPrompt`, evaluate responses, and write the best variant back. The `customPrompt` field appends additional instructions. The trace response includes `system_prompt_sent` — the exact prompt the LLM received. → See `08-agent-tester-and-headless-api.md` for full prompt assembly logic and examples.
|
|
271
272
|
|
|
272
|
-
Structured JSON logging: `
|
|
273
|
+
Structured JSON logging: `yarn start --log-json` or `AGENT_TESTER_LOG_JSON=true yarn start` — emits per-event JSON on stdout.
|
|
273
274
|
|
|
274
275
|
### Playwright Testing (Fallback — UI Only)
|
|
275
276
|
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"check-llm": "node node_modules/fa-mcp-sdk/dist/core/agent-tester/check-llm.js",
|
|
28
28
|
"consul:unreg": "node node_modules/fa-mcp-sdk/dist/core/consul/deregister.js",
|
|
29
29
|
"test": "jest",
|
|
30
|
-
"test:mcp": "node
|
|
30
|
+
"test:mcp": "node tests/mcp/test-stdio.js",
|
|
31
31
|
"test:mcp-http": "node tests/mcp/test-http.js",
|
|
32
32
|
"test:mcp-sse": "node tests/mcp/test-sse.js",
|
|
33
33
|
"test:mcp-stdio": "node tests/mcp/test-stdio.js"
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
52
52
|
"dotenv": "^17.4.1",
|
|
53
|
-
"fa-mcp-sdk": "^0.4.
|
|
53
|
+
"fa-mcp-sdk": "^0.4.33"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/express": "^5.0.6",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fa-mcp-sdk",
|
|
3
3
|
"productName": "FA MCP SDK",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.33",
|
|
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",
|