Skip to content

Commit dcb47d2

Browse files
authored
Merge pull request #3121 from cliffhall/new-everything-server
New everything server
2 parents c7d60d6 + 44faf3a commit dcb47d2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+3412
-1651
lines changed

package-lock.json

Lines changed: 56 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/everything/.prettierignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
packages
2+
dist
3+
README.md
4+
node_modules

src/everything/AGENTS.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# MCP "Everything" Server - Development Guidelines
2+
3+
## Build, Test & Run Commands
4+
5+
- Build: `npm run build` - Compiles TypeScript to JavaScript
6+
- Watch mode: `npm run watch` - Watches for changes and rebuilds automatically
7+
- Run STDIO server: `npm run start:stdio` - Starts the MCP server using stdio transport
8+
- Run SSE server: `npm run start:sse` - Starts the MCP server with SSE transport
9+
- Run StreamableHttp server: `npm run start:stremableHttp` - Starts the MCP server with StreamableHttp transport
10+
- Prepare release: `npm run prepare` - Builds the project for publishing
11+
12+
## Code Style Guidelines
13+
14+
- Use ES modules with `.js` extension in import paths
15+
- Strictly type all functions and variables with TypeScript
16+
- Follow zod schema patterns for tool input validation
17+
- Prefer async/await over callbacks and Promise chains
18+
- Place all imports at top of file, grouped by external then internal
19+
- Use descriptive variable names that clearly indicate purpose
20+
- Implement proper cleanup for timers and resources in server shutdown
21+
- Handle errors with try/catch blocks and provide clear error messages
22+
- Use consistent indentation (2 spaces) and trailing commas in multi-line objects
23+
- Match existing code style, import order, and module layout in the respective folder.
24+
- Use camelCase for variables/functions,
25+
- Use PascalCase for types/classes,
26+
- Use UPPER_CASE for constants
27+
- Use kebab-case for file names and registered tools, prompts, and resources.
28+
- Use verbs for tool names, e.g., `get-annotated-message` instead of `annotated-message`
29+
30+
## Extending the Server
31+
32+
The Everything Server is designed to be extended at well-defined points.
33+
See [Extension Points](docs/extension.md) and [Project Structure](docs/structure.md).
34+
The server factory is `src/everything/server/index.ts` and registers all features during startup as well as handling post-connection setup.
35+
36+
### High-level
37+
38+
- Tools live under `src/everything/tools/` and are registered via `registerTools(server)`.
39+
- Resources live under `src/everything/resources/` and are registered via `registerResources(server)`.
40+
- Prompts live under `src/everything/prompts/` and are registered via `registerPrompts(server)`.
41+
- Subscriptions and simulated update routines are under `src/everything/resources/subscriptions.ts`.
42+
- Logging helpers are under `src/everything/server/logging.ts`.
43+
- Transport managers are under `src/everything/transports/`.
44+
45+
### When adding a new feature
46+
47+
- Follow the existing file/module pattern in its folder (naming, exports, and registration function).
48+
- Export a `registerX(server)` function that registers new items with the MCP SDK in the same style as existing ones.
49+
- Wire your new module into the central index (e.g., update `tools/index.ts`, `resources/index.ts`, or `prompts/index.ts`).
50+
- Ensure schemas (for tools) are accurate JSON Schema and include helpful descriptions and examples.
51+
`server/index.ts` and usages in `logging.ts` and `subscriptions.ts`.
52+
- Keep the docs in `src/everything/docs/` up to date if you add or modify noteworthy features.

src/everything/CLAUDE.md

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/everything/README.md

Lines changed: 9 additions & 158 deletions
Original file line numberDiff line numberDiff line change
@@ -1,166 +1,17 @@
11
# Everything MCP Server
2+
**[Architecture](docs/architecture.md)
3+
| [Project Structure](docs/structure.md)
4+
| [Startup Process](docs/startup.md)
5+
| [Server Features](docs/features.md)
6+
| [Extension Points](docs/extension.md)
7+
| [How It Works](docs/how-it-works.md)**
8+
29

310
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.
411

