Skip to content

Commit 10584c6

Browse files
authored
Merge branch 'main' into patch-1
2 parents 38faf4e + 9735df6 commit 10584c6

File tree

10 files changed

+741
-130
lines changed

10 files changed

+741
-130
lines changed

README.md

Lines changed: 27 additions & 1 deletion
Large diffs are not rendered by default.

package-lock.json

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

src/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

src/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);

src/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.

src/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({

src/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": {

src/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(),

src/mssql-mcp

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/redis/package.json

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,31 @@
11
{
2-
"name": "redis",
3-
"version": "1.0.0",
4-
"main": "index.js",
2+
"name": "@modelcontextprotocol/server-redis",
3+
"version": "0.1.0",
4+
"description": "MCP server for using Redis",
5+
"license": "MIT",
6+
"author": "Anthropic, PBC (https://anthropic.com)",
7+
"homepage": "https://modelcontextprotocol.io",
8+
"bugs": "https://github.com/modelcontextprotocol/servers/issues",
59
"type": "module",
610
"bin": {
711
"redis": "./build/index.js"
812
},
9-
"scripts": {
10-
"build": "tsc && node -e \"require('fs').chmodSync('build/index.js', '755')\""
11-
},
1213
"files": [
1314
"build"
1415
],
15-
"keywords": [],
16-
"author": "",
17-
"license": "ISC",
18-
"description": "",
19-
"devDependencies": {
20-
"@types/node": "^22.10.2",
21-
"typescript": "^5.7.2"
16+
"scripts": {
17+
"build": "tsc && shx chmod +x build/*.js",
18+
"prepare": "npm run build",
19+
"watch": "tsc --watch"
2220
},
2321
"dependencies": {
24-
"@modelcontextprotocol/sdk": "^0.4.0",
22+
"@modelcontextprotocol/sdk": "^1.7.0",
23+
"@types/node": "^22.10.2",
2524
"@types/redis": "^4.0.10",
2625
"redis": "^4.7.0"
26+
},
27+
"devDependencies": {
28+
"shx": "^0.3.4",
29+
"typescript": "^5.7.2"
2730
}
2831
}

0 commit comments

Comments
 (0)