@mgsoftwarebv/mcp-server-bridge 3.0.0 → 3.0.1
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 +115 -154
- package/dist/index.js +1842 -1346
- package/dist/index.js.map +1 -1
- package/package.json +7 -4
- package/dist/index.d.ts +0 -1
package/README.md
CHANGED
|
@@ -1,248 +1,209 @@
|
|
|
1
1
|
# @mgsoftwarebv/mcp-server-bridge
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
An MCP server that connects **Cursor / Claude Desktop / Windsurf** directly to your **Refront** Postgres database, exposing tickets, customers, projects, AI dev sessions and time tracking as MCP tools and resources.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Since v3.0 the bridge talks straight to Postgres via Drizzle ORM — the previous PostgREST/JWT transport has been removed.
|
|
6
|
+
|
|
7
|
+
## 📦 Installation
|
|
6
8
|
|
|
7
9
|
```bash
|
|
8
10
|
npm install -g @mgsoftwarebv/mcp-server-bridge
|
|
9
11
|
```
|
|
10
12
|
|
|
11
|
-
## 🔧 Cursor
|
|
13
|
+
## 🔧 Cursor Configuration
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
Add the following to your `~/.cursor/mcp.json`. You always need two things:
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
1. An **API key** from your Refront dashboard (`/settings/developer`, format `mid_...`).
|
|
18
|
+
2. A **Postgres connection string** for your Refront database (`DATABASE_URL`).
|
|
16
19
|
|
|
17
20
|
```json
|
|
18
21
|
{
|
|
19
22
|
"mcpServers": {
|
|
20
|
-
"
|
|
23
|
+
"refront": {
|
|
21
24
|
"command": "npx",
|
|
22
25
|
"args": [
|
|
23
26
|
"-y",
|
|
24
27
|
"@mgsoftwarebv/mcp-server-bridge@latest",
|
|
25
|
-
"--api-key=mid_your_api_key_here"
|
|
28
|
+
"--api-key=mid_your_api_key_here",
|
|
29
|
+
"--database-url=postgresql://USER:PASSWORD@HOST:PORT/DBNAME"
|
|
26
30
|
]
|
|
27
31
|
}
|
|
28
32
|
}
|
|
29
33
|
}
|
|
30
34
|
```
|
|
31
35
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
### Voor Eigen Database (Advanced)
|
|
36
|
+
Both values can also be supplied via environment variables instead of CLI flags:
|
|
35
37
|
|
|
36
38
|
```json
|
|
37
39
|
{
|
|
38
40
|
"mcpServers": {
|
|
39
|
-
"
|
|
41
|
+
"refront": {
|
|
40
42
|
"command": "npx",
|
|
41
|
-
"args": [
|
|
42
|
-
"-y",
|
|
43
|
-
"@mgsoftwarebv/mcp-server-bridge@latest",
|
|
44
|
-
"--api-key=mid_your_api_key_here"
|
|
45
|
-
],
|
|
43
|
+
"args": ["-y", "@mgsoftwarebv/mcp-server-bridge@latest"],
|
|
46
44
|
"env": {
|
|
47
|
-
"
|
|
48
|
-
"
|
|
45
|
+
"MG_TICKETS_API_KEY": "mid_your_api_key_here",
|
|
46
|
+
"DATABASE_PRIMARY_POOLER_URL": "postgresql://USER:PASSWORD@HOST:PORT/DBNAME"
|
|
49
47
|
}
|
|
50
48
|
}
|
|
51
49
|
}
|
|
52
50
|
}
|
|
53
51
|
```
|
|
54
52
|
|
|
55
|
-
### 🔑 API Key
|
|
53
|
+
### 🔑 Getting an API Key
|
|
56
54
|
|
|
57
|
-
1.
|
|
58
|
-
2.
|
|
59
|
-
3.
|
|
60
|
-
4.
|
|
55
|
+
1. Go to your Refront dashboard: `/settings/developer`
|
|
56
|
+
2. Create a new API key
|
|
57
|
+
3. Copy the key (format: `mid_...`)
|
|
58
|
+
4. Use it in your MCP configuration
|
|
61
59
|
|
|
62
|
-
|
|
60
|
+
### 🗄️ Getting the Database URL
|
|
63
61
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
- **Refront SaaS customers**: ask MG Software for a read-only Postgres user that points at your team's database (we do not hardcode a default connection string here for security reasons).
|
|
63
|
+
- **Self-hosted**: use the same `DATABASE_PRIMARY_POOLER_URL` you configured for the API/dashboard.
|
|
64
|
+
|
|
65
|
+
The bridge uses `@refront/db/job-client`, which is tuned for a single connection per process and gracefully closes idle connections.
|
|
67
66
|
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
## 📋 Command-Line Options
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Basic usage
|
|
71
|
+
mg-tickets-mcp --api-key=mid_your_key --database-url=postgresql://...
|
|
70
72
|
|
|
71
73
|
# Via environment variables
|
|
72
|
-
export MG_TICKETS_API_KEY=
|
|
73
|
-
export
|
|
74
|
+
export MG_TICKETS_API_KEY=mid_your_key
|
|
75
|
+
export DATABASE_PRIMARY_POOLER_URL=postgresql://USER:PASSWORD@HOST:PORT/DBNAME
|
|
74
76
|
mg-tickets-mcp
|
|
75
77
|
```
|
|
76
78
|
|
|
77
|
-
|
|
79
|
+
`--database-url` falls back to `DATABASE_PRIMARY_POOLER_URL`, then to `DATABASE_URL`. The bridge exits at startup if no connection string is provided.
|
|
78
80
|
|
|
79
|
-
|
|
81
|
+
For attachment downloads you also need to expose Cloudflare R2 credentials (`R2_ENDPOINT`, `R2_ACCESS_KEY_ID`, `R2_SECRET_ACCESS_KEY`, optional `R2_PUBLIC_DOMAIN`). Without them the attachment / image inlining tools will return an error, but everything else keeps working.
|
|
80
82
|
|
|
81
|
-
|
|
82
|
-
- **get-tickets** - Haal tickets op met filters
|
|
83
|
-
- **get-ticket-by-id** - Haal een specifieke ticket op
|
|
84
|
-
- **create-ticket** - Maak een nieuwe ticket aan
|
|
85
|
-
- **get-customers** - Haal customers op
|
|
86
|
-
- **get-customer-by-id** - Haal een specifieke customer op
|
|
87
|
-
- **create-customer** - Maak een nieuwe customer aan
|
|
88
|
-
- **get-projects** - Haal projects op
|
|
89
|
-
- **get-project-by-id** - Haal een specifiek project op
|
|
90
|
-
- **create-project** - Maak een nieuw project aan
|
|
83
|
+
## 🏢 Multi-provider support
|
|
91
84
|
|
|
92
|
-
|
|
93
|
-
- **start-ai-session-smart** - Start AI development sessie met time tracking
|
|
94
|
-
- **track-manual-follow-up** - Track manual follow-ups
|
|
95
|
-
- **sync-session-todos** - Synchroniseer todos met sessie
|
|
96
|
-
- **complete-ai-session** - Voltooi AI sessie met samenvatting
|
|
97
|
-
- **get-completion-context** - Haal completion context op
|
|
98
|
-
- **save-customer-response** - Sla customer response op
|
|
85
|
+
A single API key now works even if you belong to **multiple providers** (workspaces). The key is bound to one provider as its default, but every team-scoped tool accepts an optional `teamId` argument that is validated against your team memberships.
|
|
99
86
|
|
|
100
|
-
|
|
101
|
-
- **log-hours** 🆕 - Analyseer chat conversatie en log uren automatisch naar agenda (zie Cursor Command `/hours`)
|
|
87
|
+
How it resolves which provider a tool acts on:
|
|
102
88
|
|
|
103
|
-
|
|
89
|
+
- **`teamId` provided** → it is validated against your memberships and used.
|
|
90
|
+
- **`teamId` omitted, you belong to one provider** → that provider is used automatically (no change for single-provider users).
|
|
91
|
+
- **`teamId` omitted, you belong to several** → list/create tools return the list of your providers and ask the AI to re-call with a `teamId`. By-id and session tools resolve across all your providers (the record id disambiguates), and accept `teamId` to narrow.
|
|
104
92
|
|
|
105
|
-
|
|
93
|
+
Use **get-teams** to list the providers you can act on and copy a `teamId`.
|
|
106
94
|
|
|
107
|
-
|
|
108
|
-
2. **Type `/hours`** - wanneer je klaar bent
|
|
109
|
-
3. **AI analyseert de chat** en schat in hoeveel tijd een senior developer (zonder AI) zou besteden
|
|
110
|
-
4. **Automatische projectkoppeling** - gebruikt je workspace folder naam
|
|
111
|
-
5. **Draft entry** - wordt aangemaakt in de tracker (niet direct gefactureerd)
|
|
95
|
+
## 🛠️ Available Tools
|
|
112
96
|
|
|
113
|
-
###
|
|
97
|
+
### Teams
|
|
98
|
+
- **get-teams** — list the provider teams (workspaces) you can act on; use a returned id as `teamId` on other tools
|
|
114
99
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
100
|
+
### Tickets, Customers & Projects
|
|
101
|
+
- **get-tickets** — list tickets with filters (status, priority, project, customer, text query)
|
|
102
|
+
- **get-ticket-by-id** — fetch one ticket with comment text, a full attachment listing (ids), and inline images (base64)
|
|
103
|
+
- **create-ticket** — create a new ticket
|
|
104
|
+
- **update-ticket** — update fields (title, description, status, priority, type, project, customer, assignee, estimated hours); `assigneeId: null` unassigns
|
|
105
|
+
- **add-ticket-comment** — add a comment (plain text or TipTap JSON); `isInternal` for internal-only notes
|
|
106
|
+
- **get-ticket-comments** — read all comments as plain text (author, internal flag, timestamp)
|
|
107
|
+
- **get-ticket-attachment** — get a 1-hour signed download URL for any ticket/comment attachment (any file type)
|
|
108
|
+
- **get-customers** — list/search customers
|
|
109
|
+
- **create-customer** — create a customer
|
|
110
|
+
- **get-projects** — list/search projects
|
|
111
|
+
- **create-project** — create a project
|
|
123
112
|
|
|
124
|
-
|
|
113
|
+
> **Note:** Ticket writes (`update-ticket`, `add-ticket-comment`) are recorded in the dashboard's ticket activity feed but do **not** send notifications (email/Slack/in-app) or trigger `@mention` routing. Notification delivery is a planned follow-up.
|
|
125
114
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
Type: /hours
|
|
144
|
-
|
|
145
|
-
AI doet:
|
|
146
|
-
1. Haalt projecten op: ["Internal Tickets V2", "Client Portal", ...]
|
|
147
|
-
2. Geen match gevonden voor "random-scripts"
|
|
148
|
-
3. Logt zonder project:
|
|
149
|
-
- Project: (No project assigned)
|
|
150
|
-
- Description: "Script improvements: Added data migration script"
|
|
151
|
-
- Hours: 0.5h
|
|
152
|
-
- Status: DRAFT
|
|
153
|
-
```
|
|
115
|
+
### AI Development Tracking
|
|
116
|
+
- **start-ai-session-smart** — start an AI dev session with time tracking
|
|
117
|
+
- **track-manual-follow-up** — record a manual follow-up prompt and adjust the time estimate
|
|
118
|
+
- **sync-session-todos** — replace/extend the todo list for a session
|
|
119
|
+
- **add-follow-up-todos** — append todos that came up during follow-up
|
|
120
|
+
- **update-session-status** — change the session status (`started`, `in_progress`, `paused`, `completed`, `failed`)
|
|
121
|
+
- **get-session-context** — read back current session state (ticket, todos, follow-ups)
|
|
122
|
+
- **get-completion-context** — full context bundle for generating a customer response
|
|
123
|
+
- **save-customer-response** — store the AI-generated customer response for provider approval
|
|
124
|
+
- **complete-ai-session** — finalize the session, create/update a draft agenda event
|
|
125
|
+
|
|
126
|
+
### Time Tracking
|
|
127
|
+
- **log-hours** — log work hours as a draft agenda event (see the `/hours` Cursor command)
|
|
128
|
+
|
|
129
|
+
### GitHub Code Exploration
|
|
130
|
+
- **get-github-file** — read one file from the GitHub repo linked to a project
|
|
131
|
+
- **list-github-directory** — list a directory in the GitHub repo linked to a project
|
|
154
132
|
|
|
155
|
-
|
|
133
|
+
## ⏱️ Quick Hour Logging with `/hours`
|
|
156
134
|
|
|
157
|
-
|
|
158
|
-
- ✅ Realistische schatting (senior dev zonder AI)
|
|
159
|
-
- ✅ **Slimme projectkoppeling** - AI matched workspace naam semantisch
|
|
160
|
-
- ✅ Vraagt bevestiging bij twijfel over project
|
|
161
|
-
- ✅ Chat context als documentatie
|
|
162
|
-
- ✅ Draft entries voor review
|
|
135
|
+
The `/hours` Cursor command makes logging time effortless:
|
|
163
136
|
|
|
164
|
-
|
|
137
|
+
1. **Do your work in Cursor** — chat and code normally.
|
|
138
|
+
2. **Type `/hours`** when you're done.
|
|
139
|
+
3. **The AI analyzes the chat** and estimates how long a senior developer (without AI) would have spent.
|
|
140
|
+
4. **Workspace ↔ project matching** is automatic where possible.
|
|
141
|
+
5. **A draft entry** is created in the tracker (not billed yet).
|
|
165
142
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
143
|
+
### How it works
|
|
144
|
+
|
|
145
|
+
1. Lists all projects via `get-projects`.
|
|
146
|
+
2. Matches the workspace folder name to the closest project (or skips matching when ambiguous).
|
|
147
|
+
3. Analyzes the chat — what was built/fixed.
|
|
148
|
+
4. Estimates a realistic time budget (investigation + implementation + testing).
|
|
149
|
+
5. Creates a tracker entry as draft.
|
|
150
|
+
|
|
151
|
+
## 📚 Available Resources
|
|
152
|
+
|
|
153
|
+
- **tickets://recent** — most recent tickets across all accessible teams
|
|
154
|
+
- **customers://all** — all accessible customers
|
|
155
|
+
- **projects://active** — all accessible projects
|
|
169
156
|
|
|
170
157
|
## 🔍 Debugging
|
|
171
158
|
|
|
172
|
-
|
|
159
|
+
The bridge logs to stderr so you can capture debug output without breaking the MCP stdio protocol:
|
|
173
160
|
|
|
174
161
|
```bash
|
|
175
|
-
|
|
176
|
-
mg-tickets-mcp --api-key=mid_your_key_here 2>debug.log
|
|
162
|
+
mg-tickets-mcp --api-key=mid_... --database-url=postgresql://... 2>debug.log
|
|
177
163
|
```
|
|
178
164
|
|
|
179
|
-
Debug output
|
|
180
|
-
-
|
|
181
|
-
-
|
|
182
|
-
-
|
|
183
|
-
-
|
|
165
|
+
Debug output shows:
|
|
166
|
+
- Database connection / startup status
|
|
167
|
+
- API key validation hash
|
|
168
|
+
- Tool dispatch and access decisions
|
|
169
|
+
- Errors with stack traces
|
|
184
170
|
|
|
185
171
|
## 🏗️ Development
|
|
186
172
|
|
|
187
173
|
```bash
|
|
188
|
-
# Clone het project
|
|
189
174
|
git clone https://github.com/mgsoftwarebv/tickets-v2.git
|
|
190
175
|
cd tickets-v2/packages/mcp-server-bridge
|
|
191
176
|
|
|
192
|
-
# Installeer dependencies
|
|
193
177
|
bun install
|
|
194
|
-
|
|
195
|
-
# Build
|
|
196
178
|
bun run build
|
|
197
179
|
|
|
198
|
-
|
|
199
|
-
node dist/index.js --api-key=mid_your_key_here
|
|
180
|
+
node dist/index.js --api-key=mid_... --database-url=postgresql://...
|
|
200
181
|
```
|
|
201
182
|
|
|
202
183
|
## 🔄 Updates
|
|
203
184
|
|
|
204
185
|
```bash
|
|
205
|
-
# Update naar nieuwste versie
|
|
206
186
|
npm update -g @mgsoftwarebv/mcp-server-bridge
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
npx @mgsoftwarebv/mcp-server-bridge@latest --api-key=mid_your_key_here
|
|
187
|
+
# Or via npx (no install required)
|
|
188
|
+
npx @mgsoftwarebv/mcp-server-bridge@latest --api-key=mid_...
|
|
210
189
|
```
|
|
211
190
|
|
|
212
191
|
## 🆘 Troubleshooting
|
|
213
192
|
|
|
214
193
|
### ❌ "API key is required"
|
|
215
|
-
-
|
|
216
|
-
-
|
|
194
|
+
- Pass `--api-key=` or set `MG_TICKETS_API_KEY`.
|
|
195
|
+
- Make sure the key has the format `mid_...` (length 68).
|
|
217
196
|
|
|
218
|
-
### ❌ "
|
|
219
|
-
-
|
|
220
|
-
-
|
|
221
|
-
- Controleer firewall/netwerk instellingen
|
|
197
|
+
### ❌ "Database URL is required"
|
|
198
|
+
- Pass `--database-url=postgresql://...` or set `DATABASE_PRIMARY_POOLER_URL` / `DATABASE_URL`.
|
|
199
|
+
- Confirm the user can reach the database from your machine (firewall, VPN, etc).
|
|
222
200
|
|
|
223
|
-
### ❌ "
|
|
224
|
-
-
|
|
225
|
-
-
|
|
201
|
+
### ❌ "API key not found or invalid"
|
|
202
|
+
- Generate a new API key in `/settings/developer` and check it is enabled.
|
|
203
|
+
- Confirm the key belongs to a team that exists in the database you're connecting to.
|
|
226
204
|
|
|
227
|
-
###
|
|
228
|
-
|
|
229
|
-
# Voeg debug output toe aan je mcp.json
|
|
230
|
-
{
|
|
231
|
-
"mcpServers": {
|
|
232
|
-
"mg-tickets-v2": {
|
|
233
|
-
"command": "npx",
|
|
234
|
-
"args": [
|
|
235
|
-
"-y",
|
|
236
|
-
"@mgsoftwarebv/mcp-server-bridge@latest",
|
|
237
|
-
"--api-key=mid_your_key_here"
|
|
238
|
-
],
|
|
239
|
-
"env": {
|
|
240
|
-
"NODE_ENV": "development"
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
```
|
|
205
|
+
### ❌ "R2 storage is not configured"
|
|
206
|
+
- Image / attachment tools need `R2_ENDPOINT`, `R2_ACCESS_KEY_ID`, `R2_SECRET_ACCESS_KEY`. Set them in the `env` block of your `mcp.json` if you need attachment support.
|
|
246
207
|
|
|
247
208
|
## 📄 License
|
|
248
209
|
|