Skip to content

Commit 4b6f5ff

Browse files
committed
rebase after example renaming
1 parent 9c2b66c commit 4b6f5ff

File tree

3 files changed

+35
-48
lines changed

3 files changed

+35
-48
lines changed

docs/examples.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ STDIO examples use standard input/output for communication:
3232

3333
```bash
3434
# Interactive testing with MCP Inspector
35-
npx @modelcontextprotocol/inspector php examples/01-discovery-stdio-calculator/server.php
35+
npx @modelcontextprotocol/inspector php examples/stdio-discovery-calculator/server.php
3636

3737
# Run with debugging enabled
38-
npx @modelcontextprotocol/inspector -e DEBUG=1 -e FILE_LOG=1 php examples/01-discovery-stdio-calculator/server.php
38+
npx @modelcontextprotocol/inspector -e DEBUG=1 -e FILE_LOG=1 php examples/stdio-discovery-calculator/server.php
3939

4040
# Or configure the script path in your MCP client
41-
# Path: php examples/01-discovery-stdio-calculator/server.php
41+
# Path: php examples/stdio-discovery-calculator/server.php
4242
```
4343

4444
### HTTP Examples
@@ -47,7 +47,7 @@ HTTP examples run as web servers:
4747

4848
```bash
4949
# Start the server
50-
php -S localhost:8000 examples/02-discovery-http-userprofile/server.php
50+
php -S localhost:8000 examples/http-discovery-userprofile/server.php
5151

5252
# Test with MCP Inspector
5353
npx @modelcontextprotocol/inspector http://localhost:8000
@@ -61,9 +61,9 @@ curl -X POST http://localhost:8000 \
6161

6262
## STDIO Examples
6363

64-
### 01. Discovery STDIO Calculator
64+
### Discovery Calculator
6565

66-
**File**: `examples/01-discovery-stdio-calculator/`
66+
**File**: `examples/stdio-discovery-calculator/`
6767

6868
**What it demonstrates:**
6969
- Attribute-based discovery using `#[McpTool]` and `#[McpResource]`
@@ -87,14 +87,14 @@ public function getConfiguration(): array
8787
**Usage:**
8888
```bash
8989
# Interactive testing
90-
npx @modelcontextprotocol/inspector php examples/01-discovery-stdio-calculator/server.php
90+
npx @modelcontextprotocol/inspector php examples/stdio-discovery-calculator/server.php
9191

92-
# Or configure in MCP client: php examples/01-discovery-stdio-calculator/server.php
92+
# Or configure in MCP client: php examples/stdio-discovery-calculator/server.php
9393
```
9494

95-
### 03. Manual Registration STDIO
95+
### Explicit Registration
9696

97-
**File**: `examples/03-manual-registration-stdio/`
97+
**File**: `examples/stdio-explicit-registration/`
9898

9999
**What it demonstrates:**
100100
- Manual registration of tools, resources, and prompts
@@ -109,9 +109,9 @@ $server = Server::builder()
109109
->addPrompt([SimpleHandlers::class, 'greetingPrompt'], 'personalized_greeting')
110110
```
111111

112-
### 05. STDIO Environment Variables
112+
### Environment Variables
113113

114-
**File**: `examples/05-stdio-env-variables/`
114+
**File**: `examples/stdio-env-variables/`
115115

116116
**What it demonstrates:**
117117
- Environment variable integration
@@ -123,9 +123,9 @@ $server = Server::builder()
123123
- Conditional behavior based on environment
124124
- Environment validation and defaults
125125

126-
### 06. Custom Dependencies STDIO
126+
### Custom Dependencies
127127

128-
**File**: `examples/06-custom-dependencies-stdio/`
128+
**File**: `examples/stdio-custom-dependencies/`
129129

130130
**What it demonstrates:**
131131
- Dependency injection with PSR-11 containers
@@ -143,9 +143,9 @@ $server = Server::builder()
143143
->setDiscovery(__DIR__, ['.'])
144144
```
145145

146-
### 09. Cached Discovery STDIO
146+
### Cached Discovery
147147

148-
**File**: `examples/09-cached-discovery-stdio/`
148+
**File**: `examples/stdio-cached-discovery/`
149149

150150
**What it demonstrates:**
151151
- Discovery caching for improved performance
@@ -165,9 +165,9 @@ $server = Server::builder()
165165

166166
## HTTP Examples
167167

168-
### 02. Discovery HTTP User Profile
168+
### Discovery User Profile
169169

170-
**File**: `examples/02-discovery-http-userprofile/`
170+
**File**: `examples/http-discovery-userprofile/`
171171

