@fleetx_io/fleetx-mcp-server 1.1.4 → 1.1.6
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 +139 -7
- package/dist/index.d.ts +1 -1
- package/dist/index.js +11 -10
- package/dist/index.js.map +1 -1
- package/dist/prompts/fleetxNodeApp.d.ts +2 -0
- package/dist/prompts/fleetxNodeApp.d.ts.map +1 -0
- package/dist/prompts/fleetxNodeApp.js +81 -0
- package/dist/prompts/fleetxNodeApp.js.map +1 -0
- package/dist/prompts/fleetxReactStandardsPrompt.d.ts +2 -0
- package/dist/prompts/fleetxReactStandardsPrompt.d.ts.map +1 -0
- package/dist/prompts/fleetxReactStandardsPrompt.js +41 -0
- package/dist/prompts/fleetxReactStandardsPrompt.js.map +1 -0
- package/dist/prompts/fleetxReportingApp.d.ts +2 -0
- package/dist/prompts/fleetxReportingApp.d.ts.map +1 -0
- package/dist/prompts/fleetxReportingApp.js +48 -0
- package/dist/prompts/fleetxReportingApp.js.map +1 -0
- package/dist/prompts/index.d.ts +3 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +39 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/server/createMcpServer.d.ts +12 -0
- package/dist/server/createMcpServer.d.ts.map +1 -0
- package/dist/{mcpServer.js → server/createMcpServer.js} +17 -14
- package/dist/server/createMcpServer.js.map +1 -0
- package/dist/transports/sse.d.ts +2 -0
- package/dist/transports/sse.d.ts.map +1 -0
- package/dist/transports/sse.js +147 -0
- package/dist/transports/sse.js.map +1 -0
- package/dist/transports/stdio.d.ts +2 -0
- package/dist/transports/stdio.d.ts.map +1 -0
- package/dist/transports/stdio.js +15 -0
- package/dist/transports/stdio.js.map +1 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +2 -1
- package/dist/utils.js.map +1 -1
- package/package.json +5 -11
- package/dist/mcpServer.d.ts +0 -8
- package/dist/mcpServer.d.ts.map +0 -1
- package/dist/mcpServer.js.map +0 -1
package/README.md
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/@fleetx_io/fleetx-mcp-server)
|
|
4
4
|
[](https://www.npmjs.com/package/@fleetx_io/fleetx-mcp-server)
|
|
5
5
|
|
|
6
|
-
An MCP (Model Context Protocol) server that gives AI agents access to the FleetX REST API.
|
|
6
|
+
An MCP (Model Context Protocol) server that gives AI agents access to the FleetX REST API. Use the **hosted server** at `https://mcp.fleetx.io/mcp` (no install) or **install locally** as an npm package — connect to any MCP-compatible client with no code required.
|
|
7
7
|
|
|
8
8
|
**[View on npm](https://www.npmjs.com/package/@fleetx_io/fleetx-mcp-server)**
|
|
9
9
|
|
|
10
10
|
## How it Works
|
|
11
11
|
|
|
12
|
-
1. Your AI agent
|
|
13
|
-
2. The server authenticates — either automatically via credentials
|
|
12
|
+
1. **Hosted:** Your AI agent connects to `https://mcp.fleetx.io/mcp` via URL. **Local:** Your agent launches this server as a subprocess (npx or global install).
|
|
13
|
+
2. The server authenticates — either automatically via credentials (Basic Auth for hosted, env vars for local), or when the agent calls the `login` tool.
|
|
14
14
|
3. After authentication, all available API definitions are fetched and registered as MCP tools with validated inputs.
|
|
15
15
|
4. The agent can now call any FleetX API — the server handles auth, validation, and proxying automatically.
|
|
16
16
|
|
|
@@ -20,13 +20,16 @@ An MCP (Model Context Protocol) server that gives AI agents access to the FleetX
|
|
|
20
20
|
|
|
21
21
|
There are two ways to authenticate:
|
|
22
22
|
|
|
23
|
-
### Option 1: Auto-login
|
|
23
|
+
### Option 1: Auto-login (recommended)
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
- **Hosted server:** Pass credentials via the `Authorization: Basic <base64>` header in your MCP config.
|
|
26
|
+
- **Local server:** Pass `USERNAME` and `PASSWORD` in the `env` section of your MCP config.
|
|
27
|
+
|
|
28
|
+
The server logs in at startup and all tools are available immediately — no manual login step needed.
|
|
26
29
|
|
|
27
30
|
### Option 2: Login via chat
|
|
28
31
|
|
|
29
|
-
If no credentials are provided
|
|
32
|
+
If no credentials are provided, only the `login` tool is exposed initially. Ask your AI agent to call it with your FleetX credentials, and the remaining tools will be registered dynamically.
|
|
30
33
|
|
|
31
34
|
> The `login` tool is always available regardless of which option you use, so you can re-authenticate or switch accounts at any time.
|
|
32
35
|
|
|
@@ -49,7 +52,136 @@ fleetx-mcp-server
|
|
|
49
52
|
|
|
50
53
|
---
|
|
51
54
|
|
|
52
|
-
##
|
|
55
|
+
## Hosted MCP Server
|
|
56
|
+
|
|
57
|
+
Use the hosted FleetX MCP server — no local install required. Connect directly from your AI agent.
|
|
58
|
+
|
|
59
|
+
**URL:** `https://mcp.fleetx.io/mcp`
|
|
60
|
+
|
|
61
|
+
### Configuration & Login
|
|
62
|
+
|
|
63
|
+
You can authenticate in two ways:
|
|
64
|
+
|
|
65
|
+
**Option 1: Auto-login via Basic Auth header (recommended)**
|
|
66
|
+
|
|
67
|
+
Pass your FleetX credentials in the `Authorization` header. The server logs in at startup and all tools are available immediately.
|
|
68
|
+
|
|
69
|
+
To create the Basic Auth value, encode your credentials as `username:password` in base64:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
echo -n "your_fleetx_username:your_fleetx_password" | base64
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Use the output in the `Authorization` header as `Basic <base64_string>`.
|
|
76
|
+
|
|
77
|
+
**Option 2: Login via chat**
|
|
78
|
+
|
|
79
|
+
Connect without credentials. Only the `login` tool is available initially. Ask your AI agent to call it with your FleetX username and password, and the remaining tools will be registered after successful login.
|
|
80
|
+
|
|
81
|
+
### Cursor
|
|
82
|
+
|
|
83
|
+
Add to `.cursor/mcp.json` in your project root (or `~/.cursor/mcp.json` for global):
|
|
84
|
+
|
|
85
|
+
**With auto-login (Basic Auth):**
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"mcpServers": {
|
|
90
|
+
"fleetx": {
|
|
91
|
+
"url": "https://mcp.fleetx.io/mcp",
|
|
92
|
+
"headers": {
|
|
93
|
+
"Authorization": "Basic <your_base64_encoded_credentials>"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Replace `<your_base64_encoded_credentials>` with the output of:
|
|
101
|
+
`echo -n "username:password" | base64`
|
|
102
|
+
|
|
103
|
+
**Without auto-login (login via chat):**
|
|
104
|
+
|
|
105
|
+
```json
|
|
106
|
+
{
|
|
107
|
+
"mcpServers": {
|
|
108
|
+
"fleetx": {
|
|
109
|
+
"url": "https://mcp.fleetx.io/mcp"
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Claude Desktop
|
|
116
|
+
|
|
117
|
+
Add to your `claude_desktop_config.json`:
|
|
118
|
+
|
|
119
|
+
**macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
120
|
+
**Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
|
|
121
|
+
|
|
122
|
+
**With auto-login (Basic Auth):**
|
|
123
|
+
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"mcpServers": {
|
|
127
|
+
"fleetx": {
|
|
128
|
+
"url": "https://mcp.fleetx.io/mcp",
|
|
129
|
+
"headers": {
|
|
130
|
+
"Authorization": "Basic <your_base64_encoded_credentials>"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**Without auto-login (login via chat):**
|
|
138
|
+
|
|
139
|
+
```json
|
|
140
|
+
{
|
|
141
|
+
"mcpServers": {
|
|
142
|
+
"fleetx": {
|
|
143
|
+
"url": "https://mcp.fleetx.io/mcp"
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Windsurf
|
|
150
|
+
|
|
151
|
+
Add to your Windsurf MCP config:
|
|
152
|
+
|
|
153
|
+
**With auto-login (Basic Auth):**
|
|
154
|
+
|
|
155
|
+
```json
|
|
156
|
+
{
|
|
157
|
+
"mcpServers": {
|
|
158
|
+
"fleetx": {
|
|
159
|
+
"url": "https://mcp.fleetx.io/mcp",
|
|
160
|
+
"headers": {
|
|
161
|
+
"Authorization": "Basic <your_base64_encoded_credentials>"
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**Without auto-login (login via chat):**
|
|
169
|
+
|
|
170
|
+
```json
|
|
171
|
+
{
|
|
172
|
+
"mcpServers": {
|
|
173
|
+
"fleetx": {
|
|
174
|
+
"url": "https://mcp.fleetx.io/mcp"
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
After saving, restart your AI agent. The FleetX server will appear in **Settings > MCP** (or equivalent).
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Connect to Your AI Agent (Local Install)
|
|
53
185
|
|
|
54
186
|
### Cursor
|
|
55
187
|
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// Node will treat it as executable.
|
|
3
|
-
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
-
import { createMcpServer } from "./mcpServer.js";
|
|
5
|
-
import { createTokenStore } from "./auth.js";
|
|
1
|
+
#!/usr/bin/env node
|
|
6
2
|
import { log } from "./utils.js";
|
|
3
|
+
const transport = (process.env.MCP_TRANSPORT ?? "stdio").toLowerCase();
|
|
7
4
|
async function main() {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
log(`Starting FleetX MCP Server in ${transport} mode`);
|
|
6
|
+
if (transport === "http") {
|
|
7
|
+
const { startHTTP } = await import("./transports/sse.js");
|
|
8
|
+
await startHTTP();
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
const { startStdio } = await import("./transports/stdio.js");
|
|
12
|
+
await startStdio();
|
|
13
|
+
}
|
|
13
14
|
}
|
|
14
15
|
main().catch((err) => {
|
|
15
16
|
log("Fatal error:", err);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEjC,MAAM,SAAS,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;AAEvE,KAAK,UAAU,IAAI;IACjB,GAAG,CAAC,iCAAiC,SAAS,OAAO,CAAC,CAAC;IACvD,IAAI,SAAS,KAAK,MAAM,EAAE,CAAC;QACzB,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC,CAAC;QAC1D,MAAM,SAAS,EAAE,CAAC;IACpB,CAAC;SAAM,CAAC;QACN,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,MAAM,CAAC,uBAAuB,CAAC,CAAC;QAC7D,MAAM,UAAU,EAAE,CAAC;IACrB,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,GAAG,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC;IACzB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const FLEETX_NODE_APP_PROMPT = "\nYou are a senior Node.js backend coding agent working on the \"fleetx-node-app\" repository.\n\nFollow these project rules and conventions strictly:\n\n1. Runtime & stack\n- Use Node.js with Express 4.\n- Use CommonJS modules only: \"require\" / \"module.exports\". Do NOT use ES modules or \"import\"/\"export\".\n- The main entrypoint is \"server.js\", which configures the Express app and mounts routes from \"routes/index.js\".\n\n2. Project structure & patterns\n- \"routes/*.js\" files define Express Routers only. Example pattern:\n - \"const express = require('express');\"\n - \"const router = express.Router();\"\n - Define \"router.get\", \"router.post\", etc.\n - \"module.exports = router;\"\n- Mount routers in \"routes/index.js\" with:\n - \"app.use('/napp/<feature>', require('./<feature>'));\"\n- \"controllers/*.js\" contain business logic and request handlers. Keep routes thin and delegate to controllers.\n- \"utils/*.js\" contains shared helpers (\"http_utils\", \"logger_utils\", \"slack_utils\", etc.).\n- \"crons/*.js\" are cron/background job scripts. If exposed via HTTP, routes live under \"/napp/crons\" and call controller functions that spawn or run these scripts.\n\n3. API conventions\n- All internal APIs are prefixed with \"/napp/\" (e.g. \"/napp/devices\", \"/napp/crons\", \"/napp/config\").\n- Prefer middleware for auth/validation, such as:\n - \"validate_route_by_me_api\" (from \"controllers/route_validation.js\")\n - route-specific validators (e.g. \"validateCronAuth\" in \"routes/crons.js\").\n- For new features:\n - Create a new router file in \"routes/\".\n - Create or reuse controller functions in \"controllers/\".\n - Mount the router in \"routes/index.js\" under \"/napp/<feature>\".\n\n4. HTTP responses & error handling\n- Use helpers from \"utils/http_utils\" instead of raw numbers:\n - Status constants: \"OK\", \"CREATED\", \"BAD_REQUEST\", \"UNAUTHORIZED\", \"FORBIDDEN\", \"NOT_FOUND\", \"INTERNAL_SERVER_ERROR\", etc.\n - \"sendErrorResponse(res, message, status)\" returns JSON with \"error: true, error_description: message\".\n - \"sendMissingParamsError(res, param)\" and \"sendInvalidParamsError(res, param)\" for 400-style errors.\n- Prefer project-level error handling (\"errorHandler\" from \"utils/logger_utils\", \"exceptionLoggingToAPM\" from \"apm/exceptionLogging\") instead of ad-hoc patterns.\n\n5. Libraries and building blocks to prefer\n- HTTP server and middleware:\n - \"express\", \"express.Router\", \"express-rate-limit\", \"express-static-gzip\"\n - \"body-parser\" for JSON/urlencoded\n - \"multer\" for file uploads\n - \"cors\", \"helmet\", \"x-frame-options\" for security\n - \"compression\" for gzip\n- Utilities:\n - \"lodash\" for helpers (\"get\", \"includes\", etc.)\n - \"moment\" / \"moment-timezone\" for dates and time zones\n - \"uuid\", \"crypto\", \"crypto-js\" as used in the project\n- HTTP client: \"axios\" for outgoing HTTP requests.\n- Persistence and infra:\n - \"mysql\", \"mongodb\" for data stores\n - \"ioredis\" for Redis\n- Logging and monitoring:\n - \"winston\" and the existing logger utilities\n - APM / tracing from \"apm/\" (OpenTelemetry, Sentry, etc.) as already integrated\n- Do NOT introduce new frameworks (like NestJS, Koa, Fastify) or alternative HTTP clients unless explicitly requested.\n\n6. Code style\n- Match the repository's \".prettierrc\":\n - Single quotes.\n - Semicolons required.\n - 4-space indentation.\n - Trailing commas in ES5 positions.\n - Max line length 120 characters.\n- Keep code formatting compatible with Prettier so the pre-commit hook (\"pretty-quick --staged\") passes.\n- Do not add unnecessary comments that simply restate what the code does. Comments should only explain non-obvious intent or constraints.\n\n7. Environment & configuration\n- Use \"dotenv\" and \"process.env\" as in the existing code.\n- Use existing helpers from \"utils/http_utils\" and related modules:\n - \"isLocalEnv()\", \"isEnvLive()\", \"getRootApiUrl()\", etc.\n- Do not hardcode secrets or environment-specific URLs; prefer config helpers and environment variables.\n\n8. General behavior\n- When adding or changing code, prefer existing patterns and utilities over inventing new abstractions.\n- Minimize breaking changes; preserve current APIs unless explicitly asked to change them.\n- Write robust, production-ready code that would fit naturally into this codebase.\n";
|
|
2
|
+
//# sourceMappingURL=fleetxNodeApp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fleetxNodeApp.d.ts","sourceRoot":"","sources":["../../src/prompts/fleetxNodeApp.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,k2IA+ElC,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export const FLEETX_NODE_APP_PROMPT = `
|
|
2
|
+
You are a senior Node.js backend coding agent working on the "fleetx-node-app" repository.
|
|
3
|
+
|
|
4
|
+
Follow these project rules and conventions strictly:
|
|
5
|
+
|
|
6
|
+
1. Runtime & stack
|
|
7
|
+
- Use Node.js with Express 4.
|
|
8
|
+
- Use CommonJS modules only: "require" / "module.exports". Do NOT use ES modules or "import"/"export".
|
|
9
|
+
- The main entrypoint is "server.js", which configures the Express app and mounts routes from "routes/index.js".
|
|
10
|
+
|
|
11
|
+
2. Project structure & patterns
|
|
12
|
+
- "routes/*.js" files define Express Routers only. Example pattern:
|
|
13
|
+
- "const express = require('express');"
|
|
14
|
+
- "const router = express.Router();"
|
|
15
|
+
- Define "router.get", "router.post", etc.
|
|
16
|
+
- "module.exports = router;"
|
|
17
|
+
- Mount routers in "routes/index.js" with:
|
|
18
|
+
- "app.use('/napp/<feature>', require('./<feature>'));"
|
|
19
|
+
- "controllers/*.js" contain business logic and request handlers. Keep routes thin and delegate to controllers.
|
|
20
|
+
- "utils/*.js" contains shared helpers ("http_utils", "logger_utils", "slack_utils", etc.).
|
|
21
|
+
- "crons/*.js" are cron/background job scripts. If exposed via HTTP, routes live under "/napp/crons" and call controller functions that spawn or run these scripts.
|
|
22
|
+
|
|
23
|
+
3. API conventions
|
|
24
|
+
- All internal APIs are prefixed with "/napp/" (e.g. "/napp/devices", "/napp/crons", "/napp/config").
|
|
25
|
+
- Prefer middleware for auth/validation, such as:
|
|
26
|
+
- "validate_route_by_me_api" (from "controllers/route_validation.js")
|
|
27
|
+
- route-specific validators (e.g. "validateCronAuth" in "routes/crons.js").
|
|
28
|
+
- For new features:
|
|
29
|
+
- Create a new router file in "routes/".
|
|
30
|
+
- Create or reuse controller functions in "controllers/".
|
|
31
|
+
- Mount the router in "routes/index.js" under "/napp/<feature>".
|
|
32
|
+
|
|
33
|
+
4. HTTP responses & error handling
|
|
34
|
+
- Use helpers from "utils/http_utils" instead of raw numbers:
|
|
35
|
+
- Status constants: "OK", "CREATED", "BAD_REQUEST", "UNAUTHORIZED", "FORBIDDEN", "NOT_FOUND", "INTERNAL_SERVER_ERROR", etc.
|
|
36
|
+
- "sendErrorResponse(res, message, status)" returns JSON with "error: true, error_description: message".
|
|
37
|
+
- "sendMissingParamsError(res, param)" and "sendInvalidParamsError(res, param)" for 400-style errors.
|
|
38
|
+
- Prefer project-level error handling ("errorHandler" from "utils/logger_utils", "exceptionLoggingToAPM" from "apm/exceptionLogging") instead of ad-hoc patterns.
|
|
39
|
+
|
|
40
|
+
5. Libraries and building blocks to prefer
|
|
41
|
+
- HTTP server and middleware:
|
|
42
|
+
- "express", "express.Router", "express-rate-limit", "express-static-gzip"
|
|
43
|
+
- "body-parser" for JSON/urlencoded
|
|
44
|
+
- "multer" for file uploads
|
|
45
|
+
- "cors", "helmet", "x-frame-options" for security
|
|
46
|
+
- "compression" for gzip
|
|
47
|
+
- Utilities:
|
|
48
|
+
- "lodash" for helpers ("get", "includes", etc.)
|
|
49
|
+
- "moment" / "moment-timezone" for dates and time zones
|
|
50
|
+
- "uuid", "crypto", "crypto-js" as used in the project
|
|
51
|
+
- HTTP client: "axios" for outgoing HTTP requests.
|
|
52
|
+
- Persistence and infra:
|
|
53
|
+
- "mysql", "mongodb" for data stores
|
|
54
|
+
- "ioredis" for Redis
|
|
55
|
+
- Logging and monitoring:
|
|
56
|
+
- "winston" and the existing logger utilities
|
|
57
|
+
- APM / tracing from "apm/" (OpenTelemetry, Sentry, etc.) as already integrated
|
|
58
|
+
- Do NOT introduce new frameworks (like NestJS, Koa, Fastify) or alternative HTTP clients unless explicitly requested.
|
|
59
|
+
|
|
60
|
+
6. Code style
|
|
61
|
+
- Match the repository's ".prettierrc":
|
|
62
|
+
- Single quotes.
|
|
63
|
+
- Semicolons required.
|
|
64
|
+
- 4-space indentation.
|
|
65
|
+
- Trailing commas in ES5 positions.
|
|
66
|
+
- Max line length 120 characters.
|
|
67
|
+
- Keep code formatting compatible with Prettier so the pre-commit hook ("pretty-quick --staged") passes.
|
|
68
|
+
- Do not add unnecessary comments that simply restate what the code does. Comments should only explain non-obvious intent or constraints.
|
|
69
|
+
|
|
70
|
+
7. Environment & configuration
|
|
71
|
+
- Use "dotenv" and "process.env" as in the existing code.
|
|
72
|
+
- Use existing helpers from "utils/http_utils" and related modules:
|
|
73
|
+
- "isLocalEnv()", "isEnvLive()", "getRootApiUrl()", etc.
|
|
74
|
+
- Do not hardcode secrets or environment-specific URLs; prefer config helpers and environment variables.
|
|
75
|
+
|
|
76
|
+
8. General behavior
|
|
77
|
+
- When adding or changing code, prefer existing patterns and utilities over inventing new abstractions.
|
|
78
|
+
- Minimize breaking changes; preserve current APIs unless explicitly asked to change them.
|
|
79
|
+
- Write robust, production-ready code that would fit naturally into this codebase.
|
|
80
|
+
`;
|
|
81
|
+
//# sourceMappingURL=fleetxNodeApp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fleetxNodeApp.js","sourceRoot":"","sources":["../../src/prompts/fleetxNodeApp.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+ErC,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const FLEETX_REACT_STANDARDS_PROMPT = "\nYou are working in the \"fleetx-dashboard\" React 18 codebase.\n\nFollow these project conventions:\n\n1. UI libraries and components\n- Prefer Ant Design v5 (\"antd\" and \"@ant-design/icons\") for new UI instead of introducing other UI libraries (no Material UI, Tailwind, etc.).\n- Reuse existing \"sharedV2\" components (FxSelect, FxSwitch, FxRow, FxCol, FxFlex, FxTypography, FxCard, FxSteps, FxDivider, FxBadgeDivider, etc.) wherever possible before adding new custom components.\n- When updating legacy screens, adapt them toward the Ant Design + \"sharedV2\" style rather than raw HTML or Reactstrap/Bootstrap components, but do not start large rewrites unless explicitly asked.\n- Keep existing data-ga* tracking attributes on elements and preserve analytics semantics when refactoring.\n\n2. Styling\n- Use \"styled-components\" for new custom styling and for extending Fx*/Antd components (for example, styled(FxCol)), following existing patterns.\n- You may keep and lightly extend existing Bootstrap utility classes (for example, \"mb-4\", \"mt-2\") on legacy JSX where they already exist, but do not introduce new global CSS frameworks.\n- Avoid inline styles except for small, localized layout tweaks; prefer styled-components or existing layout components (FxRow, FxCol, FxFlex).\n\n3. Forms, state, and data flow\n- Prefer Formik (<Formik>, <Form>) and existing form utilities (vehicle_form_utils, form_utils, etc.) where they are already used.\n- Use the existing Redux setup and actions instead of adding new state libraries; connect components with react-redux (connect, useSelector, useDispatch) in the same style as the neighboring code.\n- Reuse existing helpers from utils modules (date_utils, vehicle_utils, realtime_utils, etc.) instead of re-implementing similar logic.\n\n4. Internationalization and text\n- Use react-i18next (useTranslation, withTranslation) for any user-facing text instead of hard-coded strings where translations are already used in that area.\n- Follow the existing key patterns (for example, t(\"selectRoute\"), t(\"notOnJob\")) and do not invent new namespaces unless explicitly requested.\n\n5. Code style and structure\n- Match the surrounding file's style:\n - If it is TypeScript (.tsx), keep using TypeScript and existing types/interfaces.\n - If it is JavaScript/ES6, use the same language and patterns.\n - Preserve class components where they already exist (for example, AddEditVehicleComponentV2) unless asked to convert to hooks.\n- Use functional React components with hooks for new components, colocating logic and JSX in a clear, readable way.\n- Use existing utility libraries already in the project (for example, Lodash, Moment, Moment Timezone) instead of adding new date or utility libraries.\n\n6. General rules\n- Do not introduce new heavy dependencies without explicit instructions.\n- Prefer small, focused changes that integrate with existing patterns over large rewrites.\n- Always aim for consistency with nearby components and modules in this repository, especially in the dashboard and realtime/vehicles sections.\n\nWhen implementing or modifying UI or logic, first look for existing components or utilities in this codebase that achieve something similar, and extend or compose them instead of creating entirely new patterns.\n";
|
|
2
|
+
//# sourceMappingURL=fleetxReactStandardsPrompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fleetxReactStandardsPrompt.d.ts","sourceRoot":"","sources":["../../src/prompts/fleetxReactStandardsPrompt.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,6BAA6B,svGAuCzC,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export const FLEETX_REACT_STANDARDS_PROMPT = `
|
|
2
|
+
You are working in the "fleetx-dashboard" React 18 codebase.
|
|
3
|
+
|
|
4
|
+
Follow these project conventions:
|
|
5
|
+
|
|
6
|
+
1. UI libraries and components
|
|
7
|
+
- Prefer Ant Design v5 ("antd" and "@ant-design/icons") for new UI instead of introducing other UI libraries (no Material UI, Tailwind, etc.).
|
|
8
|
+
- Reuse existing "sharedV2" components (FxSelect, FxSwitch, FxRow, FxCol, FxFlex, FxTypography, FxCard, FxSteps, FxDivider, FxBadgeDivider, etc.) wherever possible before adding new custom components.
|
|
9
|
+
- When updating legacy screens, adapt them toward the Ant Design + "sharedV2" style rather than raw HTML or Reactstrap/Bootstrap components, but do not start large rewrites unless explicitly asked.
|
|
10
|
+
- Keep existing data-ga* tracking attributes on elements and preserve analytics semantics when refactoring.
|
|
11
|
+
|
|
12
|
+
2. Styling
|
|
13
|
+
- Use "styled-components" for new custom styling and for extending Fx*/Antd components (for example, styled(FxCol)), following existing patterns.
|
|
14
|
+
- You may keep and lightly extend existing Bootstrap utility classes (for example, "mb-4", "mt-2") on legacy JSX where they already exist, but do not introduce new global CSS frameworks.
|
|
15
|
+
- Avoid inline styles except for small, localized layout tweaks; prefer styled-components or existing layout components (FxRow, FxCol, FxFlex).
|
|
16
|
+
|
|
17
|
+
3. Forms, state, and data flow
|
|
18
|
+
- Prefer Formik (<Formik>, <Form>) and existing form utilities (vehicle_form_utils, form_utils, etc.) where they are already used.
|
|
19
|
+
- Use the existing Redux setup and actions instead of adding new state libraries; connect components with react-redux (connect, useSelector, useDispatch) in the same style as the neighboring code.
|
|
20
|
+
- Reuse existing helpers from utils modules (date_utils, vehicle_utils, realtime_utils, etc.) instead of re-implementing similar logic.
|
|
21
|
+
|
|
22
|
+
4. Internationalization and text
|
|
23
|
+
- Use react-i18next (useTranslation, withTranslation) for any user-facing text instead of hard-coded strings where translations are already used in that area.
|
|
24
|
+
- Follow the existing key patterns (for example, t("selectRoute"), t("notOnJob")) and do not invent new namespaces unless explicitly requested.
|
|
25
|
+
|
|
26
|
+
5. Code style and structure
|
|
27
|
+
- Match the surrounding file's style:
|
|
28
|
+
- If it is TypeScript (.tsx), keep using TypeScript and existing types/interfaces.
|
|
29
|
+
- If it is JavaScript/ES6, use the same language and patterns.
|
|
30
|
+
- Preserve class components where they already exist (for example, AddEditVehicleComponentV2) unless asked to convert to hooks.
|
|
31
|
+
- Use functional React components with hooks for new components, colocating logic and JSX in a clear, readable way.
|
|
32
|
+
- Use existing utility libraries already in the project (for example, Lodash, Moment, Moment Timezone) instead of adding new date or utility libraries.
|
|
33
|
+
|
|
34
|
+
6. General rules
|
|
35
|
+
- Do not introduce new heavy dependencies without explicit instructions.
|
|
36
|
+
- Prefer small, focused changes that integrate with existing patterns over large rewrites.
|
|
37
|
+
- Always aim for consistency with nearby components and modules in this repository, especially in the dashboard and realtime/vehicles sections.
|
|
38
|
+
|
|
39
|
+
When implementing or modifying UI or logic, first look for existing components or utilities in this codebase that achieve something similar, and extend or compose them instead of creating entirely new patterns.
|
|
40
|
+
`;
|
|
41
|
+
//# sourceMappingURL=fleetxReactStandardsPrompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fleetxReactStandardsPrompt.js","sourceRoot":"","sources":["../../src/prompts/fleetxReactStandardsPrompt.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,6BAA6B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuC5C,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const FLEETX_REPORTING_APP_PROMPT = "\nYou are the coding agent for the \"fleetx-reporting-app\" backend codebase.\n\nTechnology and architecture:\n- This is a Node.js backend using Express 4 (\"express\") with CommonJS modules (\"require\" / \"module.exports\"), NOT ES modules/imports.\n- HTTP layer is built with Express routers and controllers; use \"req\", \"res\" handlers and middleware in the same style as existing code.\n- The app is organized into \"routes/\", \"controllers/\", \"models/\", and \"utils/\" directories. Follow this structure for all new features.\n\nCore libraries and patterns to prefer:\n- Prefer these existing dependencies instead of introducing new frameworks or utilities:\n - \"express\" for HTTP and routing\n - \"lodash\" for object/array utilities (get, set, map, round, forEach, find, etc.)\n - \"moment\" and \"moment-timezone\" for dates/times\n - \"axios\" for outbound HTTP requests\n - \"winston\" (with existing logger utilities) for logging\n - \"morgan\" for HTTP request logging\n - \"body-parser\", \"cors\", \"helmet\", \"compression\" for middleware\n - Existing reporting utilities like \"reports_utils\", \"date_utils\", \"http_utils\", \"logger_utils\", \"vehicle_utils\", and similar helpers under \"utils/\"\n- Do NOT introduce new server frameworks (for example NestJS, Koa) or ORM layers unless explicitly requested. Build on the existing Express + utilities stack.\n\nCode style and conventions:\n- Use CommonJS: \"const something = require('something');\" and \"module.exports = { ... };\".\n- Match current style: 4-space indentation, single quotes, semicolons, and the existing naming conventions.\n- Use async/await with try/catch for async flows, mirroring current controllers such as uptime report controllers.\n- Reuse existing helpers for:\n - Date/time: getMomentTime, getEndDate, getTimeDiffHours, etc.\n - HTTP responses: sendErrorResponse, handleErrorMsg, HTTP constants (for example INTERNAL_SERVER_ERROR, ACCEPTED)\n - Logging and alerts: logError, sendAlertToSlack, BigQuery logging utilities, queueing helpers\n- When you need configuration/secrets, assume \"dotenv\" and the existing config patterns are in use; do not invent new config systems.\n\nRouting, controllers, and models:\n- For new endpoints, add routes under the existing route files (for example \"routes/reports.js\") and delegate to controller functions under \"controllers/...\".\n- Controllers should:\n - Be async functions receiving (req, res)\n - Extract auth tokens from headers (for example req.header(\"Authorization\")) and user/account info from req.loggedInUser when needed\n - Call model functions under \"models/...\" (for example \"vehicle_reports_model\") or utilities for data fetching and transformation\n - Handle errors with try/catch, logging via logError and sendAlertToSlack, and respond with sendErrorResponse where appropriate\n- For reporting features, follow existing patterns:\n - Use report utilities (createReportFilename, REPORT_FORMAT, REPORT_REQUEST_MODE, REPORT_TYPES, dispatchReportForPreparedData, etc.)\n - Use batching/pagination and parallelization patterns already in controllers (for example batched Promise.allSettled calls) instead of inventing new ones.\n - Build headers/data rows with addHeader and addDataRow, and calculate time/downtime using provided helpers.\n\nGeneral guidance:\n- Prefer composition and reuse of existing utilities and patterns over adding new abstractions.\n- Keep the style and structure consistent with nearby files; when in doubt, mirror the approach used in similar controllers and routes in this project.\n- Avoid adding new dependencies unless strictly necessary; if needed, choose small, focused libraries that fit naturally alongside the existing stack.\n";
|
|
2
|
+
//# sourceMappingURL=fleetxReportingApp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fleetxReportingApp.d.ts","sourceRoot":"","sources":["../../src/prompts/fleetxReportingApp.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,2BAA2B,grHA8CvC,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export const FLEETX_REPORTING_APP_PROMPT = `
|
|
2
|
+
You are the coding agent for the "fleetx-reporting-app" backend codebase.
|
|
3
|
+
|
|
4
|
+
Technology and architecture:
|
|
5
|
+
- This is a Node.js backend using Express 4 ("express") with CommonJS modules ("require" / "module.exports"), NOT ES modules/imports.
|
|
6
|
+
- HTTP layer is built with Express routers and controllers; use "req", "res" handlers and middleware in the same style as existing code.
|
|
7
|
+
- The app is organized into "routes/", "controllers/", "models/", and "utils/" directories. Follow this structure for all new features.
|
|
8
|
+
|
|
9
|
+
Core libraries and patterns to prefer:
|
|
10
|
+
- Prefer these existing dependencies instead of introducing new frameworks or utilities:
|
|
11
|
+
- "express" for HTTP and routing
|
|
12
|
+
- "lodash" for object/array utilities (get, set, map, round, forEach, find, etc.)
|
|
13
|
+
- "moment" and "moment-timezone" for dates/times
|
|
14
|
+
- "axios" for outbound HTTP requests
|
|
15
|
+
- "winston" (with existing logger utilities) for logging
|
|
16
|
+
- "morgan" for HTTP request logging
|
|
17
|
+
- "body-parser", "cors", "helmet", "compression" for middleware
|
|
18
|
+
- Existing reporting utilities like "reports_utils", "date_utils", "http_utils", "logger_utils", "vehicle_utils", and similar helpers under "utils/"
|
|
19
|
+
- Do NOT introduce new server frameworks (for example NestJS, Koa) or ORM layers unless explicitly requested. Build on the existing Express + utilities stack.
|
|
20
|
+
|
|
21
|
+
Code style and conventions:
|
|
22
|
+
- Use CommonJS: "const something = require('something');" and "module.exports = { ... };".
|
|
23
|
+
- Match current style: 4-space indentation, single quotes, semicolons, and the existing naming conventions.
|
|
24
|
+
- Use async/await with try/catch for async flows, mirroring current controllers such as uptime report controllers.
|
|
25
|
+
- Reuse existing helpers for:
|
|
26
|
+
- Date/time: getMomentTime, getEndDate, getTimeDiffHours, etc.
|
|
27
|
+
- HTTP responses: sendErrorResponse, handleErrorMsg, HTTP constants (for example INTERNAL_SERVER_ERROR, ACCEPTED)
|
|
28
|
+
- Logging and alerts: logError, sendAlertToSlack, BigQuery logging utilities, queueing helpers
|
|
29
|
+
- When you need configuration/secrets, assume "dotenv" and the existing config patterns are in use; do not invent new config systems.
|
|
30
|
+
|
|
31
|
+
Routing, controllers, and models:
|
|
32
|
+
- For new endpoints, add routes under the existing route files (for example "routes/reports.js") and delegate to controller functions under "controllers/...".
|
|
33
|
+
- Controllers should:
|
|
34
|
+
- Be async functions receiving (req, res)
|
|
35
|
+
- Extract auth tokens from headers (for example req.header("Authorization")) and user/account info from req.loggedInUser when needed
|
|
36
|
+
- Call model functions under "models/..." (for example "vehicle_reports_model") or utilities for data fetching and transformation
|
|
37
|
+
- Handle errors with try/catch, logging via logError and sendAlertToSlack, and respond with sendErrorResponse where appropriate
|
|
38
|
+
- For reporting features, follow existing patterns:
|
|
39
|
+
- Use report utilities (createReportFilename, REPORT_FORMAT, REPORT_REQUEST_MODE, REPORT_TYPES, dispatchReportForPreparedData, etc.)
|
|
40
|
+
- Use batching/pagination and parallelization patterns already in controllers (for example batched Promise.allSettled calls) instead of inventing new ones.
|
|
41
|
+
- Build headers/data rows with addHeader and addDataRow, and calculate time/downtime using provided helpers.
|
|
42
|
+
|
|
43
|
+
General guidance:
|
|
44
|
+
- Prefer composition and reuse of existing utilities and patterns over adding new abstractions.
|
|
45
|
+
- Keep the style and structure consistent with nearby files; when in doubt, mirror the approach used in similar controllers and routes in this project.
|
|
46
|
+
- Avoid adding new dependencies unless strictly necessary; if needed, choose small, focused libraries that fit naturally alongside the existing stack.
|
|
47
|
+
`;
|
|
48
|
+
//# sourceMappingURL=fleetxReportingApp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fleetxReportingApp.js","sourceRoot":"","sources":["../../src/prompts/fleetxReportingApp.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,2BAA2B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8C1C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAKpE,wBAAgB,cAAc,CAAC,GAAG,EAAE,SAAS,QAgD5C"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { FLEETX_REACT_STANDARDS_PROMPT } from "./fleetxReactStandardsPrompt.js";
|
|
2
|
+
import { FLEETX_REPORTING_APP_PROMPT } from "./fleetxReportingApp.js";
|
|
3
|
+
import { FLEETX_NODE_APP_PROMPT } from "./fleetxNodeApp.js";
|
|
4
|
+
export function registerPrompt(mcp) {
|
|
5
|
+
mcp.prompt("fleetx-react-standards", "React 18 UI, state, and code-style standards for the fleetx-dashboard codebase.", () => ({
|
|
6
|
+
messages: [
|
|
7
|
+
{
|
|
8
|
+
role: "assistant",
|
|
9
|
+
content: {
|
|
10
|
+
type: "text",
|
|
11
|
+
text: FLEETX_REACT_STANDARDS_PROMPT.trim(),
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
}));
|
|
16
|
+
mcp.prompt("fleetx-reporting-app", "Reporting app codebase standards for the fleetx-reporting-app codebase.", () => ({
|
|
17
|
+
messages: [
|
|
18
|
+
{
|
|
19
|
+
role: "assistant",
|
|
20
|
+
content: {
|
|
21
|
+
type: "text",
|
|
22
|
+
text: FLEETX_REPORTING_APP_PROMPT.trim(),
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
}));
|
|
27
|
+
mcp.prompt("fleetx-node-app", "Node.js backend codebase standards for the fleetx-node-app codebase.", () => ({
|
|
28
|
+
messages: [
|
|
29
|
+
{
|
|
30
|
+
role: "assistant",
|
|
31
|
+
content: {
|
|
32
|
+
type: "text",
|
|
33
|
+
text: FLEETX_NODE_APP_PROMPT.trim(),
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,MAAM,UAAU,cAAc,CAAC,GAAc;IAC3C,GAAG,CAAC,MAAM,CACR,wBAAwB,EACxB,iFAAiF,EACjF,GAAG,EAAE,CAAC,CAAC;QACL,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,6BAA6B,CAAC,IAAI,EAAE;iBAC3C;aACF;SACF;KACF,CAAC,CACH,CAAC;IAEF,GAAG,CAAC,MAAM,CACR,sBAAsB,EACtB,yEAAyE,EACzE,GAAG,EAAE,CAAC,CAAC;QACL,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,2BAA2B,CAAC,IAAI,EAAE;iBACzC;aACF;SACF;KACF,CAAC,CACH,CAAC;IAEF,GAAG,CAAC,MAAM,CACR,iBAAiB,EACjB,sEAAsE,EACtE,GAAG,EAAE,CAAC,CAAC;QACL,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,sBAAsB,CAAC,IAAI,EAAE;iBACpC;aACF;SACF;KACF,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { TokenStore } from "../types.js";
|
|
3
|
+
export interface Credentials {
|
|
4
|
+
username: string;
|
|
5
|
+
password: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Creates and configures the McpServer instance with login + dynamic tools.
|
|
9
|
+
* Credentials must be passed explicitly by the caller (from env vars, HTTP headers, etc.).
|
|
10
|
+
*/
|
|
11
|
+
export declare function createMcpServer(tokenStore: TokenStore, credentials?: Credentials): Promise<McpServer>;
|
|
12
|
+
//# sourceMappingURL=createMcpServer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createMcpServer.d.ts","sourceRoot":"","sources":["../../src/server/createMcpServer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAiB,MAAM,aAAa,CAAC;AAOxD,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAsB,eAAe,CACnC,UAAU,EAAE,UAAU,EACtB,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC,SAAS,CAAC,CAqCpB"}
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
-
import { login } from "
|
|
4
|
-
import { fetchApiDefinitions } from "
|
|
5
|
-
import { generateTools } from "
|
|
6
|
-
import { log, getLoginURL, getAPIDefinitionURL
|
|
3
|
+
import { login } from "../auth.js";
|
|
4
|
+
import { fetchApiDefinitions } from "../apiDiscovery.js";
|
|
5
|
+
import { generateTools } from "../toolGenerator.js";
|
|
6
|
+
import { log, getLoginURL, getAPIDefinitionURL } from "../utils.js";
|
|
7
|
+
import { registerPrompt } from "../prompts/index.js";
|
|
7
8
|
/**
|
|
8
9
|
* Creates and configures the McpServer instance with login + dynamic tools.
|
|
9
|
-
*
|
|
10
|
+
* Credentials must be passed explicitly by the caller (from env vars, HTTP headers, etc.).
|
|
10
11
|
*/
|
|
11
|
-
export async function createMcpServer(tokenStore) {
|
|
12
|
+
export async function createMcpServer(tokenStore, credentials) {
|
|
12
13
|
const mcp = new McpServer({ name: "fleetx-mcp-server", version: "1.1.0" }, { capabilities: { tools: { listChanged: true } } });
|
|
13
14
|
registerLoginTool(mcp, tokenStore);
|
|
14
15
|
registerResources(mcp, tokenStore);
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
registerPrompt(mcp);
|
|
17
|
+
const username = credentials?.username;
|
|
18
|
+
const password = credentials?.password;
|
|
17
19
|
if (username && password) {
|
|
18
|
-
log("Auto-login:
|
|
20
|
+
log("Auto-login: credentials provided");
|
|
19
21
|
try {
|
|
20
22
|
const loginResult = await login(getLoginURL(), username, password, tokenStore);
|
|
21
23
|
if (!loginResult.success) {
|
|
@@ -100,9 +102,10 @@ function registerLoginTool(mcp, tokenStore) {
|
|
|
100
102
|
};
|
|
101
103
|
});
|
|
102
104
|
}
|
|
103
|
-
|
|
105
|
+
const registeredDynamicToolsMap = new WeakMap();
|
|
104
106
|
function registerDynamicTools(mcp, definitions, tokenStore) {
|
|
105
|
-
|
|
107
|
+
const previousTools = registeredDynamicToolsMap.get(mcp) ?? [];
|
|
108
|
+
for (const rt of previousTools) {
|
|
106
109
|
try {
|
|
107
110
|
rt.remove();
|
|
108
111
|
}
|
|
@@ -110,7 +113,7 @@ function registerDynamicTools(mcp, definitions, tokenStore) {
|
|
|
110
113
|
// tool may already have been removed
|
|
111
114
|
}
|
|
112
115
|
}
|
|
113
|
-
|
|
116
|
+
registeredDynamicToolsMap.set(mcp, []);
|
|
114
117
|
const tools = generateTools(definitions, tokenStore);
|
|
115
118
|
const registeredNames = [];
|
|
116
119
|
for (const tool of tools) {
|
|
@@ -126,7 +129,7 @@ function registerDynamicTools(mcp, definitions, tokenStore) {
|
|
|
126
129
|
const result = await tool.handler(args);
|
|
127
130
|
return result;
|
|
128
131
|
});
|
|
129
|
-
|
|
132
|
+
registeredDynamicToolsMap.get(mcp).push(registered);
|
|
130
133
|
registeredNames.push(toolName);
|
|
131
134
|
}
|
|
132
135
|
catch (err) {
|
|
@@ -169,4 +172,4 @@ function jsonSchemaPropertyToZod(prop, required) {
|
|
|
169
172
|
}
|
|
170
173
|
return required ? schema : schema.optional();
|
|
171
174
|
}
|
|
172
|
-
//# sourceMappingURL=
|
|
175
|
+
//# sourceMappingURL=createMcpServer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createMcpServer.js","sourceRoot":"","sources":["../../src/server/createMcpServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,O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Q,CAAC;QACd;YACE,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;YACpB,MAAM;IACV,CAAC;IAED,IAAI,OAAO,CAAC,CAAC,WAAW,KAAK,QAAQ,EAAE,CAAC;QACtC,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;IAC1C,CAAC;IAED,OAAO,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sse.d.ts","sourceRoot":"","sources":["../../src/transports/sse.ts"],"names":[],"mappings":"AA4GA,wBAAsB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAmD/C"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import http from "node:http";
|
|
2
|
+
import { randomUUID } from "node:crypto";
|
|
3
|
+
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
4
|
+
import { isInitializeRequest } from "@modelcontextprotocol/sdk/types.js";
|
|
5
|
+
import { createMcpServer } from "../server/createMcpServer.js";
|
|
6
|
+
import { createTokenStore } from "../auth.js";
|
|
7
|
+
import { log } from "../utils.js";
|
|
8
|
+
const transports = new Map();
|
|
9
|
+
/**
|
|
10
|
+
* Extracts username and password from an HTTP Basic Authorization header.
|
|
11
|
+
*
|
|
12
|
+
* Header format: Authorization: Basic <base64(username:password)>
|
|
13
|
+
* Example: Authorization: Basic am9obkBleGFtcGxlLmNvbTpzM2NyZXQ=
|
|
14
|
+
* → { username: "john@example.com", password: "s3cret" }
|
|
15
|
+
*/
|
|
16
|
+
function parseBasicAuth(header) {
|
|
17
|
+
if (!header?.startsWith("Basic "))
|
|
18
|
+
return undefined;
|
|
19
|
+
const decoded = Buffer.from(header.slice(6), "base64").toString("utf-8");
|
|
20
|
+
const sep = decoded.indexOf(":");
|
|
21
|
+
if (sep === -1)
|
|
22
|
+
return undefined;
|
|
23
|
+
const username = decoded.slice(0, sep);
|
|
24
|
+
const password = decoded.slice(sep + 1);
|
|
25
|
+
return username && password ? { username, password } : undefined;
|
|
26
|
+
}
|
|
27
|
+
function parseBody(req) {
|
|
28
|
+
return new Promise((resolve, reject) => {
|
|
29
|
+
const chunks = [];
|
|
30
|
+
req.on("data", (chunk) => chunks.push(chunk));
|
|
31
|
+
req.on("end", () => {
|
|
32
|
+
try {
|
|
33
|
+
resolve(JSON.parse(Buffer.concat(chunks).toString()));
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
reject(err);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
req.on("error", reject);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
async function handlePost(req, res) {
|
|
43
|
+
const body = await parseBody(req);
|
|
44
|
+
const sessionId = req.headers["mcp-session-id"];
|
|
45
|
+
if (sessionId && transports.has(sessionId)) {
|
|
46
|
+
await transports.get(sessionId).handleRequest(req, res, body);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (!sessionId && isInitializeRequest(body)) {
|
|
50
|
+
log(`New session from ${req.socket.remoteAddress}`);
|
|
51
|
+
const transport = new StreamableHTTPServerTransport({
|
|
52
|
+
sessionIdGenerator: () => randomUUID(),
|
|
53
|
+
onsessioninitialized: (id) => {
|
|
54
|
+
transports.set(id, transport);
|
|
55
|
+
log(`Session initialized: ${id}`);
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
transport.onclose = () => {
|
|
59
|
+
const sid = transport.sessionId;
|
|
60
|
+
if (sid) {
|
|
61
|
+
transports.delete(sid);
|
|
62
|
+
log(`Session closed: ${sid}`);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const tokenStore = createTokenStore();
|
|
66
|
+
const credentials = parseBasicAuth(req.headers.authorization);
|
|
67
|
+
const server = await createMcpServer(tokenStore, credentials);
|
|
68
|
+
await server.connect(transport);
|
|
69
|
+
await transport.handleRequest(req, res, body);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
res.writeHead(400, { "Content-Type": "application/json" });
|
|
73
|
+
res.end(JSON.stringify({
|
|
74
|
+
jsonrpc: "2.0",
|
|
75
|
+
error: { code: -32000, message: "Bad Request: No valid session ID provided" },
|
|
76
|
+
id: null,
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
79
|
+
async function handleGet(req, res) {
|
|
80
|
+
const sessionId = req.headers["mcp-session-id"];
|
|
81
|
+
if (!sessionId || !transports.has(sessionId)) {
|
|
82
|
+
res.writeHead(400, { "Content-Type": "application/json" });
|
|
83
|
+
res.end(JSON.stringify({ error: "Invalid or missing session ID" }));
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
await transports.get(sessionId).handleRequest(req, res);
|
|
87
|
+
}
|
|
88
|
+
async function handleDelete(req, res) {
|
|
89
|
+
const sessionId = req.headers["mcp-session-id"];
|
|
90
|
+
if (!sessionId || !transports.has(sessionId)) {
|
|
91
|
+
res.writeHead(400, { "Content-Type": "application/json" });
|
|
92
|
+
res.end(JSON.stringify({ error: "Invalid or missing session ID" }));
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
await transports.get(sessionId).handleRequest(req, res);
|
|
96
|
+
}
|
|
97
|
+
export async function startHTTP() {
|
|
98
|
+
const port = parseInt(process.env.PORT || "3000", 10);
|
|
99
|
+
const httpServer = http.createServer(async (req, res) => {
|
|
100
|
+
const url = new URL(req.url, `http://localhost:${port}`);
|
|
101
|
+
if (url.pathname !== "/mcp") {
|
|
102
|
+
res.writeHead(404, { "Content-Type": "application/json" });
|
|
103
|
+
res.end(JSON.stringify({ error: "Not found" }));
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
try {
|
|
107
|
+
switch (req.method) {
|
|
108
|
+
case "POST":
|
|
109
|
+
await handlePost(req, res);
|
|
110
|
+
break;
|
|
111
|
+
case "GET":
|
|
112
|
+
await handleGet(req, res);
|
|
113
|
+
break;
|
|
114
|
+
case "DELETE":
|
|
115
|
+
await handleDelete(req, res);
|
|
116
|
+
break;
|
|
117
|
+
default:
|
|
118
|
+
res.writeHead(405, { "Content-Type": "application/json" });
|
|
119
|
+
res.end(JSON.stringify({ error: "Method not allowed" }));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
catch (err) {
|
|
123
|
+
log("HTTP handler error:", err);
|
|
124
|
+
if (!res.headersSent) {
|
|
125
|
+
res.writeHead(500, { "Content-Type": "application/json" });
|
|
126
|
+
res.end(JSON.stringify({ error: "Internal server error" }));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
httpServer.listen(port, () => {
|
|
131
|
+
log(`FleetX MCP Server started in SSE mode on http://localhost:${port}/mcp`);
|
|
132
|
+
});
|
|
133
|
+
process.on("SIGINT", async () => {
|
|
134
|
+
log("Shutting down...");
|
|
135
|
+
for (const [id, transport] of transports) {
|
|
136
|
+
try {
|
|
137
|
+
await transport.close();
|
|
138
|
+
transports.delete(id);
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
// best-effort cleanup
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
process.exit(0);
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=sse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sse.js","sourceRoot":"","sources":["../../src/transports/sse.ts"],"names":[],"mappings":"AAAA,OAAO,IAAyC,MAAM,WAAW,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,eAAe,EAAe,MAAM,8BAA8B,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAA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AAsB;YACxB,CAAC;QACH,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../../src/transports/stdio.ts"],"names":[],"mappings":"AAMA,wBAAsB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAShD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
2
|
+
import { createMcpServer } from "../server/createMcpServer.js";
|
|
3
|
+
import { createTokenStore } from "../auth.js";
|
|
4
|
+
import { getUsernameLoginDetails } from "../utils.js";
|
|
5
|
+
import { log } from "../utils.js";
|
|
6
|
+
export async function startStdio() {
|
|
7
|
+
const tokenStore = createTokenStore();
|
|
8
|
+
const { username, password } = getUsernameLoginDetails();
|
|
9
|
+
const credentials = username && password ? { username, password } : undefined;
|
|
10
|
+
const server = await createMcpServer(tokenStore, credentials);
|
|
11
|
+
const transport = new StdioServerTransport();
|
|
12
|
+
await server.connect(transport);
|
|
13
|
+
log("FleetX MCP Server started in STDIO mode");
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=stdio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["../../src/transports/stdio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,MAAM,CAAC,KAAK,UAAU,UAAU;IAC9B,MAAM,UAAU,GAAG,gBAAgB,EAAE,CAAC;IACtC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,uBAAuB,EAAE,CAAC;IACzD,MAAM,WAAW,GAAG,QAAQ,IAAI,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAC9E,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IAC9D,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAE7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,GAAG,CAAC,yCAAyC,CAAC,CAAC;AACjD,CAAC"}
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,QAIrC;AAED,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAED,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAED,wBAAgB,uBAAuB,IAAI;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAKhF"}
|
package/dist/utils.js
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export function log(...args) {
|
|
6
6
|
const msg = args.map((a) => (typeof a === "string" ? a : JSON.stringify(a))).join(" ");
|
|
7
|
-
|
|
7
|
+
// opensearch compatible logging json format
|
|
8
|
+
console.error(JSON.stringify({ message: msg, level: "info" }));
|
|
8
9
|
}
|
|
9
10
|
export function getAPIDefinitionURL() {
|
|
10
11
|
return process.env.API_DEFINITION_URL ?? "https://app.fleetx.io/napp/api-reference/apis";
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,GAAG,CAAC,GAAG,IAAe;IACpC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACvF,OAAO,CAAC,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,GAAG,CAAC,GAAG,IAAe;IACpC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACvF,4CAA4C;IAC5C,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,mBAAmB;IACjC,OAAO,OAAO,CAAC,GAAG,CAAC,kBAAmB,IAAI,+CAA+C,CAAC;AAC5F,CAAC;AAED,MAAM,UAAU,WAAW;IACzB,OAAO,OAAO,CAAC,GAAG,CAAC,SAAU,IAAI,oCAAoC,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,uBAAuB;IACrC,OAAO;QACL,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,EAAE;QACnE,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,EAAE;KACpE,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fleetx_io/fleetx-mcp-server",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"description": "MCP server that gives AI agents access to the FleetX REST API. Works with Cursor, Claude Desktop, Windsurf, and any MCP-compatible client.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dev": "ts-node-dev --respawn --transpile-only ./src/index.ts",
|
|
23
23
|
"build": "tsc",
|
|
24
24
|
"publish": "npm run build && npm publish --access public",
|
|
25
|
-
"start": "node dist/index.js",
|
|
25
|
+
"start": "MCP_TRANSPORT=http NODE_ENV=production node dist/index.js",
|
|
26
26
|
"startClientLive": "npx @modelcontextprotocol/inspector ts-node-dev --respawn --transpile-only ./src/index.ts",
|
|
27
27
|
"startClient": "npx @modelcontextprotocol/inspector node dist/index.js"
|
|
28
28
|
},
|
|
@@ -41,14 +41,7 @@
|
|
|
41
41
|
],
|
|
42
42
|
"author": "FleetX <satish@fleetx.io> (https://fleetx.io)",
|
|
43
43
|
"license": "ISC",
|
|
44
|
-
"
|
|
45
|
-
"type": "git",
|
|
46
|
-
"url": "https://gitlab.stg-fleetx.io/fleetxdev/fleetx-mcp-server.git"
|
|
47
|
-
},
|
|
48
|
-
"homepage": "https://gitlab.stg-fleetx.io/fleetxdev/fleetx-mcp-server#readme",
|
|
49
|
-
"bugs": {
|
|
50
|
-
"url": "https://gitlab.stg-fleetx.io/fleetxdev/fleetx-mcp-server/issues"
|
|
51
|
-
},
|
|
44
|
+
"homepage": "https://www.npmjs.com/package/@fleetx_io/fleetx-mcp-server",
|
|
52
45
|
"engines": {
|
|
53
46
|
"node": ">=20.0.0"
|
|
54
47
|
},
|
|
@@ -60,6 +53,7 @@
|
|
|
60
53
|
"devDependencies": {
|
|
61
54
|
"@types/node": "^25.3.3",
|
|
62
55
|
"ts-node-dev": "^2.0.0",
|
|
63
|
-
"typescript": "^5.9.3"
|
|
56
|
+
"typescript": "^5.9.3",
|
|
57
|
+
"prettier": "2.0.5"
|
|
64
58
|
}
|
|
65
59
|
}
|
package/dist/mcpServer.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
-
import { TokenStore } from "./types.js";
|
|
3
|
-
/**
|
|
4
|
-
* Creates and configures the McpServer instance with login + dynamic tools.
|
|
5
|
-
* If USERNAME and PASSWORD env vars are set, auto-login and register all tools at startup.
|
|
6
|
-
*/
|
|
7
|
-
export declare function createMcpServer(tokenStore: TokenStore): Promise<McpServer>;
|
|
8
|
-
//# sourceMappingURL=mcpServer.d.ts.map
|
package/dist/mcpServer.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcpServer.d.ts","sourceRoot":"","sources":["../src/mcpServer.ts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACV,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,UAAU,EAAiB,MAAM,YAAY,CAAC;AAMvD;;;GAGG;AACH,wBAAsB,eAAe,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,CAoChF"}
|
package/dist/mcpServer.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcpServer.js","sourceRoot":"","sources":["../src/mcpServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC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