Skip to content

Commit 32e48d7

Browse files
authored
Merge branch 'main' into main
2 parents 59aa571 + f33d192 commit 32e48d7

File tree

12 files changed

+244
-56
lines changed

12 files changed

+244
-56
lines changed

everything/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,20 @@ Resource features:
9696
- `style` (string): Output style preference
9797
- Returns: Multi-turn conversation with images
9898

99+
### Logging
100+
101+
The server sends random-leveled log messages every 15 seconds, e.g.:
102+
103+
```json
104+
{
105+
"method": "notifications/message",
106+
"params": {
107+
"level": "info",
108+
"data": "Info-level message"
109+
}
110+
}
111+
```
112+
99113
## Usage with Claude Desktop
100114

101115
Add to your `claude_desktop_config.json`:

everything/everything.ts

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
ListResourcesRequestSchema,
1010
ListResourceTemplatesRequestSchema,
1111
ListToolsRequestSchema,
12+
LoggingLevel,
1213
ReadResourceRequestSchema,
1314
Resource,
1415
SetLevelRequestSchema,
@@ -99,10 +100,10 @@ export const createServer = () => {
99100
);
100101

101102
let subscriptions: Set<string> = new Set();
102-
let updateInterval: NodeJS.Timeout | undefined;
103-
103+
let subsUpdateInterval: NodeJS.Timeout | undefined;
104104
// Set up update interval for subscribed resources
105-
updateInterval = setInterval(() => {
105+
106+
subsUpdateInterval = setInterval(() => {
106107
for (const uri of subscriptions) {
107108
server.notification({
108109
method: "notifications/resources/updated",
@@ -111,6 +112,34 @@ export const createServer = () => {
111112
}
112113
}, 5000);
113114

115+
let logLevel: LoggingLevel = "debug";
116+
let logsUpdateInterval: NodeJS.Timeout | undefined;
117+
const messages = [
118+
{level: "debug", data: "Debug-level message"},
119+
{level: "info", data: "Info-level message"},
120+
{level: "notice", data: "Notice-level message"},
121+
{level: "warning", data: "Warning-level message"},
122+
{level: "error", data: "Error-level message"},
123+
{level: "critical", data: "Critical-level message"},
124+
{level: "alert", data: "Alert level-message"},
125+
{level: "emergency", data: "Emergency-level message"}
126+
]
127+
128+
const isMessageIgnored = (level:LoggingLevel):boolean => {
129+
const currentLevel = messages.findIndex((msg) => logLevel === msg.level);
130+
const messageLevel = messages.findIndex((msg) => level === msg.level);
131+
return messageLevel < currentLevel;
132+
}
133+
134+
// Set up update interval for random log messages
135+
logsUpdateInterval = setInterval(() => {
136+
let message = {
137+
method: "notifications/message",
138+
params: messages[Math.floor(Math.random() * messages.length)],
139+
}
140+
if (!isMessageIgnored(message.params.level as LoggingLevel)) server.notification(message);
141+
}, 15000);
142+
114143
// Helper method to request sampling from client
115144
const requestSampling = async (
116145
context: string,
@@ -451,7 +480,7 @@ export const createServer = () => {
451480

452481
if (name === ToolName.ANNOTATED_MESSAGE) {
453482
const { messageType, includeImage } = AnnotatedMessageSchema.parse(args);
454-
483+
455484
const content = [];
456485

457486
// Main message with different priorities/audiences based on type
@@ -511,7 +540,7 @@ export const createServer = () => {
511540
if (!resourceId) return { completion: { values: [] } };
512541

513542
// Filter resource IDs that start with the input value
514-
const values = EXAMPLE_COMPLETIONS.resourceId.filter(id =>
543+
const values = EXAMPLE_COMPLETIONS.resourceId.filter(id =>
515544
id.startsWith(argument.value)
516545
);
517546
return { completion: { values, hasMore: false, total: values.length } };
@@ -522,7 +551,7 @@ export const createServer = () => {
522551
const completions = EXAMPLE_COMPLETIONS[argument.name as keyof typeof EXAMPLE_COMPLETIONS];
523552
if (!completions) return { completion: { values: [] } };
524553

525-
const values = completions.filter(value =>
554+
const values = completions.filter(value =>
526555
value.startsWith(argument.value)
527556
);
528557
return { completion: { values, hasMore: false, total: values.length } };
@@ -533,24 +562,24 @@ export const createServer = () => {
533562

534563
server.setRequestHandler(SetLevelRequestSchema, async (request) => {
535564
const { level } = request.params;
565+
logLevel = level;
536566

537567
// Demonstrate different log levels
538568
await server.notification({
539569
method: "notifications/message",
540570
params: {
541571
level: "debug",
542572
logger: "test-server",
543-
data: `Logging level set to: ${level}`,
573+
data: `Logging level set to: ${logLevel}`,
544574
},
545575
});
546576

547577
return {};
548578
});
549579

550580
const cleanup = async () => {
551-
if (updateInterval) {
552-
clearInterval(updateInterval);
553-
}
581+
if (subsUpdateInterval) clearInterval(subsUpdateInterval);
582+
if (logsUpdateInterval) clearInterval(logsUpdateInterval);
554583
};
555584

556585
return { server, cleanup };

fetch/src/mcp_server_fetch/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ class Fetch(BaseModel):
173173
bool,
174174
Field(
175175
default=False,
176-
description="Get the actual HTML content if the requested page, without simplification.",
176+
description="Get the actual HTML content of the requested page, without simplification.",
177177
),
178178
]
179179

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

puppeteer/README.md

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ A Model Context Protocol server that provides browser automation capabilities us
88

99
- **puppeteer_navigate**
1010
- Navigate to any URL in the browser
11-
- Input: `url` (string)
11+
- Inputs:
12+
- `url` (string, required): URL to navigate to
13+
- `launchOptions` (object, optional): PuppeteerJS LaunchOptions. Default null. If changed and not null, browser restarts. Example: `{ headless: true, args: ['--user-data-dir="C:/Data"'] }`
14+
- `allowDangerous` (boolean, optional): Allow dangerous LaunchOptions that reduce security. When false, dangerous args like `--no-sandbox`, `--disable-web-security` will throw errors. Default false.
1215

1316
- **puppeteer_screenshot**
1417
- Capture screenshots of the entire page or specific elements
@@ -61,6 +64,7 @@ The server provides access to two types of resources:
6164
- Screenshot capabilities
6265
- JavaScript execution
6366
- Basic web interaction (navigation, clicking, form filling)
67+
- Customizable Puppeteer launch options
6468

6569
## Configuration to use Puppeteer Server
6670
Here's the Claude Desktop configuration to use the Puppeter server:
@@ -93,6 +97,39 @@ Here's the Claude Desktop configuration to use the Puppeter server:
9397
}
9498
```
9599

100+
### Launch Options
101+
102+
You can customize Puppeteer's browser behavior in two ways:
103+
104+
1. **Environment Variable**: Set `PUPPETEER_LAUNCH_OPTIONS` with a JSON-encoded string in the MCP configuration's `env` parameter:
105+
106+
```json
107+
{
108+
"mcpServers": {
109+
"mcp-puppeteer": {
110+
"command": "npx",
111+
"args": ["-y", "@modelcontextprotocol/server-puppeteer"]
112+
"env": {
113+
"PUPPETEER_LAUNCH_OPTIONS": "{ \"headless\": false, \"executablePath\": \"C:/Program Files/Google/Chrome/Application/chrome.exe\", \"args\": [] }",
114+
"ALLOW_DANGEROUS": "true"
115+
}
116+
}
117+
}
118+
}
119+
```
120+
121+
2. **Tool Call Arguments**: Pass `launchOptions` and `allowDangerous` parameters to the `puppeteer_navigate` tool:
122+
123+
```json
124+
{
125+
"url": "https://example.com",
126+
"launchOptions": {
127+
"headless": false,
128+
"defaultViewport": {"width": 1280, "height": 720}
129+
}
130+
}
131+
```
132+
96133
## Build
97134

98135
Docker build:
@@ -103,4 +140,4 @@ docker build -t mcp/puppeteer -f src/puppeteer/Dockerfile .
103140

104141
## License
105142

106-
This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.
143+
This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.

0 commit comments

Comments
 (0)