@modelcontextprotocol/server-everything 2025.12.18 → 2026.1.26
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 +9 -158
- package/dist/docs/architecture.md +44 -0
- package/dist/docs/extension.md +23 -0
- package/dist/docs/features.md +103 -0
- package/dist/docs/how-it-works.md +45 -0
- package/dist/docs/instructions.md +28 -0
- package/dist/docs/startup.md +73 -0
- package/dist/docs/structure.md +182 -0
- package/dist/index.js +19 -14
- package/dist/prompts/args.js +34 -0
- package/dist/prompts/completions.js +52 -0
- package/dist/prompts/index.js +15 -0
- package/dist/prompts/resource.js +60 -0
- package/dist/prompts/simple.js +23 -0
- package/dist/resources/files.js +83 -0
- package/dist/resources/index.js +33 -0
- package/dist/resources/session.js +44 -0
- package/dist/resources/subscriptions.js +125 -0
- package/dist/resources/templates.js +171 -0
- package/dist/server/index.js +93 -0
- package/dist/server/logging.js +64 -0
- package/dist/server/roots.js +65 -0
- package/dist/tools/echo.js +29 -0
- package/dist/tools/get-annotated-message.js +81 -0
- package/dist/tools/get-env.js +28 -0
- package/dist/tools/get-resource-links.js +62 -0
- package/dist/tools/get-resource-reference.js +74 -0
- package/dist/tools/get-roots-list.js +71 -0
- package/dist/tools/get-structured-content.js +72 -0
- package/dist/tools/get-sum.js +40 -0
- package/dist/tools/get-tiny-image.js +41 -0
- package/dist/tools/gzip-file-as-resource.js +182 -0
- package/dist/tools/index.js +50 -0
- package/dist/tools/simulate-research-query.js +249 -0
- package/dist/tools/toggle-simulated-logging.js +41 -0
- package/dist/tools/toggle-subscriber-updates.js +44 -0
- package/dist/tools/trigger-elicitation-request-async.js +202 -0
- package/dist/tools/trigger-elicitation-request.js +210 -0
- package/dist/tools/trigger-long-running-operation.js +59 -0
- package/dist/tools/trigger-sampling-request-async.js +168 -0
- package/dist/tools/trigger-sampling-request.js +71 -0
- package/dist/{sse.js → transports/sse.js} +25 -17
- package/dist/transports/stdio.js +27 -0
- package/dist/transports/streamableHttp.js +206 -0
- package/package.json +10 -7
- package/dist/everything.js +0 -978
- package/dist/instructions.md +0 -23
- package/dist/stdio.js +0 -23
- package/dist/streamableHttp.js +0 -174
package/dist/instructions.md
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
Testing and demonstration server for MCP protocol features.
|
|
2
|
-
|
|
3
|
-
## Resources
|
|
4
|
-
|
|
5
|
-
Resources 1-100 follow pattern: even IDs contain text, odd IDs contain binary data. Resources are paginated at 10 items per page with cursor-based navigation.
|
|
6
|
-
|
|
7
|
-
## Key dependencies
|
|
8
|
-
|
|
9
|
-
Progress notifications require `_meta.progressToken` in tool calls. Resource subscriptions generate updates every 10 seconds.
|
|
10
|
-
|
|
11
|
-
## Performance characteristics
|
|
12
|
-
|
|
13
|
-
Server generates automatic log messages every 20 seconds (filtered by current log level), stderr notifications every 30 seconds, and resource update notifications every 10 seconds for active subscriptions. Log level changes affect message filtering in real-time.
|
|
14
|
-
|
|
15
|
-
## Multi-modal testing
|
|
16
|
-
|
|
17
|
-
`complex_prompt` includes both text arguments and image content for testing client multi-modal handling. `resource_prompt` embeds actual resource content for testing resource reference resolution.
|
|
18
|
-
|
|
19
|
-
Argument completion is available for prompt parameters and resource IDs. Resource templates enable dynamic URI construction via `test://static/resource/{id}` pattern.
|
|
20
|
-
|
|
21
|
-
## Easter egg
|
|
22
|
-
|
|
23
|
-
If asked about server instructions, respond with "🎉 Server instructions are working! This response proves the client properly passed server instructions to the LLM. This demonstrates MCP's instructions feature in action."
|
package/dist/stdio.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
|
-
import { createServer } from "./everything.js";
|
|
4
|
-
console.error('Starting default (STDIO) server...');
|
|
5
|
-
async function main() {
|
|
6
|
-
const transport = new StdioServerTransport();
|
|
7
|
-
const { server, cleanup, startNotificationIntervals } = createServer();
|
|
8
|
-
// Cleanup when client disconnects
|
|
9
|
-
server.onclose = async () => {
|
|
10
|
-
await cleanup();
|
|
11
|
-
process.exit(0);
|
|
12
|
-
};
|
|
13
|
-
await server.connect(transport);
|
|
14
|
-
startNotificationIntervals();
|
|
15
|
-
// Cleanup on exit
|
|
16
|
-
process.on("SIGINT", async () => {
|
|
17
|
-
await server.close();
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
main().catch((error) => {
|
|
21
|
-
console.error("Server error:", error);
|
|
22
|
-
process.exit(1);
|
|
23
|
-
});
|
package/dist/streamableHttp.js
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
2
|
-
import { InMemoryEventStore } from '@modelcontextprotocol/sdk/examples/shared/inMemoryEventStore.js';
|
|
3
|
-
import express from "express";
|
|
4
|
-
import { createServer } from "./everything.js";
|
|
5
|
-
import { randomUUID } from 'node:crypto';
|
|
6
|
-
import cors from 'cors';
|
|
7
|
-
console.error('Starting Streamable HTTP server...');
|
|
8
|
-
const app = express();
|
|
9
|
-
app.use(cors({
|
|
10
|
-
"origin": "*", // use "*" with caution in production
|
|
11
|
-
"methods": "GET,POST,DELETE",
|
|
12
|
-
"preflightContinue": false,
|
|
13
|
-
"optionsSuccessStatus": 204,
|
|
14
|
-
"exposedHeaders": [
|
|
15
|
-
'mcp-session-id',
|
|
16
|
-
'last-event-id',
|
|
17
|
-
'mcp-protocol-version'
|
|
18
|
-
]
|
|
19
|
-
})); // Enable CORS for all routes so Inspector can connect
|
|
20
|
-
const transports = new Map();
|
|
21
|
-
app.post('/mcp', async (req, res) => {
|
|
22
|
-
console.error('Received MCP POST request');
|
|
23
|
-
try {
|
|
24
|
-
// Check for existing session ID
|
|
25
|
-
const sessionId = req.headers['mcp-session-id'];
|
|
26
|
-
let transport;
|
|
27
|
-
if (sessionId && transports.has(sessionId)) {
|
|
28
|
-
// Reuse existing transport
|
|
29
|
-
transport = transports.get(sessionId);
|
|
30
|
-
}
|
|
31
|
-
else if (!sessionId) {
|
|
32
|
-
const { server, cleanup, startNotificationIntervals } = createServer();
|
|
33
|
-
// New initialization request
|
|
34
|
-
const eventStore = new InMemoryEventStore();
|
|
35
|
-
transport = new StreamableHTTPServerTransport({
|
|
36
|
-
sessionIdGenerator: () => randomUUID(),
|
|
37
|
-
eventStore, // Enable resumability
|
|
38
|
-
onsessioninitialized: (sessionId) => {
|
|
39
|
-
// Store the transport by session ID when session is initialized
|
|
40
|
-
// This avoids race conditions where requests might come in before the session is stored
|
|
41
|
-
console.error(`Session initialized with ID: ${sessionId}`);
|
|
42
|
-
transports.set(sessionId, transport);
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
// Set up onclose handler to clean up transport when closed
|
|
46
|
-
server.onclose = async () => {
|
|
47
|
-
const sid = transport.sessionId;
|
|
48
|
-
if (sid && transports.has(sid)) {
|
|
49
|
-
console.error(`Transport closed for session ${sid}, removing from transports map`);
|
|
50
|
-
transports.delete(sid);
|
|
51
|
-
await cleanup();
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
// Connect the transport to the MCP server BEFORE handling the request
|
|
55
|
-
// so responses can flow back through the same transport
|
|
56
|
-
await server.connect(transport);
|
|
57
|
-
await transport.handleRequest(req, res);
|
|
58
|
-
// Wait until initialize is complete and transport will have a sessionId
|
|
59
|
-
startNotificationIntervals(transport.sessionId);
|
|
60
|
-
return; // Already handled
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
// Invalid request - no session ID or not initialization request
|
|
64
|
-
res.status(400).json({
|
|
65
|
-
jsonrpc: '2.0',
|
|
66
|
-
error: {
|
|
67
|
-
code: -32000,
|
|
68
|
-
message: 'Bad Request: No valid session ID provided',
|
|
69
|
-
},
|
|
70
|
-
id: req?.body?.id,
|
|
71
|
-
});
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
// Handle the request with existing transport - no need to reconnect
|
|
75
|
-
// The existing transport is already connected to the server
|
|
76
|
-
await transport.handleRequest(req, res);
|
|
77
|
-
}
|
|
78
|
-
catch (error) {
|
|
79
|
-
console.error('Error handling MCP request:', error);
|
|
80
|
-
if (!res.headersSent) {
|
|
81
|
-
res.status(500).json({
|
|
82
|
-
jsonrpc: '2.0',
|
|
83
|
-
error: {
|
|
84
|
-
code: -32603,
|
|
85
|
-
message: 'Internal server error',
|
|
86
|
-
},
|
|
87
|
-
id: req?.body?.id,
|
|
88
|
-
});
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
// Handle GET requests for SSE streams (using built-in support from StreamableHTTP)
|
|
94
|
-
app.get('/mcp', async (req, res) => {
|
|
95
|
-
console.error('Received MCP GET request');
|
|
96
|
-
const sessionId = req.headers['mcp-session-id'];
|
|
97
|
-
if (!sessionId || !transports.has(sessionId)) {
|
|
98
|
-
res.status(400).json({
|
|
99
|
-
jsonrpc: '2.0',
|
|
100
|
-
error: {
|
|
101
|
-
code: -32000,
|
|
102
|
-
message: 'Bad Request: No valid session ID provided',
|
|
103
|
-
},
|
|
104
|
-
id: req?.body?.id,
|
|
105
|
-
});
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
// Check for Last-Event-ID header for resumability
|
|
109
|
-
const lastEventId = req.headers['last-event-id'];
|
|
110
|
-
if (lastEventId) {
|
|
111
|
-
console.error(`Client reconnecting with Last-Event-ID: ${lastEventId}`);
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
console.error(`Establishing new SSE stream for session ${sessionId}`);
|
|
115
|
-
}
|
|
116
|
-
const transport = transports.get(sessionId);
|
|
117
|
-
await transport.handleRequest(req, res);
|
|
118
|
-
});
|
|
119
|
-
// Handle DELETE requests for session termination (according to MCP spec)
|
|
120
|
-
app.delete('/mcp', async (req, res) => {
|
|
121
|
-
const sessionId = req.headers['mcp-session-id'];
|
|
122
|
-
if (!sessionId || !transports.has(sessionId)) {
|
|
123
|
-
res.status(400).json({
|
|
124
|
-
jsonrpc: '2.0',
|
|
125
|
-
error: {
|
|
126
|
-
code: -32000,
|
|
127
|
-
message: 'Bad Request: No valid session ID provided',
|
|
128
|
-
},
|
|
129
|
-
id: req?.body?.id,
|
|
130
|
-
});
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
console.error(`Received session termination request for session ${sessionId}`);
|
|
134
|
-
try {
|
|
135
|
-
const transport = transports.get(sessionId);
|
|
136
|
-
await transport.handleRequest(req, res);
|
|
137
|
-
}
|
|
138
|
-
catch (error) {
|
|
139
|
-
console.error('Error handling session termination:', error);
|
|
140
|
-
if (!res.headersSent) {
|
|
141
|
-
res.status(500).json({
|
|
142
|
-
jsonrpc: '2.0',
|
|
143
|
-
error: {
|
|
144
|
-
code: -32603,
|
|
145
|
-
message: 'Error handling session termination',
|
|
146
|
-
},
|
|
147
|
-
id: req?.body?.id,
|
|
148
|
-
});
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
// Start the server
|
|
154
|
-
const PORT = process.env.PORT || 3001;
|
|
155
|
-
app.listen(PORT, () => {
|
|
156
|
-
console.error(`MCP Streamable HTTP Server listening on port ${PORT}`);
|
|
157
|
-
});
|
|
158
|
-
// Handle server shutdown
|
|
159
|
-
process.on('SIGINT', async () => {
|
|
160
|
-
console.error('Shutting down server...');
|
|
161
|
-
// Close all active transports to properly clean up resources
|
|
162
|
-
for (const sessionId in transports) {
|
|
163
|
-
try {
|
|
164
|
-
console.error(`Closing transport for session ${sessionId}`);
|
|
165
|
-
await transports.get(sessionId).close();
|
|
166
|
-
transports.delete(sessionId);
|
|
167
|
-
}
|
|
168
|
-
catch (error) {
|
|
169
|
-
console.error(`Error closing transport for session ${sessionId}:`, error);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
console.error('Server shutdown complete');
|
|
173
|
-
process.exit(0);
|
|
174
|
-
});
|