fa-mcp-sdk 0.4.76 → 0.4.77
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 +319 -314
- package/bin/fa-mcp.js +85 -68
- package/cli-template/.claude/agents/javascript-pro.md +276 -276
- package/cli-template/.claude/settings.json +50 -50
- package/cli-template/.claude/skills/upgrade-guide/SKILL.md +2 -1
- package/cli-template/.oxfmtrc.json +41 -0
- package/cli-template/.oxlintrc.json +120 -0
- package/cli-template/CLAUDE.md +358 -355
- package/cli-template/FA-MCP-SDK-DOC/00-FA-MCP-SDK-index.md +132 -132
- package/cli-template/FA-MCP-SDK-DOC/01-getting-started.md +146 -146
- package/cli-template/FA-MCP-SDK-DOC/02-1-tools-and-api.md +431 -431
- package/cli-template/FA-MCP-SDK-DOC/02-2-prompts-and-resources.md +201 -201
- package/cli-template/FA-MCP-SDK-DOC/03-configuration.md +384 -384
- package/cli-template/FA-MCP-SDK-DOC/04-authentication.md +412 -412
- package/cli-template/FA-MCP-SDK-DOC/05-ad-authorization.md +196 -196
- package/cli-template/FA-MCP-SDK-DOC/06-utilities.md +163 -163
- package/cli-template/FA-MCP-SDK-DOC/07-testing-and-operations.md +127 -127
- package/cli-template/jest.config.js +27 -30
- package/cli-template/package.json +10 -5
- package/cli-template/prompt-example-new-MCP.md +101 -101
- package/cli-template/readme-docs/SKILLS.md +1 -1
- package/cli-template/tsconfig.json +58 -58
- package/cli-template/update.cjs +41 -38
- package/config/custom-environment-variables.yaml +63 -63
- package/config/development.yaml +4 -4
- package/config/production.yaml +4 -4
- package/config/test.yaml +26 -26
- package/dist/core/_types_/TNtlm.d.ts.map +1 -1
- package/dist/core/_types_/active-directory-config.d.ts.map +1 -1
- package/dist/core/_types_/config.d.ts.map +1 -1
- package/dist/core/_types_/types.d.ts.map +1 -1
- package/dist/core/ad/group-checker.d.ts.map +1 -1
- package/dist/core/ad/group-checker.js.map +1 -1
- package/dist/core/agent-tester/agent-tester-router.d.ts.map +1 -1
- package/dist/core/agent-tester/agent-tester-router.js +6 -6
- package/dist/core/agent-tester/agent-tester-router.js.map +1 -1
- package/dist/core/agent-tester/check-llm.d.ts.map +1 -1
- package/dist/core/agent-tester/check-llm.js.map +1 -1
- package/dist/core/agent-tester/services/SummaryMemory.d.ts.map +1 -1
- package/dist/core/agent-tester/services/SummaryMemory.js +3 -9
- package/dist/core/agent-tester/services/SummaryMemory.js.map +1 -1
- package/dist/core/agent-tester/services/TesterAgentService.d.ts.map +1 -1
- package/dist/core/agent-tester/services/TesterAgentService.js +25 -27
- package/dist/core/agent-tester/services/TesterAgentService.js.map +1 -1
- package/dist/core/agent-tester/services/TesterMcpClientService.d.ts.map +1 -1
- package/dist/core/agent-tester/services/TesterMcpClientService.js +26 -25
- package/dist/core/agent-tester/services/TesterMcpClientService.js.map +1 -1
- package/dist/core/auth/admin-auth.d.ts.map +1 -1
- package/dist/core/auth/admin-auth.js +5 -5
- package/dist/core/auth/admin-auth.js.map +1 -1
- package/dist/core/auth/agent-tester-auth.d.ts.map +1 -1
- package/dist/core/auth/agent-tester-auth.js +1 -6
- package/dist/core/auth/agent-tester-auth.js.map +1 -1
- package/dist/core/auth/basic.d.ts.map +1 -1
- package/dist/core/auth/basic.js.map +1 -1
- package/dist/core/auth/ip-check.d.ts.map +1 -1
- package/dist/core/auth/ip-check.js +1 -1
- package/dist/core/auth/ip-check.js.map +1 -1
- package/dist/core/auth/jwt.d.ts.map +1 -1
- package/dist/core/auth/jwt.js +1 -1
- package/dist/core/auth/jwt.js.map +1 -1
- package/dist/core/auth/middleware.d.ts.map +1 -1
- package/dist/core/auth/middleware.js +9 -6
- 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 +6 -6
- package/dist/core/auth/multi-auth.js.map +1 -1
- package/dist/core/auth/revocation.d.ts.map +1 -1
- package/dist/core/auth/revocation.js +2 -6
- package/dist/core/auth/revocation.js.map +1 -1
- package/dist/core/auth/token-generator/ntlm/ntlm-auth-options.d.ts.map +1 -1
- package/dist/core/auth/token-generator/ntlm/ntlm-auth-options.js +2 -2
- package/dist/core/auth/token-generator/ntlm/ntlm-auth-options.js.map +1 -1
- package/dist/core/auth/token-generator/ntlm/ntlm-domain-config.js +1 -1
- package/dist/core/auth/token-generator/ntlm/ntlm-domain-config.js.map +1 -1
- package/dist/core/auth/token-generator/ntlm/ntlm-integration.d.ts.map +1 -1
- package/dist/core/auth/token-generator/ntlm/ntlm-integration.js +4 -2
- package/dist/core/auth/token-generator/ntlm/ntlm-integration.js.map +1 -1
- package/dist/core/auth/token-generator/server.d.ts.map +1 -1
- package/dist/core/auth/token-generator/server.js.map +1 -1
- package/dist/core/bootstrap/init-config.d.ts.map +1 -1
- package/dist/core/bootstrap/init-config.js +2 -2
- package/dist/core/bootstrap/init-config.js.map +1 -1
- package/dist/core/bootstrap/startup-info.d.ts.map +1 -1
- package/dist/core/bootstrap/startup-info.js +3 -7
- package/dist/core/bootstrap/startup-info.js.map +1 -1
- package/dist/core/cache/cache.d.ts.map +1 -1
- package/dist/core/cache/cache.js +2 -2
- package/dist/core/cache/cache.js.map +1 -1
- package/dist/core/consul/deregister.d.ts.map +1 -1
- package/dist/core/consul/deregister.js.map +1 -1
- package/dist/core/consul/get-consul-api.d.ts.map +1 -1
- package/dist/core/consul/get-consul-api.js +1 -2
- package/dist/core/consul/get-consul-api.js.map +1 -1
- package/dist/core/db/pg-db.d.ts.map +1 -1
- package/dist/core/db/pg-db.js +3 -3
- package/dist/core/db/pg-db.js.map +1 -1
- package/dist/core/debug.d.ts.map +1 -1
- package/dist/core/debug.js.map +1 -1
- package/dist/core/errors/BaseMcpError.d.ts.map +1 -1
- package/dist/core/errors/BaseMcpError.js.map +1 -1
- package/dist/core/errors/ValidationError.d.ts.map +1 -1
- package/dist/core/errors/ValidationError.js.map +1 -1
- package/dist/core/errors/errors.d.ts.map +1 -1
- package/dist/core/errors/errors.js +1 -1
- package/dist/core/errors/errors.js.map +1 -1
- package/dist/core/index.d.ts +6 -6
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +5 -5
- package/dist/core/index.js.map +1 -1
- package/dist/core/init-mcp-server.d.ts.map +1 -1
- package/dist/core/init-mcp-server.js.map +1 -1
- package/dist/core/logger.d.ts.map +1 -1
- package/dist/core/logger.js +1 -1
- package/dist/core/logger.js.map +1 -1
- package/dist/core/mcp/create-mcp-server.d.ts.map +1 -1
- package/dist/core/mcp/create-mcp-server.js +1 -1
- package/dist/core/mcp/create-mcp-server.js.map +1 -1
- package/dist/core/mcp/prompts.d.ts.map +1 -1
- package/dist/core/mcp/prompts.js.map +1 -1
- package/dist/core/mcp/readme-assembler.d.ts.map +1 -1
- package/dist/core/mcp/readme-assembler.js +3 -1
- package/dist/core/mcp/readme-assembler.js.map +1 -1
- package/dist/core/mcp/resources.d.ts.map +1 -1
- package/dist/core/mcp/resources.js.map +1 -1
- package/dist/core/mcp/server-stdio.d.ts.map +1 -1
- package/dist/core/utils/formatToolResult.d.ts.map +1 -1
- package/dist/core/utils/formatToolResult.js.map +1 -1
- package/dist/core/utils/port-checker.d.ts.map +1 -1
- package/dist/core/utils/port-checker.js.map +1 -1
- package/dist/core/utils/rate-limit.d.ts.map +1 -1
- package/dist/core/utils/rate-limit.js +2 -8
- package/dist/core/utils/rate-limit.js.map +1 -1
- package/dist/core/utils/testing/BaseMcpClient.d.ts.map +1 -1
- package/dist/core/utils/testing/BaseMcpClient.js.map +1 -1
- package/dist/core/utils/testing/McpHttpClient.d.ts.map +1 -1
- package/dist/core/utils/testing/McpHttpClient.js +2 -2
- package/dist/core/utils/testing/McpHttpClient.js.map +1 -1
- package/dist/core/utils/testing/McpSseClient.d.ts.map +1 -1
- package/dist/core/utils/testing/McpSseClient.js +3 -8
- package/dist/core/utils/testing/McpSseClient.js.map +1 -1
- package/dist/core/utils/testing/McpStdioClient.d.ts.map +1 -1
- package/dist/core/utils/testing/McpStdioClient.js.map +1 -1
- package/dist/core/utils/testing/McpStreamableHttpClient.d.ts.map +1 -1
- package/dist/core/utils/testing/McpStreamableHttpClient.js +7 -8
- package/dist/core/utils/testing/McpStreamableHttpClient.js.map +1 -1
- package/dist/core/utils/utils.d.ts.map +1 -1
- package/dist/core/utils/utils.js +3 -5
- package/dist/core/utils/utils.js.map +1 -1
- package/dist/core/web/admin-router.d.ts.map +1 -1
- package/dist/core/web/admin-router.js +3 -3
- package/dist/core/web/admin-router.js.map +1 -1
- package/dist/core/web/cors.d.ts.map +1 -1
- package/dist/core/web/cors.js.map +1 -1
- package/dist/core/web/favicon-svg.d.ts.map +1 -1
- package/dist/core/web/favicon-svg.js +1 -5
- package/dist/core/web/favicon-svg.js.map +1 -1
- package/dist/core/web/home-api.d.ts.map +1 -1
- package/dist/core/web/home-api.js +7 -8
- package/dist/core/web/home-api.js.map +1 -1
- package/dist/core/web/openapi.d.ts.map +1 -1
- package/dist/core/web/openapi.js +1 -3
- package/dist/core/web/openapi.js.map +1 -1
- package/dist/core/web/server-http.d.ts.map +1 -1
- package/dist/core/web/server-http.js +4 -4
- package/dist/core/web/server-http.js.map +1 -1
- package/dist/core/web/static/agent-tester/index.html +323 -323
- package/dist/core/web/static/agent-tester/script.js +311 -200
- package/dist/core/web/static/agent-tester/styles.css +1840 -1840
- package/dist/core/web/static/home/index.html +220 -220
- package/dist/core/web/static/home/script.js +72 -43
- package/dist/core/web/static/styles.css +927 -927
- package/dist/core/web/static/token-gen/index.html +136 -136
- package/dist/core/web/static/token-gen/script.js +58 -56
- package/dist/core/web/svg-icons.d.ts.map +1 -1
- package/dist/core/web/svg-icons.js +1 -5
- package/dist/core/web/svg-icons.js.map +1 -1
- package/package.json +10 -5
- package/{cli-template/.claude/hooks/eslint-fix.cjs → scripts/cc-hook-oxlint-oxfmt-fix.cjs} +109 -100
- package/scripts/generate-jwt.js +5 -9
- package/scripts/kill-port.js +5 -2
- package/scripts/npm/run.js +1 -2
- package/scripts/remove-nul.js +1 -1
- package/scripts/update-sdk.js +36 -14
- package/src/template/api/router.ts +3 -3
- package/src/template/prompts/agent-brief.ts +0 -1
- package/src/template/start.ts +3 -8
- package/src/template/tools/handle-tool-call.ts +3 -3
- package/src/template/tools/tools.ts +3 -7
- package/src/tests/jest-simple-reporter.js +1 -1
- package/src/tests/mcp/sse/mcp-sse-client-handling.md +111 -111
- package/src/tests/mcp/sse/test-sse-npm-package.js +2 -3
- package/src/tests/mcp/test-cases.js +6 -7
- package/src/tests/mcp/test-http.js +2 -2
- package/src/tests/mcp/test-sse.js +9 -7
- package/src/tests/mcp/test-stdio.js +12 -8
- package/src/tests/utils.ts +4 -3
- package/cli-template/eslint.config.js +0 -27
package/README.md
CHANGED
|
@@ -1,314 +1,319 @@
|
|
|
1
|
-
# MCP Server Template Generator
|
|
2
|
-
|
|
3
|
-
Production-ready core framework for building MCP (Model Context Protocol) servers with comprehensive
|
|
4
|
-
infrastructure support.
|
|
5
|
-
|
|
6
|
-
CLI utility that creates ready-to-use MCP (Model Context Protocol) server projects from the official template.
|
|
7
|
-
|
|
8
|
-
## Overview
|
|
9
|
-
|
|
10
|
-
This framework provides complete infrastructure for building enterprise-grade MCP servers:
|
|
11
|
-
|
|
12
|
-
- **Dual Transport**: STDIO (Claude Desktop) and HTTP/SSE (web clients)
|
|
13
|
-
- **Agent-Driven Tool Development**: Built-in AI agent system (Agent Tester) for iterative refinement of MCP tools through automated testing cycles — the agent calls your tools, you observe behavior, adjust descriptions/parameters/prompts, and re-test
|
|
14
|
-
- **Headless Test API**: Direct HTTP endpoint (`POST /agent-tester/api/chat/test`) returns structured trace of every tool call, argument, result, and LLM decision — enabling CLI-based automated testing without a browser
|
|
15
|
-
- **Authentication**: JWT (with optional IP restriction), Basic auth, permanent tokens, custom validators
|
|
16
|
-
- **Database Integration**: PostgreSQL with pgvector for vector operations
|
|
17
|
-
- **Service Discovery**: Consul integration for microservices
|
|
18
|
-
- **Rate Limiting**: Configurable rate limiting for all endpoints
|
|
19
|
-
- **API Documentation**: Automatic Swagger/OpenAPI generation
|
|
20
|
-
- **Production Logging**: Structured logging with data masking
|
|
21
|
-
- **Configuration Management**: YAML-based with environment overrides
|
|
22
|
-
- **Deployment Ready**: PM2 scripts, Nginx templates, ESLint, Jest testing
|
|
23
|
-
|
|
24
|
-
The framework uses dependency injection to keep the core completely agnostic of project-specific implementations.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
## Steps to Get Started
|
|
28
|
-
|
|
29
|
-
1) Install `fa-mcp-sdk` globally:
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
npm install -g fa-mcp-sdk
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
2) Run the CLI, specify the target directory, and follow the interactive prompts:
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
fa-mcp
|
|
39
|
-
```
|
|
40
|
-
Or using configuration file:
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
fa-mcp config.yaml
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
3) Launching the template MCP server:
|
|
47
|
-
- Navigate to the target directory: `cd <targetPath>`
|
|
48
|
-
- Install dependencies: `npm install`
|
|
49
|
-
- Build the project: `npm run build`
|
|
50
|
-
- Start the server: `npm start`
|
|
51
|
-
|
|
52
|
-
4) Vibe-coding your MCP server logic:
|
|
53
|
-
- Create an instruction file (prompt) for your preferred AI coding assistant.
|
|
54
|
-
`fa-mcp-sdk` comes ready for use with `Claude Code`.
|
|
55
|
-
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`.
|
|
56
|
-
- Launch your AI coder and provide it with the instructions to build your new MCP server.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
## Configuration
|
|
61
|
-
|
|
62
|
-
The CLI collects required and optional parameters through interactive prompts or configuration file.
|
|
63
|
-
|
|
64
|
-
### Required Parameters
|
|
65
|
-
|
|
66
|
-
| Parameter | Description | Example |
|
|
67
|
-
|-----------------------|-------------|---------|
|
|
68
|
-
| `project.name` | Package.json name and MCP server identification | `"my-mcp-server"` |
|
|
69
|
-
| `project.description` | Package.json description | `"A custom MCP server"` |
|
|
70
|
-
| `project.productName` | Display name for UI and documentation | `"My MCP Server"` |
|
|
71
|
-
| `port` | Web server port for HTTP and MCP protocol | `"3000"` |
|
|
72
|
-
|
|
73
|
-
### Optional Parameters
|
|
74
|
-
|
|
75
|
-
| Parameter | Description | Default |
|
|
76
|
-
|-------------------------------------|-------------|---------|
|
|
77
|
-
| `author.name` | Package.json author name | `""` |
|
|
78
|
-
| `author.email` | Package.json author email | `""` |
|
|
79
|
-
| `git-base-url` | Git repository base URL | `"github.com/username"` |
|
|
80
|
-
| `consul.service.enable` | Enable Consul service registration | `"false"` |
|
|
81
|
-
| `consul.agent.reg.token` | Token for registering service with Consul | `"***"` |
|
|
82
|
-
| `consul.envCode.dev` | Development environment code | `"<envCode.dev>"` |
|
|
83
|
-
| `consul.envCode.prod` | Production environment code | `"<envCode.prod>"` |
|
|
84
|
-
| `consul.agent.dev.dc` | Development Consul datacenter | `""` |
|
|
85
|
-
| `consul.agent.dev.host` | Development Consul UI host | `"consul.my.ui"` |
|
|
86
|
-
| `consul.agent.dev.token` | Development Consul access token | `"***"` |
|
|
87
|
-
| `consul.agent.prd.dc` | Production Consul datacenter | `""` |
|
|
88
|
-
| `consul.agent.prd.host` | Production Consul UI host | `"consul.my.ui"` |
|
|
89
|
-
| `consul.agent.prd.token` | Production Consul access token | `"***"` |
|
|
90
|
-
| `mcp.domain` | Domain name for nginx configuration | `""` |
|
|
91
|
-
| `ssl-wildcard.conf.rel.path` | Relative path to SSL config in /etc/nginx | `"snippets/ssl-wildcard.conf"` |
|
|
92
|
-
| `webServer.auth.enabled` | Enable token authorization | `"false"` |
|
|
93
|
-
| `webServer.auth.token.checkMCPName` | Check MCP name in token | `"false"` |
|
|
94
|
-
| `isProduction` | Production mode flag | `"false"` |
|
|
95
|
-
| `SERVICE_INSTANCE` | Service name suffix for Consul and PM2 | `""` |
|
|
96
|
-
| `maintainerUrl` | Support/maintainer URL | `""` |
|
|
97
|
-
| `logger.useFileLogger` | Enable file logging | `""` |
|
|
98
|
-
|
|
99
|
-
### Configuration File Examples
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
Link: [YAML Example with detailed comments](https://github.com/Bazilio-san/fa-mcp-sdk/blob/master/cli-config.example.yaml)
|
|
103
|
-
|
|
104
|
-
The utility supports both **JSON** and **YAML** configuration formats.
|
|
105
|
-
Use either `.json`, `.yaml`, or `.yml` file extensions.
|
|
106
|
-
|
|
107
|
-
#### Usage:
|
|
108
|
-
|
|
109
|
-
```bash
|
|
110
|
-
# Interactive setup (will prompt for all parameters)
|
|
111
|
-
fa-mcp
|
|
112
|
-
|
|
113
|
-
# Using JSON configuration
|
|
114
|
-
fa-mcp config.json
|
|
115
|
-
fa-mcp --config=my-config.json
|
|
116
|
-
|
|
117
|
-
# Using YAML configuration (NEW!)
|
|
118
|
-
fa-mcp config.yaml
|
|
119
|
-
fa-mcp --config=my-config.yml
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
## Project Structure
|
|
125
|
-
|
|
126
|
-
```
|
|
127
|
-
my-mcp-server/
|
|
128
|
-
├── .claude/ # Settings, Agents, Hooks for Claude Code
|
|
129
|
-
│ ├── agents/ # Folder with Claude Code agents. Including the agent fa-mcp-sdk
|
|
130
|
-
│ ├── hooks/ # Code formatting hook after changes made by Claude Code
|
|
131
|
-
│ └── settings.json # Claude Code settings
|
|
132
|
-
├── .run/ # JetBrains IDE run configurations
|
|
133
|
-
├── config/ # Environment configurations
|
|
134
|
-
│ ├── _local.yaml # Local configuration template
|
|
135
|
-
│ ├── custom-environment-variables.yaml # Environment mapping
|
|
136
|
-
│ ├── default.yaml # Base configuration
|
|
137
|
-
│ ├── development.yaml # Development settings
|
|
138
|
-
│ ├── local.yaml # Local configuration
|
|
139
|
-
│ ├── production.yaml # Production settings
|
|
140
|
-
│ └── test.yaml # Test environment
|
|
141
|
-
├── deploy/ # Deployment configurations
|
|
142
|
-
│ ├── .gitkeep # Git directory keeper
|
|
143
|
-
│ ├── NGINX/ # Nginx configuration templates
|
|
144
|
-
│ │ ├── sites-enabled/ # Nginx site configurations
|
|
145
|
-
│ │ └── snippets/ # Nginx configuration snippets
|
|
146
|
-
│ ├── config.example.yml # Deployment config example
|
|
147
|
-
│ ├── pm2.config.js # PM2 process manager config
|
|
148
|
-
│ ├── pm2reg.sh # PM2 registration script
|
|
149
|
-
│ ├── srv.cjs # Server management script
|
|
150
|
-
│ └── srv.sh.readme.md # Server script documentation
|
|
151
|
-
├── FA-MCP-SDK-DOC/ # FA-MCP-SDK Documentation
|
|
152
|
-
├── scripts/ # Utility scripts
|
|
153
|
-
│ ├── npm/ # NPM utility scripts
|
|
154
|
-
│ ├── generate-jwt.js # CLI JWT token generator
|
|
155
|
-
│ ├── kill-port.js # Port cleanup utility
|
|
156
|
-
│ ├── pre-commit # Git pre-commit hook
|
|
157
|
-
│ └── remove-nul.js # File cleanup utility
|
|
158
|
-
├── src/ # Source code
|
|
159
|
-
│ ├── _types_/ # TypeScript type definitions
|
|
160
|
-
│ ├── api/ # REST API routes
|
|
161
|
-
│ │ └── router.ts # Express router
|
|
162
|
-
│ ├── asset/ # Static assets
|
|
163
|
-
│ │ └── logo.svg # Application logo/favicon
|
|
164
|
-
│ ├── prompts/ # Agent prompts
|
|
165
|
-
│ │ ├── agent-brief.ts # Agent brief
|
|
166
|
-
│ │ ├── agent-prompt.ts # Main agent prompt
|
|
167
|
-
│ │ └── custom-prompts.ts # Custom prompts
|
|
168
|
-
│ ├── tools/ # MCP tool implementations
|
|
169
|
-
│ │ ├── handle-tool-call.ts # Tool execution handler
|
|
170
|
-
│ │ └── tools.ts # Tool definitions
|
|
171
|
-
│ ├── custom-resources.ts # Custom MCP resources
|
|
172
|
-
│ └── start.ts # Application entry point
|
|
173
|
-
├── swagger/
|
|
174
|
-
│ └── openapi.yaml # API description. Generated if none
|
|
175
|
-
├── tests/ # Test suites
|
|
176
|
-
│ ├── mcp/ # MCP protocol tests
|
|
177
|
-
│ ├── jest-simple-reporter.js # Custom Jest reporter
|
|
178
|
-
│ └── utils.ts # Test utilities
|
|
179
|
-
├── .editorconfig # Editor configuration
|
|
180
|
-
├── .env # Environment variables
|
|
181
|
-
├── .env.example # Environment variables template
|
|
182
|
-
├── .envrc # direnv configuration
|
|
183
|
-
├── .gitignore # Git ignore rules
|
|
184
|
-
├──
|
|
185
|
-
├──
|
|
186
|
-
├──
|
|
187
|
-
├──
|
|
188
|
-
├──
|
|
189
|
-
├──
|
|
190
|
-
├──
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
| `npm
|
|
202
|
-
| `npm run
|
|
203
|
-
| `npm run
|
|
204
|
-
| `npm run
|
|
205
|
-
| `npm run
|
|
206
|
-
| `npm run lint
|
|
207
|
-
| `npm run
|
|
208
|
-
| `npm run
|
|
209
|
-
| `npm run
|
|
210
|
-
| `npm run
|
|
211
|
-
| `npm run
|
|
212
|
-
| `
|
|
213
|
-
|
|
|
214
|
-
|
|
|
215
|
-
| `npm run
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
`
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
/
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
.
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
1
|
+
# MCP Server Template Generator
|
|
2
|
+
|
|
3
|
+
Production-ready core framework for building MCP (Model Context Protocol) servers with comprehensive
|
|
4
|
+
infrastructure support.
|
|
5
|
+
|
|
6
|
+
CLI utility that creates ready-to-use MCP (Model Context Protocol) server projects from the official template.
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
This framework provides complete infrastructure for building enterprise-grade MCP servers:
|
|
11
|
+
|
|
12
|
+
- **Dual Transport**: STDIO (Claude Desktop) and HTTP/SSE (web clients)
|
|
13
|
+
- **Agent-Driven Tool Development**: Built-in AI agent system (Agent Tester) for iterative refinement of MCP tools through automated testing cycles — the agent calls your tools, you observe behavior, adjust descriptions/parameters/prompts, and re-test
|
|
14
|
+
- **Headless Test API**: Direct HTTP endpoint (`POST /agent-tester/api/chat/test`) returns structured trace of every tool call, argument, result, and LLM decision — enabling CLI-based automated testing without a browser
|
|
15
|
+
- **Authentication**: JWT (with optional IP restriction), Basic auth, permanent tokens, custom validators
|
|
16
|
+
- **Database Integration**: PostgreSQL with pgvector for vector operations
|
|
17
|
+
- **Service Discovery**: Consul integration for microservices
|
|
18
|
+
- **Rate Limiting**: Configurable rate limiting for all endpoints
|
|
19
|
+
- **API Documentation**: Automatic Swagger/OpenAPI generation
|
|
20
|
+
- **Production Logging**: Structured logging with data masking
|
|
21
|
+
- **Configuration Management**: YAML-based with environment overrides
|
|
22
|
+
- **Deployment Ready**: PM2 scripts, Nginx templates, ESLint, Jest testing
|
|
23
|
+
|
|
24
|
+
The framework uses dependency injection to keep the core completely agnostic of project-specific implementations.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
## Steps to Get Started
|
|
28
|
+
|
|
29
|
+
1) Install `fa-mcp-sdk` globally:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install -g fa-mcp-sdk
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
2) Run the CLI, specify the target directory, and follow the interactive prompts:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
fa-mcp
|
|
39
|
+
```
|
|
40
|
+
Or using configuration file:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
fa-mcp config.yaml
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
3) Launching the template MCP server:
|
|
47
|
+
- Navigate to the target directory: `cd <targetPath>`
|
|
48
|
+
- Install dependencies: `npm install`
|
|
49
|
+
- Build the project: `npm run build`
|
|
50
|
+
- Start the server: `npm start`
|
|
51
|
+
|
|
52
|
+
4) Vibe-coding your MCP server logic:
|
|
53
|
+
- Create an instruction file (prompt) for your preferred AI coding assistant.
|
|
54
|
+
`fa-mcp-sdk` comes ready for use with `Claude Code`.
|
|
55
|
+
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`.
|
|
56
|
+
- Launch your AI coder and provide it with the instructions to build your new MCP server.
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
## Configuration
|
|
61
|
+
|
|
62
|
+
The CLI collects required and optional parameters through interactive prompts or configuration file.
|
|
63
|
+
|
|
64
|
+
### Required Parameters
|
|
65
|
+
|
|
66
|
+
| Parameter | Description | Example |
|
|
67
|
+
|-----------------------|-------------|---------|
|
|
68
|
+
| `project.name` | Package.json name and MCP server identification | `"my-mcp-server"` |
|
|
69
|
+
| `project.description` | Package.json description | `"A custom MCP server"` |
|
|
70
|
+
| `project.productName` | Display name for UI and documentation | `"My MCP Server"` |
|
|
71
|
+
| `port` | Web server port for HTTP and MCP protocol | `"3000"` |
|
|
72
|
+
|
|
73
|
+
### Optional Parameters
|
|
74
|
+
|
|
75
|
+
| Parameter | Description | Default |
|
|
76
|
+
|-------------------------------------|-------------|---------|
|
|
77
|
+
| `author.name` | Package.json author name | `""` |
|
|
78
|
+
| `author.email` | Package.json author email | `""` |
|
|
79
|
+
| `git-base-url` | Git repository base URL | `"github.com/username"` |
|
|
80
|
+
| `consul.service.enable` | Enable Consul service registration | `"false"` |
|
|
81
|
+
| `consul.agent.reg.token` | Token for registering service with Consul | `"***"` |
|
|
82
|
+
| `consul.envCode.dev` | Development environment code | `"<envCode.dev>"` |
|
|
83
|
+
| `consul.envCode.prod` | Production environment code | `"<envCode.prod>"` |
|
|
84
|
+
| `consul.agent.dev.dc` | Development Consul datacenter | `""` |
|
|
85
|
+
| `consul.agent.dev.host` | Development Consul UI host | `"consul.my.ui"` |
|
|
86
|
+
| `consul.agent.dev.token` | Development Consul access token | `"***"` |
|
|
87
|
+
| `consul.agent.prd.dc` | Production Consul datacenter | `""` |
|
|
88
|
+
| `consul.agent.prd.host` | Production Consul UI host | `"consul.my.ui"` |
|
|
89
|
+
| `consul.agent.prd.token` | Production Consul access token | `"***"` |
|
|
90
|
+
| `mcp.domain` | Domain name for nginx configuration | `""` |
|
|
91
|
+
| `ssl-wildcard.conf.rel.path` | Relative path to SSL config in /etc/nginx | `"snippets/ssl-wildcard.conf"` |
|
|
92
|
+
| `webServer.auth.enabled` | Enable token authorization | `"false"` |
|
|
93
|
+
| `webServer.auth.token.checkMCPName` | Check MCP name in token | `"false"` |
|
|
94
|
+
| `isProduction` | Production mode flag | `"false"` |
|
|
95
|
+
| `SERVICE_INSTANCE` | Service name suffix for Consul and PM2 | `""` |
|
|
96
|
+
| `maintainerUrl` | Support/maintainer URL | `""` |
|
|
97
|
+
| `logger.useFileLogger` | Enable file logging | `""` |
|
|
98
|
+
|
|
99
|
+
### Configuration File Examples
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
Link: [YAML Example with detailed comments](https://github.com/Bazilio-san/fa-mcp-sdk/blob/master/cli-config.example.yaml)
|
|
103
|
+
|
|
104
|
+
The utility supports both **JSON** and **YAML** configuration formats.
|
|
105
|
+
Use either `.json`, `.yaml`, or `.yml` file extensions.
|
|
106
|
+
|
|
107
|
+
#### Usage:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# Interactive setup (will prompt for all parameters)
|
|
111
|
+
fa-mcp
|
|
112
|
+
|
|
113
|
+
# Using JSON configuration
|
|
114
|
+
fa-mcp config.json
|
|
115
|
+
fa-mcp --config=my-config.json
|
|
116
|
+
|
|
117
|
+
# Using YAML configuration (NEW!)
|
|
118
|
+
fa-mcp config.yaml
|
|
119
|
+
fa-mcp --config=my-config.yml
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
## Project Structure
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
my-mcp-server/
|
|
128
|
+
├── .claude/ # Settings, Agents, Hooks for Claude Code
|
|
129
|
+
│ ├── agents/ # Folder with Claude Code agents. Including the agent fa-mcp-sdk
|
|
130
|
+
│ ├── hooks/ # Code formatting hook after changes made by Claude Code
|
|
131
|
+
│ └── settings.json # Claude Code settings
|
|
132
|
+
├── .run/ # JetBrains IDE run configurations
|
|
133
|
+
├── config/ # Environment configurations
|
|
134
|
+
│ ├── _local.yaml # Local configuration template
|
|
135
|
+
│ ├── custom-environment-variables.yaml # Environment mapping
|
|
136
|
+
│ ├── default.yaml # Base configuration
|
|
137
|
+
│ ├── development.yaml # Development settings
|
|
138
|
+
│ ├── local.yaml # Local configuration
|
|
139
|
+
│ ├── production.yaml # Production settings
|
|
140
|
+
│ └── test.yaml # Test environment
|
|
141
|
+
├── deploy/ # Deployment configurations
|
|
142
|
+
│ ├── .gitkeep # Git directory keeper
|
|
143
|
+
│ ├── NGINX/ # Nginx configuration templates
|
|
144
|
+
│ │ ├── sites-enabled/ # Nginx site configurations
|
|
145
|
+
│ │ └── snippets/ # Nginx configuration snippets
|
|
146
|
+
│ ├── config.example.yml # Deployment config example
|
|
147
|
+
│ ├── pm2.config.js # PM2 process manager config
|
|
148
|
+
│ ├── pm2reg.sh # PM2 registration script
|
|
149
|
+
│ ├── srv.cjs # Server management script
|
|
150
|
+
│ └── srv.sh.readme.md # Server script documentation
|
|
151
|
+
├── FA-MCP-SDK-DOC/ # FA-MCP-SDK Documentation
|
|
152
|
+
├── scripts/ # Utility scripts
|
|
153
|
+
│ ├── npm/ # NPM utility scripts
|
|
154
|
+
│ ├── generate-jwt.js # CLI JWT token generator
|
|
155
|
+
│ ├── kill-port.js # Port cleanup utility
|
|
156
|
+
│ ├── pre-commit # Git pre-commit hook
|
|
157
|
+
│ └── remove-nul.js # File cleanup utility
|
|
158
|
+
├── src/ # Source code
|
|
159
|
+
│ ├── _types_/ # TypeScript type definitions
|
|
160
|
+
│ ├── api/ # REST API routes
|
|
161
|
+
│ │ └── router.ts # Express router
|
|
162
|
+
│ ├── asset/ # Static assets
|
|
163
|
+
│ │ └── logo.svg # Application logo/favicon
|
|
164
|
+
│ ├── prompts/ # Agent prompts
|
|
165
|
+
│ │ ├── agent-brief.ts # Agent brief
|
|
166
|
+
│ │ ├── agent-prompt.ts # Main agent prompt
|
|
167
|
+
│ │ └── custom-prompts.ts # Custom prompts
|
|
168
|
+
│ ├── tools/ # MCP tool implementations
|
|
169
|
+
│ │ ├── handle-tool-call.ts # Tool execution handler
|
|
170
|
+
│ │ └── tools.ts # Tool definitions
|
|
171
|
+
│ ├── custom-resources.ts # Custom MCP resources
|
|
172
|
+
│ └── start.ts # Application entry point
|
|
173
|
+
├── swagger/
|
|
174
|
+
│ └── openapi.yaml # API description. Generated if none
|
|
175
|
+
├── tests/ # Test suites
|
|
176
|
+
│ ├── mcp/ # MCP protocol tests
|
|
177
|
+
│ ├── jest-simple-reporter.js # Custom Jest reporter
|
|
178
|
+
│ └── utils.ts # Test utilities
|
|
179
|
+
├── .editorconfig # Editor configuration
|
|
180
|
+
├── .env # Environment variables
|
|
181
|
+
├── .env.example # Environment variables template
|
|
182
|
+
├── .envrc # direnv configuration
|
|
183
|
+
├── .gitignore # Git ignore rules
|
|
184
|
+
├── .oxlintrc.json # Oxlint configuration
|
|
185
|
+
├── .oxfmtrc.json # Oxfmt configuration
|
|
186
|
+
├── jest.config.js # Jest test configuration
|
|
187
|
+
├── LICENSE # MIT license file
|
|
188
|
+
├── package.json # NPM package configuration
|
|
189
|
+
├── prompt-example-new-MCP.md # Example of instructions for Claude Code for vibe coding of a custom MCP server
|
|
190
|
+
├── README.md
|
|
191
|
+
├── tsconfig.json # TypeScript configuration
|
|
192
|
+
└── update.cjs # Project update script
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Note: The `dist/` directory (compiled JavaScript) is created after running `npm run build`.
|
|
196
|
+
|
|
197
|
+
## Available Scripts
|
|
198
|
+
|
|
199
|
+
| Script | Description |
|
|
200
|
+
|--------|-------------|
|
|
201
|
+
| `npm start` | Start compiled MCP server |
|
|
202
|
+
| `npm run build` | Compile TypeScript |
|
|
203
|
+
| `npm run cb` | Clean and build |
|
|
204
|
+
| `npm run ci` | Install dependencies |
|
|
205
|
+
| `npm run reinstall` | Reinstall all dependencies |
|
|
206
|
+
| `npm run lint` | Run Oxlint |
|
|
207
|
+
| `npm run lint:fix` | Fix Oxlint issues |
|
|
208
|
+
| `npm run format` | Check formatting via Oxfmt |
|
|
209
|
+
| `npm run format:fix` | Format the project via Oxfmt |
|
|
210
|
+
| `npm run quality` | Lint + format check |
|
|
211
|
+
| `npm run quality:fix` | Auto-fix lint + format |
|
|
212
|
+
| `npm run test:mcp` | Test MCP tools |
|
|
213
|
+
| `npm run test:mcp-http` | Test HTTP transport |
|
|
214
|
+
| `npm run test:mcp-sse` | Test SSE transport |
|
|
215
|
+
| `npm run test:mcp-stdio` | Test STDIO transport |
|
|
216
|
+
| `npm run generate-token` | Generate JWT tokens (Web UI) |
|
|
217
|
+
| `node scripts/generate-jwt.js` | Generate JWT token (CLI) |
|
|
218
|
+
| `/gen-jwt` | Generate JWT token (Claude Code skill) |
|
|
219
|
+
| `/upgrade-guide` | Generate upgrade guide for downstream projects (Claude Code skill) |
|
|
220
|
+
| `npm run consul:unreg` | Deregister from Consul |
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
## Server runs at
|
|
224
|
+
`http://localhost:3000` with:
|
|
225
|
+
- MCP endpoints at `/mcp/*`
|
|
226
|
+
- Admin panel for generating access tokens at `/admin`
|
|
227
|
+
- When `adminPanel.authType` includes `jwtToken`, the JWT **must** carry `allow: 'gen-token'`
|
|
228
|
+
in its payload to be accepted. Tokens without this claim (e.g. the short-lived JWT
|
|
229
|
+
auto-generated for the Agent Tester page) are rejected — this prevents them from
|
|
230
|
+
being replayed to mint arbitrary long-lived tokens. `permanentServerTokens` and
|
|
231
|
+
`basic` admin auth are unaffected.
|
|
232
|
+
Generate an admin-capable JWT:
|
|
233
|
+
`node scripts/generate-jwt.js -u admin -ttl 30d -p "allow=gen-token"`
|
|
234
|
+
- JWT generation API at `/gen-jwt` (when `webServer.genJwtApiEnable: true`)
|
|
235
|
+
- Swagger UI at `/docs`
|
|
236
|
+
- Health check at `/health`
|
|
237
|
+
|
|
238
|
+
## Agent Tester
|
|
239
|
+
|
|
240
|
+
Built-in chat interface for testing MCP server tools using an AI agent (OpenAI-compatible LLM).
|
|
241
|
+
The agent automatically discovers available tools and calls them in a conversational loop.
|
|
242
|
+
|
|
243
|
+
To enable, set environment variables (`.env` or shell):
|
|
244
|
+
```
|
|
245
|
+
AGENT_TESTER_ENABLED=true
|
|
246
|
+
AGENT_TESTER_OPENAI_API_KEY=sk-...
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
Or configure in `config/default.yaml` (or `local.yaml`):
|
|
250
|
+
```yaml
|
|
251
|
+
agentTester:
|
|
252
|
+
enabled: true
|
|
253
|
+
openAi:
|
|
254
|
+
apiKey: sk-...
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
The tester UI is available at `http://localhost:<port>/agent-tester` and auto-connects to the local MCP server.
|
|
258
|
+
Supports custom LLM endpoints, configurable system prompts, and dynamic HTTP headers. Recommended model for testing: **gpt-5.2**.
|
|
259
|
+
|
|
260
|
+
## Upgrade Guide Skill
|
|
261
|
+
|
|
262
|
+
Claude Code skill that generates a step-by-step upgrade guide for projects built on fa-mcp-sdk.
|
|
263
|
+
Analyzes git diff between two versions/commits and produces an MD file covering config changes, template file updates, script changes, API changes, and dependency updates.
|
|
264
|
+
|
|
265
|
+
**Usage in Claude Code:**
|
|
266
|
+
```
|
|
267
|
+
/upgrade-guide 0.4.30 0.4.37
|
|
268
|
+
/upgrade-guide 0.4.30
|
|
269
|
+
/upgrade-guide abc1234
|
|
270
|
+
/upgrade-guide 0.4.30 0.4.37 на русском
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
Output language is English by default. Add a natural-language hint (e.g., "на русском", "in German") to change it.
|
|
274
|
+
|
|
275
|
+
Skill location: `.claude/skills/upgrade-guide/SKILL.md`
|
|
276
|
+
|
|
277
|
+
## Directory Requirements
|
|
278
|
+
|
|
279
|
+
- Use absolute paths for target directory
|
|
280
|
+
- **Empty directories only** - CLI aborts if files exist except for the following:
|
|
281
|
+
|
|
282
|
+
.git/
|
|
283
|
+
.idea/
|
|
284
|
+
.vscode
|
|
285
|
+
.DS_Store
|
|
286
|
+
node_modules/
|
|
287
|
+
dist/
|
|
288
|
+
__misc/
|
|
289
|
+
_tmp/
|
|
290
|
+
.swp
|
|
291
|
+
.swo
|
|
292
|
+
.sublime-project
|
|
293
|
+
.sublime-workspace
|
|
294
|
+
~last-cli-config.json
|
|
295
|
+
|
|
296
|
+
## Deployment
|
|
297
|
+
|
|
298
|
+
### PM2 Production
|
|
299
|
+
```bash
|
|
300
|
+
npm run build
|
|
301
|
+
pm2 start deploy/pm2.config.js
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### Systemd Service
|
|
305
|
+
```bash
|
|
306
|
+
npm run build
|
|
307
|
+
chmod +x deploy/srv.cjs
|
|
308
|
+
./deploy/srv.cjs install
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### Consul Registration
|
|
312
|
+
Set `consul.service.enable: true` and provide required tokens for automatic service registration.
|
|
313
|
+
|
|
314
|
+
### Nginx Configuration
|
|
315
|
+
Generated nginx configuration files in `deploy/NGINX/` for domain-based routing.
|
|
316
|
+
|
|
317
|
+
## License
|
|
318
|
+
|
|
319
|
+
MIT License
|