Skip to content

Commit 97a4932

Browse files
Merge branch 'main' into fix/fetch-package
2 parents 1c747e5 + e956375 commit 97a4932

File tree

4 files changed

+256
-9
lines changed

4 files changed

+256
-9
lines changed

everything/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,24 @@ This MCP server attempts to exercise all the features of the MCP protocol. It is
4545
- No inputs required
4646
- Returns: JSON string of all environment variables
4747

48+
7. `annotatedMessage`
49+
- Demonstrates how annotations can be used to provide metadata about content
50+
- Inputs:
51+
- `messageType` (enum: "error" | "success" | "debug"): Type of message to demonstrate different annotation patterns
52+
- `includeImage` (boolean, default: false): Whether to include an example image
53+
- Returns: Content with varying annotations:
54+
- Error messages: High priority (1.0), visible to both user and assistant
55+
- Success messages: Medium priority (0.7), user-focused
56+
- Debug messages: Low priority (0.3), assistant-focused
57+
- Optional image: Medium priority (0.5), user-focused
58+
- Example annotations:
59+
```json
60+
{
61+
"priority": 1.0,
62+
"audience": ["user", "assistant"]
63+
}
64+
```
65+
4866
### Resources
4967

5068
The server provides 100 test resources in two formats:
@@ -78,6 +96,20 @@ Resource features:
7896
- `style` (string): Output style preference
7997
- Returns: Multi-turn conversation with images
8098

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+
81113
## Usage with Claude Desktop
82114

83115
Add to your `claude_desktop_config.json`:

everything/everything.ts

