@andrebuzeli/git-mcp 5.8.2 → 5.8.4

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.
Files changed (2) hide show
  1. package/dist/index.js +25 -15
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -116,11 +116,19 @@ async function main() {
116
116
  terminal: false
117
117
  });
118
118
  rl.on('line', async (line) => {
119
- let requestId = null;
119
+ let request;
120
+ let id = undefined;
120
121
  try {
121
- const request = JSON.parse(line);
122
- const { jsonrpc, id, method, params } = request;
123
- requestId = id;
122
+ request = JSON.parse(line);
123
+ id = request.id;
124
+ const { jsonrpc, method, params } = request;
125
+ // Only respond if there's an id (not a notification)
126
+ if (id === undefined) {
127
+ if (process.env.DEBUG) {
128
+ console.error('Received notification (no id), not responding');
129
+ }
130
+ return;
131
+ }
124
132
  let response = { jsonrpc: '2.0', id };
125
133
  switch (method) {
126
134
  case 'initialize':
@@ -132,7 +140,7 @@ async function main() {
132
140
  },
133
141
  serverInfo: {
134
142
  name: 'git-mcp',
135
- version: '5.8.1'
143
+ version: '5.8.3'
136
144
  }
137
145
  };
138
146
  break;
@@ -218,16 +226,18 @@ async function main() {
218
226
  console.log(JSON.stringify(response));
219
227
  }
220
228
  catch (err) {
221
- // Always send a proper JSON-RPC error response, even for parse errors
222
- const errorResponse = {
223
- jsonrpc: '2.0',
224
- id: requestId,
225
- error: {
226
- code: -32700,
227
- message: `Parse error: ${err.message || String(err)}`
228
- }
229
- };
230
- console.log(JSON.stringify(errorResponse));
229
+ // Only send error response if we have a valid id
230
+ if (id !== undefined) {
231
+ const errorResponse = {
232
+ jsonrpc: '2.0',
233
+ id: id,
234
+ error: {
235
+ code: -32700,
236
+ message: `Parse error: ${err.message || String(err)}`
237
+ }
238
+ };
239
+ console.log(JSON.stringify(errorResponse));
240
+ }
231
241
  if (process.env.DEBUG) {
232
242
  console.error('Error processing request:', err);
233
243
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andrebuzeli/git-mcp",
3
- "version": "5.8.2",
3
+ "version": "5.8.4",
4
4
  "description": "Professional MCP server for Git operations - automatic dual-provider execution (GitHub + Gitea), no provider parameter needed, organized responses by provider, enhanced security and safety features",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",