@modelcontextprotocol/server-everything
Advanced tools
Comparing version 0.6.2 to 2025.1.14
import { Server } from "@modelcontextprotocol/sdk/server/index.js"; | ||
import { CallToolRequestSchema, CreateMessageResultSchema, GetPromptRequestSchema, ListPromptsRequestSchema, ListResourcesRequestSchema, ListResourceTemplatesRequestSchema, ListToolsRequestSchema, ReadResourceRequestSchema, SetLevelRequestSchema, SubscribeRequestSchema, ToolSchema, UnsubscribeRequestSchema, } from "@modelcontextprotocol/sdk/types.js"; | ||
import { CallToolRequestSchema, CompleteRequestSchema, CreateMessageResultSchema, GetPromptRequestSchema, ListPromptsRequestSchema, ListResourcesRequestSchema, ListResourceTemplatesRequestSchema, ListToolsRequestSchema, ReadResourceRequestSchema, SetLevelRequestSchema, SubscribeRequestSchema, ToolSchema, UnsubscribeRequestSchema, } from "@modelcontextprotocol/sdk/types.js"; | ||
import { z } from "zod"; | ||
@@ -21,2 +21,3 @@ import { zodToJsonSchema } from "zod-to-json-schema"; | ||
}); | ||
const PrintEnvSchema = z.object({}); | ||
const SampleLLMSchema = z.object({ | ||
@@ -29,2 +30,8 @@ prompt: z.string().describe("The prompt to send to the LLM"), | ||
}); | ||
// Example completion values | ||
const EXAMPLE_COMPLETIONS = { | ||
style: ["casual", "formal", "technical", "friendly"], | ||
temperature: ["0", "0.5", "0.7", "1.0"], | ||
resourceId: ["1", "2", "3", "4", "5"], | ||
}; | ||
const GetTinyImageSchema = z.object({}); | ||
@@ -36,2 +43,3 @@ var ToolName; | ||
ToolName["LONG_RUNNING_OPERATION"] = "longRunningOperation"; | ||
ToolName["PRINT_ENV"] = "printEnv"; | ||
ToolName["SAMPLE_LLM"] = "sampleLLM"; | ||
@@ -250,2 +258,7 @@ ToolName["GET_TINY_IMAGE"] = "getTinyImage"; | ||
{ | ||
name: ToolName.PRINT_ENV, | ||
description: "Prints all environment variables, helpful for debugging MCP server configuration", | ||
inputSchema: zodToJsonSchema(PrintEnvSchema), | ||
}, | ||
{ | ||
name: ToolName.LONG_RUNNING_OPERATION, | ||
@@ -315,2 +328,12 @@ description: "Demonstrates a long running operation with progress updates", | ||
} | ||
if (name === ToolName.PRINT_ENV) { | ||
return { | ||
content: [ | ||
{ | ||
type: "text", | ||
text: JSON.stringify(process.env, null, 2), | ||
}, | ||
], | ||
}; | ||
} | ||
if (name === ToolName.SAMPLE_LLM) { | ||
@@ -321,3 +344,3 @@ const validatedArgs = SampleLLMSchema.parse(args); | ||
return { | ||
content: [{ type: "text", text: `LLM sampling result: ${result}` }], | ||
content: [{ type: "text", text: `LLM sampling result: ${result.content.text}` }], | ||
}; | ||
@@ -347,2 +370,22 @@ } | ||
}); | ||
server.setRequestHandler(CompleteRequestSchema, async (request) => { | ||
const { ref, argument } = request.params; | ||
if (ref.type === "ref/resource") { | ||
const resourceId = ref.uri.split("/").pop(); | ||
if (!resourceId) | ||
return { completion: { values: [] } }; | ||
// Filter resource IDs that start with the input value | ||
const values = EXAMPLE_COMPLETIONS.resourceId.filter(id => id.startsWith(argument.value)); | ||
return { completion: { values, hasMore: false, total: values.length } }; | ||
} | ||
if (ref.type === "ref/prompt") { | ||
// Handle completion for prompt arguments | ||
const completions = EXAMPLE_COMPLETIONS[argument.name]; | ||
if (!completions) | ||
return { completion: { values: [] } }; | ||
const values = completions.filter(value => value.startsWith(argument.value)); | ||
return { completion: { values, hasMore: false, total: values.length } }; | ||
} | ||
throw new Error(`Unknown reference type`); | ||
}); | ||
server.setRequestHandler(SetLevelRequestSchema, async (request) => { | ||
@@ -349,0 +392,0 @@ const { level } = request.params; |
{ | ||
"name": "@modelcontextprotocol/server-everything", | ||
"version": "0.6.2", | ||
"version": "2025.1.14", | ||
"description": "MCP server that exercises all the features of the MCP protocol", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -1,2 +0,2 @@ | ||
# Everything MCP Server | ||
# Everything MCP Server | ||
@@ -18,3 +18,3 @@ This MCP server attempts to exercise all the features of the MCP protocol. It is not intended to be a useful server, but rather a test server for builders of MCP clients. It implements prompts, tools, resources, sampling, and more to showcase MCP capabilities. | ||
- Inputs: | ||
- `a` (number): First number | ||
- `a` (number): First number | ||
- `b` (number): Second number | ||
@@ -31,3 +31,3 @@ - Returns: Text result of the addition | ||
4. `sampleLLM` | ||
4. `sampleLLM` | ||
- Demonstrates LLM sampling capability using MCP sampling feature | ||
@@ -44,6 +44,12 @@ - Inputs: | ||
6. `printEnv` | ||
- Prints all environment variables | ||
- Useful for debugging MCP server configuration | ||
- No inputs required | ||
- Returns: JSON string of all environment variables | ||
### Resources | ||
The server provides 100 test resources in two formats: | ||
- Even numbered resources: | ||
- Even numbered resources: | ||
- Plaintext format | ||
@@ -55,3 +61,3 @@ - URI pattern: `test://static/resource/{even_number}` | ||
- Binary blob format | ||
- URI pattern: `test://static/resource/{odd_number}` | ||
- URI pattern: `test://static/resource/{odd_number}` | ||
- Content: Base64 encoded binary data | ||
@@ -58,0 +64,0 @@ |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
25642
468
1
98
4
6