mirror of
https://github.com/modelcontextprotocol/servers.git
synced 2026-04-20 21:05:17 +02:00
Merge branch 'main' into jun/puppeteer
This commit is contained in:
8
package-lock.json
generated
8
package-lock.json
generated
@@ -5435,7 +5435,7 @@
|
|||||||
"version": "0.6.2",
|
"version": "0.6.2",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@modelcontextprotocol/sdk": "^1.10.1",
|
"@modelcontextprotocol/sdk": "^1.11.0",
|
||||||
"express": "^4.21.1",
|
"express": "^4.21.1",
|
||||||
"zod": "^3.23.8",
|
"zod": "^3.23.8",
|
||||||
"zod-to-json-schema": "^3.23.5"
|
"zod-to-json-schema": "^3.23.5"
|
||||||
@@ -5450,9 +5450,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"src/everything/node_modules/@modelcontextprotocol/sdk": {
|
"src/everything/node_modules/@modelcontextprotocol/sdk": {
|
||||||
"version": "1.10.1",
|
"version": "1.11.0",
|
||||||
"resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.10.1.tgz",
|
"resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.11.0.tgz",
|
||||||
"integrity": "sha512-xNYdFdkJqEfIaTVP1gPKoEvluACHZsHZegIoICX8DM1o6Qf3G5u2BQJHmgd0n4YgRPqqK/u1ujQvrgAxxSJT9w==",
|
"integrity": "sha512-k/1pb70eD638anoi0e8wUGAlbMJXyvdV4p62Ko+EZ7eBe1xMx8Uhak1R5DgfoofsK5IBBnRwsYGTaLZl+6/+RQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"content-type": "^1.0.5",
|
"content-type": "^1.0.5",
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ Optionally, you can add it to a file called `.vscode/mcp.json` in your workspace
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Run with [HTTP+SSE Transport](https://modelcontextprotocol.io/specification/2024-11-05/basic/transports#http-with-sse) (deprecated as of [2025-03-26](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports))
|
## Running from source with [HTTP+SSE Transport](https://modelcontextprotocol.io/specification/2024-11-05/basic/transports#http-with-sse) (deprecated as of [2025-03-26](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports))
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
cd src/everything
|
cd src/everything
|
||||||
@@ -181,10 +181,37 @@ npm install
|
|||||||
npm run start:sse
|
npm run start:sse
|
||||||
```
|
```
|
||||||
|
|
||||||
## Run with [Streamable HTTP Transport](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http)
|
## Run from source with [Streamable HTTP Transport](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http)
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
cd src/everything
|
cd src/everything
|
||||||
npm install
|
npm install
|
||||||
npm run start:streamableHttp
|
npm run start:streamableHttp
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Running as an installed package
|
||||||
|
### Install
|
||||||
|
```shell
|
||||||
|
npm install -g @modelcontextprotocol/server-everything@latest
|
||||||
|
````
|
||||||
|
|
||||||
|
### Run the default (stdio) server
|
||||||
|
```shell
|
||||||
|
npx @modelcontextprotocol/server-everything
|
||||||
|
```
|
||||||
|
|
||||||
|
### Or specify stdio explicitly
|
||||||
|
```shell
|
||||||
|
npx @modelcontextprotocol/server-everything stdio
|
||||||
|
```
|
||||||
|
|
||||||
|
### Run the SSE server
|
||||||
|
```shell
|
||||||
|
npx @modelcontextprotocol/server-everything sse
|
||||||
|
```
|
||||||
|
|
||||||
|
### Run the streamable HTTP server
|
||||||
|
```shell
|
||||||
|
npx @modelcontextprotocol/server-everything streamableHttp
|
||||||
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -1,23 +1,37 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
// Parse command line arguments first
|
||||||
import { createServer } from "./everything.js";
|
const args = process.argv.slice(2);
|
||||||
|
const scriptName = args[0] || 'stdio';
|
||||||
|
|
||||||
async function main() {
|
async function run() {
|
||||||
const transport = new StdioServerTransport();
|
try {
|
||||||
const { server, cleanup } = createServer();
|
// Dynamically import only the requested module to prevent all modules from initializing
|
||||||
|
switch (scriptName) {
|
||||||
await server.connect(transport);
|
case 'stdio':
|
||||||
|
// Import and run the default server
|
||||||
// Cleanup on exit
|
await import('./stdio.js');
|
||||||
process.on("SIGINT", async () => {
|
break;
|
||||||
await cleanup();
|
case 'sse':
|
||||||
await server.close();
|
// Import and run the SSE server
|
||||||
process.exit(0);
|
await import('./sse.js');
|
||||||
});
|
break;
|
||||||
|
case 'streamableHttp':
|
||||||
|
// Import and run the streamable HTTP server
|
||||||
|
await import('./streamableHttp.js');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
console.error(`Unknown script: ${scriptName}`);
|
||||||
|
console.log('Available scripts:');
|
||||||
|
console.log('- stdio');
|
||||||
|
console.log('- sse');
|
||||||
|
console.log('- streamableHttp');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error running script:', error);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
main().catch((error) => {
|
run();
|
||||||
console.error("Server error:", error);
|
|
||||||
process.exit(1);
|
|
||||||
});
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
"start:streamableHttp": "node dist/streamableHttp.js"
|
"start:streamableHttp": "node dist/streamableHttp.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@modelcontextprotocol/sdk": "^1.10.1",
|
"@modelcontextprotocol/sdk": "^1.11.0",
|
||||||
"express": "^4.21.1",
|
"express": "^4.21.1",
|
||||||
"zod": "^3.23.8",
|
"zod": "^3.23.8",
|
||||||
"zod-to-json-schema": "^3.23.5"
|
"zod-to-json-schema": "^3.23.5"
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js";
|
|||||||
import express from "express";
|
import express from "express";
|
||||||
import { createServer } from "./everything.js";
|
import { createServer } from "./everything.js";
|
||||||
|
|
||||||
|
console.error('Starting SSE server...');
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
const { server, cleanup } = createServer();
|
const { server, cleanup } = createServer();
|
||||||
|
|||||||
26
src/everything/stdio.ts
Normal file
26
src/everything/stdio.ts
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
||||||
|
import { createServer } from "./everything.js";
|
||||||
|
|
||||||
|
console.error('Starting default (STDIO) server...');
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
const transport = new StdioServerTransport();
|
||||||
|
const {server, cleanup} = createServer();
|
||||||
|
|
||||||
|
await server.connect(transport);
|
||||||
|
|
||||||
|
// Cleanup on exit
|
||||||
|
process.on("SIGINT", async () => {
|
||||||
|
await cleanup();
|
||||||
|
await server.close();
|
||||||
|
process.exit(0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
main().catch((error) => {
|
||||||
|
console.error("Server error:", error);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
|
|
||||||
@@ -4,6 +4,8 @@ import express, { Request, Response } from "express";
|
|||||||
import { createServer } from "./everything.js";
|
import { createServer } from "./everything.js";
|
||||||
import { randomUUID } from 'node:crypto';
|
import { randomUUID } from 'node:crypto';
|
||||||
|
|
||||||
|
console.error('Starting Streamable HTTP server...');
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
const { server, cleanup } = createServer();
|
const { server, cleanup } = createServer();
|
||||||
|
|||||||
Reference in New Issue
Block a user