mcp-server-commands 0.1.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # mcp-server-commands MCP Server
1
+ # mcp-server-commands
2
2
 
3
3
  An MCP server to run commands and includ the output in chat history.
4
4
 
@@ -10,7 +10,7 @@ An MCP server to run commands and includ the output in chat history.
10
10
 
11
11
  ## Prompts
12
12
 
13
- - `include_command_output` - include the output of a command in the chat history
13
+ - `run_command` - include the output of a command in the chat history
14
14
  - for users to include relevant commands in chat history, i.e. via `Zed`'s slash commands
15
15
 
16
16
  ## Development
package/build/index.js CHANGED
@@ -7,7 +7,7 @@ import { promisify } from "node:util";
7
7
  const execAsync = promisify(exec);
8
8
  const server = new Server({
9
9
  name: "mcp-server-commands",
10
- version: "0.1.0",
10
+ version: "0.2.0",
11
11
  }, {
12
12
  capabilities: {
13
13
  //resources: {},
@@ -45,6 +45,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
45
45
  const { stdout, stderr } = await execAsync(command);
46
46
  return {
47
47
  toolResult: {
48
+ isError: false,
48
49
  content: [
49
50
  {
50
51
  type: "text",
@@ -64,6 +65,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
64
65
  const { message, stdout, stderr } = error;
65
66
  return {
66
67
  toolResult: {
68
+ isError: true,
67
69
  content: [
68
70
  {
69
71
  // most of the time this is gonna match stderr, TODO do I want/need both error and stderr?
@@ -95,7 +97,7 @@ server.setRequestHandler(ListPromptsRequestSchema, async () => {
95
97
  return {
96
98
  prompts: [
97
99
  {
98
- name: "include_command_output",
100
+ name: "run_command",
99
101
  description: "Include command output in the prompt. Instead of a tool call, the user decides what commands are relevant.",
100
102
  arguments: [
101
103
  {
@@ -108,7 +110,7 @@ server.setRequestHandler(ListPromptsRequestSchema, async () => {
108
110
  };
109
111
  });
110
112
  server.setRequestHandler(GetPromptRequestSchema, async (request) => {
111
- if (request.params.name !== "include_command_output") {
113
+ if (request.params.name !== "run_command") {
112
114
  throw new Error("Unknown prompt");
113
115
  }
114
116
  const command = String(request.params.arguments?.command);
@@ -127,7 +129,7 @@ server.setRequestHandler(GetPromptRequestSchema, async (request) => {
127
129
  },
128
130
  },
129
131
  ];
130
- if (stdout) {
132
+ if (stdout && stdout.length > 0) {
131
133
  messages.push({
132
134
  role: "user",
133
135
  content: {
@@ -136,7 +138,7 @@ server.setRequestHandler(GetPromptRequestSchema, async (request) => {
136
138
  },
137
139
  });
138
140
  }
139
- if (stderr) {
141
+ if (stderr && stderr.length > 0) {
140
142
  messages.push({
141
143
  role: "user",
142
144
  content: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-server-commands",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "An MCP server to run arbitrary commands",
5
5
  "private": false,
6
6
  "type": "module",