172172
**What it demonstrates:**
173173
- HTTP transport with StreamableHttpTransport
@@ -195,17 +195,17 @@ public function generateBio(string $userId, string $tone = 'professional'): arra
195195
**Usage:**
196196
```bash
197197
# Start the HTTP server
198-
php -S localhost:8000 examples/02-discovery-http-userprofile/server.php
198+
php -S localhost:8000 examples/http-discovery-userprofile/server.php
199199

200200
# Test with MCP Inspector
201201
npx @modelcontextprotocol/inspector http://localhost:8000
202202

203203
# Or configure in MCP client: http://localhost:8000
204204
```
205205

206-
### 04. Combined Registration HTTP
206+
### Combined Registration
207207

208-
**File**: `examples/04-combined-registration-http/`
208+
**File**: `examples/http-combined-registration/`
209209

210210
**What it demonstrates:**
211211
- Mixing attribute discovery with manual registration
@@ -220,9 +220,9 @@ $server = Server::builder()
220220
->addResource([ManualHandlers::class, 'getPriorityConfig'], 'config://priority')
221221
```
222222

223-
### 07. Complex Tool Schema HTTP
223+
### Complex Tool Schema
224224

225-
**File**: `examples/07-complex-tool-schema-http/`
225+
**File**: `examples/http-complex-tool-schema/`
226226

227227
**What it demonstrates:**
228228
- Advanced JSON schema definitions
@@ -243,9 +243,9 @@ $server = Server::builder()
243243
public function scheduleEvent(array $eventData): array
244244
```
245245

246-
### 08. Schema Showcase Streamable
246+
### Schema Showcase
247247

248-
**File**: `examples/08-schema-showcase-streamable/`
248+
**File**: `examples/http-schema-showcase/`
249249

250250
**What it demonstrates:**
251251
- Comprehensive JSON schema features

docs/transports.md

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -342,21 +342,9 @@ npx @modelcontextprotocol/inspector http://localhost:8000
342342

343343
## Choosing a Transport
344344

345-
### Use STDIO When:
345+
The choice between STDIO and HTTP transport depends on the client you want to integrate with.
346+
If you are integrating with a client that is running **locally** (like Claude Desktop), use STDIO.
347+
If you are building a server in a distributed environment and need to integrate with a **remote** client, use Streamable HTTP.
346348

347-
- Building command-line tools
348-
- Integrating with MCP clients (Claude Desktop, etc.)
349-
- Simple request/response patterns
350-
- Process-based isolation is desired
351-
- Single session per process
352-
353-
### Use HTTP When:
354-
355-
- Building web services
356-
- Need browser compatibility
357-
- Integration with web frameworks
358-
- Multiple concurrent sessions
359-
- Web-based MCP clients
360-
- RESTful API patterns
361-
362-
The key difference is that STDIO is process-based (one session per process) while HTTP is request-based (multiple sessions via headers).
349+
One additiona difference to consider is that STDIO is process-based (one session per process) while HTTP is
350+
request-based (multiple sessions via headers).

examples/README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,23 @@
22

33
This directory contains various examples of how to use the PHP MCP SDK.
44

5-
You can run examples 01-08 with the dependencies already installed in the root directory of the SDK. For example 09, see the
6-
README in the `examples/09-standalone-cli` directory.
5+
You can run the examples with the dependencies already installed in the root directory of the SDK.
76

87
For running an example, you execute the `server.php` like this:
98
```bash
109
# For examples using STDIO transport
11-
php examples/01-discovery-stdio-calculator/server.php
10+
php examples/stdio-discovery-calculator/server.php
1211

1312
# For examples using Streamable HTTP transport
14-
php -S localhost:8000 examples/02-discovery-http-userprofile/server.php
13+
php -S localhost:8000 examples/http-discovery-userprofile/server.php
1514
```
1615

1716
You will see debug outputs to help you understand what is happening.
1817

1918
Run with Inspector:
2019

2120
```bash
22-
npx @modelcontextprotocol/inspector php examples/01-discovery-stdio-calculator/server.php
21+
npx @modelcontextprotocol/inspector php examples/stdio-discovery-calculator/server.php
2322
```
2423

2524
## Debugging
@@ -30,5 +29,5 @@ directory.
3029

3130
With the Inspector you can set the environment variables like this:
3231
```bash
33-
npx @modelcontextprotocol/inspector -e DEBUG=1 -e FILE_LOG=1 php examples/01-discovery-stdio-calculator/server.php
32+
npx @modelcontextprotocol/inspector -e DEBUG=1 -e FILE_LOG=1 php examples/stdio-discovery-calculator/server.php
3433
```

0 commit comments

Comments
 (0)