Skip to content

Commit d5aed81

Browse files
authored
Merge branch 'main' into add_mcp_server_remote_macos_use
2 parents dcb02c1 + 95c973a commit d5aed81

File tree

6 files changed

+47
-18
lines changed

6 files changed

+47
-18
lines changed

filesystem/README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,16 @@ Node.js server implementing Model Context Protocol (MCP) for filesystem operatio
4141
- Features:
4242
- Line-based and multi-line content matching
4343
- Whitespace normalization with indentation preservation
44-
- Fuzzy matching with confidence scoring
4544
- Multiple simultaneous edits with correct positioning
4645
- Indentation style detection and preservation
4746
- Git-style diff output with context
4847
- Preview changes with dry run mode
49-
- Failed match debugging with confidence scores
5048
- Inputs:
5149
- `path` (string): File to edit
5250
- `edits` (array): List of edit operations
5351
- `oldText` (string): Text to search for (can be substring)
5452
- `newText` (string): Text to replace with
5553
- `dryRun` (boolean): Preview changes without applying (default: false)
56-
- `options` (object): Optional formatting settings
57-
- `preserveIndentation` (boolean): Keep existing indentation (default: true)
58-
- `normalizeWhitespace` (boolean): Normalize spaces while preserving structure (default: true)
59-
- `partialMatch` (boolean): Enable fuzzy matching (default: true)
6054
- Returns detailed diff and match information for dry runs, otherwise applies changes
6155
- Best Practice: Always use dryRun first to preview changes before applying them
6256

filesystem/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const allowedDirectories = args.map(dir =>
4242
// Validate that all directories exist and are accessible
4343
await Promise.all(args.map(async (dir) => {
4444
try {
45-
const stats = await fs.stat(dir);
45+
const stats = await fs.stat(expandHome(dir));
4646
if (!stats.isDirectory()) {
4747
console.error(`Error: ${dir} is not a directory`);
4848
process.exit(1);

git/uv.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/common/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export const GitHubLabelSchema = z.object({
157157
name: z.string(),
158158
color: z.string(),
159159
default: z.boolean(),
160-
description: z.string().optional(),
160+
description: z.string().nullable().optional(),
161161
});
162162

163163
export const GitHubMilestoneSchema = z.object({

github/index.ts

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
} from "@modelcontextprotocol/sdk/types.js";
88
import { z } from 'zod';
99
import { zodToJsonSchema } from 'zod-to-json-schema';
10+
import fetch, { Request, Response } from 'node-fetch';
1011

1112
import * as repository from './operations/repository.js';
1213
import * as files from './operations/files.js';
@@ -27,6 +28,11 @@ import {
2728
} from './common/errors.js';
2829
import { VERSION } from "./common/version.js";
2930

31+
// If fetch doesn't exist in global scope, add it
32+
if (!globalThis.fetch) {
33+
globalThis.fetch = fetch as unknown as typeof global.fetch;
34+
}
35+
3036
const server = new Server(
3137
{
3238
name: "github-mcp-server",
@@ -293,10 +299,39 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
293299
case "create_issue": {
294300
const args = issues.CreateIssueSchema.parse(request.params.arguments);
295301
const { owner, repo, ...options } = args;
296-
const issue = await issues.createIssue(owner, repo, options);
297-
return {
298-
content: [{ type: "text", text: JSON.stringify(issue, null, 2) }],
299-
};
302+
303+
try {
304+
console.error(`[DEBUG] Attempting to create issue in ${owner}/${repo}`);
305+
console.error(`[DEBUG] Issue options:`, JSON.stringify(options, null, 2));
306+
307+
const issue = await issues.createIssue(owner, repo, options);
308+
309+
console.error(`[DEBUG] Issue created successfully`);
310+
return {
311+
content: [{ type: "text", text: JSON.stringify(issue, null, 2) }],
312+
};
313+
} catch (err) {
314+
// Type guard for Error objects
315+
const error = err instanceof Error ? err : new Error(String(err));
316+
317+
console.error(`[ERROR] Failed to create issue:`, error);
318+
319+
if (error instanceof GitHubResourceNotFoundError) {
320+
throw new Error(
321+
`Repository '${owner}/${repo}' not found. Please verify:\n` +
322+
`1. The repository exists\n` +
323+
`2. You have correct access permissions\n` +
324+
`3. The owner and repository names are spelled correctly`
325+
);
326+
}
327+
328+
// Safely access error properties
329+
throw new Error(
330+
`Failed to create issue: ${error.message}${
331+
error.stack ? `\nStack: ${error.stack}` : ''
332+
}`
333+
);
334+
}
300335
}
301336

302337
case "create_pull_request": {

gitlab/schemas.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ export const GitLabRepositorySchema = z.object({
2222
name: z.string(),
2323
path_with_namespace: z.string(), // Changed from full_name to match GitLab API
2424
visibility: z.string(), // Changed from private to match GitLab API
25-
owner: GitLabOwnerSchema,
25+
owner: GitLabOwnerSchema.optional(),
2626
web_url: z.string(), // Changed from html_url to match GitLab API
2727
description: z.string().nullable(),
28-
fork: z.boolean(),
28+
fork: z.boolean().optional(),
2929
ssh_url_to_repo: z.string(), // Changed from ssh_url to match GitLab API
3030
http_url_to_repo: z.string(), // Changed from clone_url to match GitLab API
3131
created_at: z.string(),
@@ -218,12 +218,12 @@ export const GitLabMergeRequestSchema = z.object({
218218
title: z.string(),
219219
description: z.string(), // Changed from body to match GitLab API
220220
state: z.string(),
221-
merged: z.boolean(),
221+
merged: z.boolean().optional(),
222222
author: GitLabUserSchema,
223223
assignees: z.array(GitLabUserSchema),
224224
source_branch: z.string(), // Changed from head to match GitLab API
225225
target_branch: z.string(), // Changed from base to match GitLab API
226-
diff_refs: GitLabMergeRequestDiffRefSchema,
226+
diff_refs: GitLabMergeRequestDiffRefSchema.nullable(),
227227
web_url: z.string(), // Changed from html_url to match GitLab API
228228
created_at: z.string(),
229229
updated_at: z.string(),

0 commit comments

Comments
 (0)