5-
## Components
6-
7-
### Tools
8-
9-
1. `echo`
10-
- Simple tool to echo back input messages
11-
- Input:
12-
- `message` (string): Message to echo back
13-
- Returns: Text content with echoed message
14-
15-
2. `add`
16-
- Adds two numbers together
17-
- Inputs:
18-
- `a` (number): First number
19-
- `b` (number): Second number
20-
- Returns: Text result of the addition
21-
22-
3. `longRunningOperation`
23-
- Demonstrates progress notifications for long operations
24-
- Inputs:
25-
- `duration` (number, default: 10): Duration in seconds
26-
- `steps` (number, default: 5): Number of progress steps
27-
- Returns: Completion message with duration and steps
28-
- Sends progress notifications during execution
29-
30-
4. `printEnv`
31-
- Prints all environment variables
32-
- Useful for debugging MCP server configuration
33-
- No inputs required
34-
- Returns: JSON string of all environment variables
35-
36-
5. `sampleLLM`
37-
- Demonstrates LLM sampling capability using MCP sampling feature
38-
- Inputs:
39-
- `prompt` (string): The prompt to send to the LLM
40-
- `maxTokens` (number, default: 100): Maximum tokens to generate
41-
- Returns: Generated LLM response
42-
43-
6. `getTinyImage`
44-
- Returns a small test image
45-
- No inputs required
46-
- Returns: Base64 encoded PNG image data
47-
48-
7. `annotatedMessage`
49-
- Demonstrates how annotations can be used to provide metadata about content
50-
- Inputs:
51-
- `messageType` (enum: "error" | "success" | "debug"): Type of message to demonstrate different annotation patterns
52-
- `includeImage` (boolean, default: false): Whether to include an example image
53-
- Returns: Content with varying annotations:
54-
- Error messages: High priority (1.0), visible to both user and assistant
55-
- Success messages: Medium priority (0.7), user-focused
56-
- Debug messages: Low priority (0.3), assistant-focused
57-
- Optional image: Medium priority (0.5), user-focused
58-
- Example annotations:
59-
```json
60-
{
61-
"priority": 1.0,
62-
"audience": ["user", "assistant"]
63-
}
64-
```
65-
66-
8. `getResourceReference`
67-
- Returns a resource reference that can be used by MCP clients
68-
- Inputs:
69-
- `resourceId` (number, 1-100): ID of the resource to reference
70-
- Returns: A resource reference with:
71-
- Text introduction
72-
- Embedded resource with `type: "resource"`
73-
- Text instruction for using the resource URI
74-
75-
9. `startElicitation`
76-
- Initiates an elicitation (interaction) within the MCP client.
77-
- Inputs:
78-
- `color` (string): Favorite color
79-
- `number` (number, 1-100): Favorite number
80-
- `pets` (enum): Favorite pet
81-
- Returns: Confirmation of the elicitation demo with selection summary.
82-
83-
10. `structuredContent`
84-
- Demonstrates a tool returning structured content using the example in the specification
85-
- Provides an output schema to allow testing of client SHOULD advisory to validate the result using the schema
86-
- Inputs:
87-
- `location` (string): A location or ZIP code, mock data is returned regardless of value
88-
- Returns: a response with
89-
- `structuredContent` field conformant to the output schema
90-
- A backward compatible Text Content field, a SHOULD advisory in the specification
91-
92-
11. `listRoots`
93-
- Lists the current MCP roots provided by the client
94-
- Demonstrates the roots protocol capability even though this server doesn't access files
95-
- No inputs required
96-
- Returns: List of current roots with their URIs and names, or a message if no roots are set
97-
- Shows how servers can interact with the MCP roots protocol
98-
99-
### Resources
100-
101-
The server provides 100 test resources in two formats:
102-
- Even numbered resources:
103-
- Plaintext format
104-
- URI pattern: `test://static/resource/{even_number}`
105-
- Content: Simple text description
106-
107-
- Odd numbered resources:
108-
- Binary blob format
109-
- URI pattern: `test://static/resource/{odd_number}`
110-
- Content: Base64 encoded binary data
111-
112-
Resource features:
113-
- Supports pagination (10 items per page)
114-
- Allows subscribing to resource updates
115-
- Demonstrates resource templates
116-
- Auto-updates subscribed resources every 5 seconds
117-
118-
### Prompts
119-
120-
1. `simple_prompt`
121-
- Basic prompt without arguments
122-
- Returns: Single message exchange
123-
124-
2. `complex_prompt`
125-
- Advanced prompt demonstrating argument handling
126-
- Required arguments:
127-
- `temperature` (string): Temperature setting
128-
- Optional arguments:
129-
- `style` (string): Output style preference
130-
- Returns: Multi-turn conversation with images
131-
132-
3. `resource_prompt`
133-
- Demonstrates embedding resource references in prompts
134-
- Required arguments:
135-
- `resourceId` (number): ID of the resource to embed (1-100)
136-
- Returns: Multi-turn conversation with an embedded resource reference
137-
- Shows how to include resources directly in prompt messages
138-
139-
### Roots
140-
141-
The server demonstrates the MCP roots protocol capability:
142-
143-
- Declares `roots: { listChanged: true }` capability to indicate support for roots
144-
- Handles `roots/list_changed` notifications from clients
145-
- Requests initial roots during server initialization
146-
- Provides a `listRoots` tool to display current roots
147-
- Logs roots-related events for demonstration purposes
148-
149-
Note: This server doesn't actually access files, but demonstrates how servers can interact with the roots protocol for clients that need to understand which directories are available for file operations.
150-
151-
### Logging
152-
153-
The server sends random-leveled log messages every 15 seconds, e.g.:
12+
## Tools, Resources, Prompts, and Other Features
15413

155-
```json
156-
{
157-
"method": "notifications/message",
158-
"params": {
159-
"level": "info",
160-
"data": "Info-level message"
161-
}
162-
}
163-
```
14+
A complete list of the registered MCP primitives and other protocol features demonstrated can be found in the [Server Features](docs/features.md) document.
16415

16516
## Usage with Claude Desktop (uses [stdio Transport](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#stdio))
16617

0 commit comments

Comments
 (0)