Lines changed: 102 additions & 9 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,
@@ -60,13 +61,21 @@ const EXAMPLE_COMPLETIONS = {
6061

6162
const GetTinyImageSchema = z.object({});
6263

64+
const AnnotatedMessageSchema = z.object({
65+
messageType: z.enum(["error", "success", "debug"])
66+
.describe("Type of message to demonstrate different annotation patterns"),
67+
includeImage: z.boolean().default(false)
68+
.describe("Whether to include an example image")
69+
});
70+
6371
enum ToolName {
6472
ECHO = "echo",
6573
ADD = "add",
6674
LONG_RUNNING_OPERATION = "longRunningOperation",
6775
PRINT_ENV = "printEnv",
6876
SAMPLE_LLM = "sampleLLM",
6977
GET_TINY_IMAGE = "getTinyImage",
78+
ANNOTATED_MESSAGE = "annotatedMessage",
7079
}
7180

7281
enum PromptName {
@@ -91,10 +100,10 @@ export const createServer = () => {
91100
);
92101

93102
let subscriptions: Set<string> = new Set();
94-
let updateInterval: NodeJS.Timeout | undefined;
95-
103+
let subsUpdateInterval: NodeJS.Timeout | undefined;
96104
// Set up update interval for subscribed resources
97-
updateInterval = setInterval(() => {
105+
106+
subsUpdateInterval = setInterval(() => {
98107
for (const uri of subscriptions) {
99108
server.notification({
100109
method: "notifications/resources/updated",
@@ -103,6 +112,34 @@ export const createServer = () => {
103112
}
104113
}, 5000);
105114

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+
106143
// Helper method to request sampling from client
107144
const requestSampling = async (
108145
context: string,
@@ -329,6 +366,11 @@ export const createServer = () => {
329366
description: "Returns the MCP_TINY_IMAGE",
330367
inputSchema: zodToJsonSchema(GetTinyImageSchema) as ToolInput,
331368
},
369+
{
370+
name: ToolName.ANNOTATED_MESSAGE,
371+
description: "Demonstrates how annotations can be used to provide metadata about content",
372+
inputSchema: zodToJsonSchema(AnnotatedMessageSchema) as ToolInput,
373+
},
332374
];
333375

334376
return { tools };
@@ -436,6 +478,57 @@ export const createServer = () => {
436478
};
437479
}
438480

481+
if (name === ToolName.ANNOTATED_MESSAGE) {
482+
const { messageType, includeImage } = AnnotatedMessageSchema.parse(args);
483+
484+
const content = [];
485+
486+
// Main message with different priorities/audiences based on type
487+
if (messageType === "error") {
488+
content.push({
489+
type: "text",
490+
text: "Error: Operation failed",
491+
annotations: {
492+
priority: 1.0, // Errors are highest priority
493+
audience: ["user", "assistant"] // Both need to know about errors
494+
}
495+
});
496+
} else if (messageType === "success") {
497+
content.push({
498+
type: "text",
499+
text: "Operation completed successfully",
500+
annotations: {
501+
priority: 0.7, // Success messages are important but not critical
502+
audience: ["user"] // Success mainly for user consumption
503+
}
504+
});
505+
} else if (messageType === "debug") {
506+
content.push({
507+
type: "text",
508+
text: "Debug: Cache hit ratio 0.95, latency 150ms",
509+
annotations: {
510+
priority: 0.3, // Debug info is low priority
511+
audience: ["assistant"] // Technical details for assistant
512+
}
513+
});
514+
}
515+
516+
// Optional image with its own annotations
517+
if (includeImage) {
518+
content.push({
519+
type: "image",
520+
data: MCP_TINY_IMAGE,
521+
mimeType: "image/png",
522+
annotations: {
523+
priority: 0.5,
524+
audience: ["user"] // Images primarily for user visualization
525+
}
526+
});
527+
}
528+
529+
return { content };
530+
}
531+
439532
throw new Error(`Unknown tool: ${name}`);
440533
});
441534

@@ -447,7 +540,7 @@ export const createServer = () => {
447540
if (!resourceId) return { completion: { values: [] } };
448541

449542
// Filter resource IDs that start with the input value
450-
const values = EXAMPLE_COMPLETIONS.resourceId.filter(id =>
543+
const values = EXAMPLE_COMPLETIONS.resourceId.filter(id =>
451544
id.startsWith(argument.value)
452545
);
453546
return { completion: { values, hasMore: false, total: values.length } };
@@ -458,7 +551,7 @@ export const createServer = () => {
458551
const completions = EXAMPLE_COMPLETIONS[argument.name as keyof typeof EXAMPLE_COMPLETIONS];
459552
if (!completions) return { completion: { values: [] } };
460553

461-
const values = completions.filter(value =>
554+
const values = completions.filter(value =>
462555
value.startsWith(argument.value)
463556
);
464557
return { completion: { values, hasMore: false, total: values.length } };
@@ -469,24 +562,24 @@ export const createServer = () => {
469562

470563
server.setRequestHandler(SetLevelRequestSchema, async (request) => {
471564
const { level } = request.params;
565+
logLevel = level;
472566

473567
// Demonstrate different log levels
474568
await server.notification({
475569
method: "notifications/message",
476570
params: {
477571
level: "debug",
478572
logger: "test-server",
479-
data: `Logging level set to: ${level}`,
573+
data: `Logging level set to: ${logLevel}`,
480574
},
481575
});
482576

483577
return {};
484578
});
485579

486580
const cleanup = async () => {
487-
if (updateInterval) {
488-
clearInterval(updateInterval);
489-
}
581+
if (subsUpdateInterval) clearInterval(subsUpdateInterval);
582+
if (logsUpdateInterval) clearInterval(logsUpdateInterval);
490583
};
491584

492585
return { server, cleanup };

github/index.ts

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,51 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
155155
name: "get_issue",
156156
description: "Get details of a specific issue in a GitHub repository.",
157157
inputSchema: zodToJsonSchema(issues.GetIssueSchema)
158+
},
159+
{
160+
name: "get_pull_request",
161+
description: "Get details of a specific pull request",
162+
inputSchema: zodToJsonSchema(pulls.GetPullRequestSchema)
163+
},
164+
{
165+
name: "list_pull_requests",
166+
description: "List and filter repository pull requests",
167+
inputSchema: zodToJsonSchema(pulls.ListPullRequestsSchema)
168+
},
169+
{
170+
name: "create_pull_request_review",
171+
description: "Create a review on a pull request",
172+
inputSchema: zodToJsonSchema(pulls.CreatePullRequestReviewSchema)
173+
},
174+
{
175+
name: "merge_pull_request",
176+
description: "Merge a pull request",
177+
inputSchema: zodToJsonSchema(pulls.MergePullRequestSchema)
178+
},
179+
{
180+
name: "get_pull_request_files",
181+
description: "Get the list of files changed in a pull request",
182+
inputSchema: zodToJsonSchema(pulls.GetPullRequestFilesSchema)
183+
},
184+
{
185+
name: "get_pull_request_status",
186+
description: "Get the combined status of all status checks for a pull request",
187+
inputSchema: zodToJsonSchema(pulls.GetPullRequestStatusSchema)
188+
},
189+
{
190+
name: "update_pull_request_branch",
191+
description: "Update a pull request branch with the latest changes from the base branch",
192+
inputSchema: zodToJsonSchema(pulls.UpdatePullRequestBranchSchema)
193+
},
194+
{
195+
name: "get_pull_request_comments",
196+
description: "Get the review comments on a pull request",
197+
inputSchema: zodToJsonSchema(pulls.GetPullRequestCommentsSchema)
198+
},
199+
{
200+
name: "get_pull_request_reviews",
201+
description: "Get the reviews on a pull request",
202+
inputSchema: zodToJsonSchema(pulls.GetPullRequestReviewsSchema)
158203
}
159204
],
160205
};
@@ -370,6 +415,82 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
370415
};
371416
}
372417

418+
case "get_pull_request": {
419+
const args = pulls.GetPullRequestSchema.parse(request.params.arguments);
420+
const pullRequest = await pulls.getPullRequest(args.owner, args.repo, args.pull_number);
421+
return {
422+
content: [{ type: "text", text: JSON.stringify(pullRequest, null, 2) }],
423+
};
424+
}
425+
426+
case "list_pull_requests": {
427+
const args = pulls.ListPullRequestsSchema.parse(request.params.arguments);
428+
const { owner, repo, ...options } = args;
429+
const pullRequests = await pulls.listPullRequests(owner, repo, options);
430+
return {
431+
content: [{ type: "text", text: JSON.stringify(pullRequests, null, 2) }],
432+
};
433+
}
434+
435+
case "create_pull_request_review": {
436+
const args = pulls.CreatePullRequestReviewSchema.parse(request.params.arguments);
437+
const { owner, repo, pull_number, ...options } = args;
438+
const review = await pulls.createPullRequestReview(owner, repo, pull_number, options);
439+
return {
440+
content: [{ type: "text", text: JSON.stringify(review, null, 2) }],
441+
};
442+
}
443+
444+
case "merge_pull_request": {
445+
const args = pulls.MergePullRequestSchema.parse(request.params.arguments);
446+
const { owner, repo, pull_number, ...options } = args;
447+
const result = await pulls.mergePullRequest(owner, repo, pull_number, options);
448+
return {
449+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
450+
};
451+
}
452+
453+
case "get_pull_request_files": {
454+
const args = pulls.GetPullRequestFilesSchema.parse(request.params.arguments);
455+
const files = await pulls.getPullRequestFiles(args.owner, args.repo, args.pull_number);
456+
return {
457+
content: [{ type: "text", text: JSON.stringify(files, null, 2) }],
458+
};
459+
}
460+
461+
case "get_pull_request_status": {
462+
const args = pulls.GetPullRequestStatusSchema.parse(request.params.arguments);
463+
const status = await pulls.getPullRequestStatus(args.owner, args.repo, args.pull_number);
464+
return {
465+
content: [{ type: "text", text: JSON.stringify(status, null, 2) }],
466+
};
467+
}
468+
469+
case "update_pull_request_branch": {
470+
const args = pulls.UpdatePullRequestBranchSchema.parse(request.params.arguments);
471+
const { owner, repo, pull_number, expected_head_sha } = args;
472+
await pulls.updatePullRequestBranch(owner, repo, pull_number, expected_head_sha);
473+
return {
474+
content: [{ type: "text", text: JSON.stringify({ success: true }, null, 2) }],
475+
};
476+
}
477+
478+
case "get_pull_request_comments": {
479+
const args = pulls.GetPullRequestCommentsSchema.parse(request.params.arguments);
480+
const comments = await pulls.getPullRequestComments(args.owner, args.repo, args.pull_number);
481+
return {
482+
content: [{ type: "text", text: JSON.stringify(comments, null, 2) }],
483+
};
484+
}
485+
486+
case "get_pull_request_reviews": {
487+
const args = pulls.GetPullRequestReviewsSchema.parse(request.params.arguments);
488+
const reviews = await pulls.getPullRequestReviews(args.owner, args.repo, args.pull_number);
489+
return {
490+
content: [{ type: "text", text: JSON.stringify(reviews, null, 2) }],
491+
};
492+
}
493+
373494
default:
374495
throw new Error(`Unknown tool: ${request.params.name}`);
375496
}

mssql-mcp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 479553d86acb7b495106d05a93a7b4ce417b4a73

0 commit comments

Comments
 (0)