From e198e3678892c54408861fd720e5f7ae45997757 Mon Sep 17 00:00:00 2001 From: Jerome Date: Wed, 18 Dec 2024 15:14:45 +0000 Subject: [PATCH 1/2] Added printenv to the everything server to help debug environment variable configuration --- src/everything/everything.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/everything/everything.ts b/src/everything/everything.ts index a31cd7f0..f6b5dca5 100644 --- a/src/everything/everything.ts +++ b/src/everything/everything.ts @@ -40,6 +40,8 @@ const LongRunningOperationSchema = z.object({ steps: z.number().default(5).describe("Number of steps in the operation"), }); +const PrintEnvSchema = z.object({}); + const SampleLLMSchema = z.object({ prompt: z.string().describe("The prompt to send to the LLM"), maxTokens: z @@ -54,6 +56,7 @@ enum ToolName { ECHO = "echo", ADD = "add", LONG_RUNNING_OPERATION = "longRunningOperation", + PRINT_ENV = "printEnv", SAMPLE_LLM = "sampleLLM", GET_TINY_IMAGE = "getTinyImage", } @@ -297,6 +300,11 @@ export const createServer = () => { description: "Adds two numbers", inputSchema: zodToJsonSchema(AddSchema) as ToolInput, }, + { + name: ToolName.PRINT_ENV, + description: "Prints all environment variables, helpful for debugging MCP server configuration", + inputSchema: zodToJsonSchema(PrintEnvSchema) as ToolInput, + }, { name: ToolName.LONG_RUNNING_OPERATION, description: @@ -374,6 +382,17 @@ export const createServer = () => { }; } + if (name === ToolName.PRINT_ENV) { + return { + content: [ + { + type: "text", + text: JSON.stringify(process.env, null, 2), + }, + ], + }; + } + if (name === ToolName.SAMPLE_LLM) { const validatedArgs = SampleLLMSchema.parse(args); const { prompt, maxTokens } = validatedArgs; From 8c1b9d6fda63cd18d9460b46f5947f51219aae59 Mon Sep 17 00:00:00 2001 From: Jerome Date: Wed, 18 Dec 2024 15:18:30 +0000 Subject: [PATCH 2/2] updated readme --- src/everything/README.md | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/everything/README.md b/src/everything/README.md index b00a6635..c4255f6f 100644 --- a/src/everything/README.md +++ b/src/everything/README.md @@ -1,4 +1,4 @@ -# Everything MCP Server +# Everything MCP Server 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. @@ -15,7 +15,7 @@ This MCP server attempts to exercise all the features of the MCP protocol. It is 2. `add` - Adds two numbers together - Inputs: - - `a` (number): First number + - `a` (number): First number - `b` (number): Second number - Returns: Text result of the addition @@ -27,7 +27,7 @@ This MCP server attempts to exercise all the features of the MCP protocol. It is - Returns: Completion message with duration and steps - Sends progress notifications during execution -4. `sampleLLM` +4. `sampleLLM` - Demonstrates LLM sampling capability using MCP sampling feature - Inputs: - `prompt` (string): The prompt to send to the LLM @@ -39,17 +39,23 @@ This MCP server attempts to exercise all the features of the MCP protocol. It is - No inputs required - Returns: Base64 encoded PNG image data +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 - URI pattern: `test://static/resource/{even_number}` - Content: Simple text description - Odd numbered resources: - Binary blob format - - URI pattern: `test://static/resource/{odd_number}` + - URI pattern: `test://static/resource/{odd_number}` - Content: Base64 encoded binary data Resource features: