@mgsoftwarebv/mcp-server-bridge 3.0.0 → 3.0.2

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 CHANGED
@@ -1,248 +1,209 @@
1
1
  # @mgsoftwarebv/mcp-server-bridge
2
2
 
3
- Een MCP Server bridge die **Cursor** verbindt met de **MG Tickets HTTP MCP Server**. Deze bridge implementeert het stdio MCP protocol en communiceert met jouw Supabase Edge Function MCP server.
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
- ## 📦 Installatie
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 Configuratie
13
+ ## 🔧 Cursor Configuration
12
14
 
13
- ### Voor Refront SaaS Klanten (Aanbevolen)
15
+ Add the following to your `~/.cursor/mcp.json`. You always need two things:
14
16
 
15
- Voeg het volgende toe aan je `~/.cursor/mcp.json`:
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
- "mg-tickets": {
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
- **Dat is alles!** Geen database credentials, geen Supabase URL - alleen je API key.
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
- "mg-tickets-custom": {
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
- "SUPABASE_URL": "https://your-project.supabase.co",
48
- "SUPABASE_SERVICE_ROLE_KEY": "your_service_role_key"
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 Krijgen
53
+ ### 🔑 Getting an API Key
56
54
 
57
- 1. Ga naar je MG Tickets dashboard: `http://localhost:3001/settings/developer`
58
- 2. Maak een nieuwe API key aan
59
- 3. Kopieer de key (formaat: `mid_...`)
60
- 4. Gebruik deze in je configuratie
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
- ## 📋 Command-Line Opties
60
+ ### 🗄️ Getting the Database URL
63
61
 
64
- ```bash
65
- # Basis gebruik
66
- mg-tickets-mcp --api-key=mid_your_key_here
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
- # Met custom base URL
69
- mg-tickets-mcp --api-key=mid_your_key_here --base-url=https://your-custom-domain.com/functions/v1/mcp-server
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=mid_your_key_here
73
- export MG_TICKETS_BASE_URL=https://cvjdbczxyczjnatuolsk.supabase.co/functions/v1/mcp-server
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
- ## 🛠️ Beschikbare Tools
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
- De bridge geeft toegang tot alle tools van je MCP server:
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
- ### Tickets & Projects
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
- ### AI Development Tracking
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
- ### Time Tracking
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
- ## ⏱️ Quick Hour Logging met `/hours` Command
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
- De nieuwe `/hours` Cursor command maakt het super eenvoudig om uren te loggen:
93
+ Use **get-teams** to list the providers you can act on and copy a `teamId`.
106
94
 
107
- 1. **Voer je werk uit in Cursor** - gewoon normaal chatten en coderen
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
- ### Hoe werkt het?
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
- De AI:
116
- 1. **Haalt alle beschikbare projecten op** via `get-projects`
117
- 2. **Matched workspace intelligent** (bijv. "tickets-v2" "Internal Tickets V2")
118
- - Geen match? Logt zonder project
119
- - Meerdere matches? Vraagt gebruiker
120
- 3. **Analyseert de chat** - wat is er gebouwd/opgelost
121
- 4. **Schat realistische tijd** (investigation + implementation + testing)
122
- 5. **Maakt tracker entry** als draft (met of zonder project)
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
- ### Voorbeeld:
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
- Workspace: "tickets-v2"
128
- Type: /hours
129
-
130
- AI doet:
131
- 1. Haalt projecten op: ["Internal Tickets V2", "Client Portal", ...]
132
- 2. Match: "tickets-v2" "Internal Tickets V2"
133
- 3. Analyseert chat: Auth improvements
134
- 4. Schatting: 2 uur senior dev tijd
135
- 5. Creëert entry:
136
- - Project: Internal Tickets V2
137
- - Description: "Authentication improvements: Fixed login bug and added password validation"
138
- - Hours: 2h
139
- - Status: DRAFT
140
-
141
- Of zonder project match:
142
- Workspace: "random-scripts"
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
- ### Voordelen:
133
+ ## ⏱️ Quick Hour Logging with `/hours`
156
134
 
157
- - Geen handmatig uren bijhouden tijdens het werk
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
- ## 📚 Beschikbare Resources
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
- - **tickets://recent** - Recente tickets across alle teams
167
- - **customers://all** - Alle customers
168
- - **projects://active** - Actieve projects
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
- De bridge server logt naar stderr, zodat je debug informatie kunt zien:
159
+ The bridge logs to stderr so you can capture debug output without breaking the MCP stdio protocol:
173
160
 
174
161
  ```bash
175
- # Run met debug output
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 toont:
180
- - Verbindingsstatus met HTTP server
181
- - Tool uitvoering details
182
- - Authenticatie informatie
183
- - Error details
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
- # Test lokaal
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
- # Of via npx (geen installatie vereist)
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
- - Zorg dat je `--api-key=` meegeeft of `MG_TICKETS_API_KEY` environment variable hebt ingesteld
216
- - Controleer dat je API key het juiste formaat heeft: `mid_...`
194
+ - Pass `--api-key=` or set `MG_TICKETS_API_KEY`.
195
+ - Make sure the key has the format `mid_...` (length 68).
217
196
 
218
- ### ❌ "Failed to connect to HTTP server"
219
- - Controleer dat je MCP server draait op de juiste URL
220
- - Test je API key via browser of curl
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
- ### ❌ "Invalid API key"
224
- - Maak een nieuwe API key aan in je developer settings
225
- - Zorg dat de key toegang heeft tot de juiste scopes
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
- ### 🔧 Debug Mode
228
- ```bash
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