Skip to content

Commit 3ca2c9a

Browse files
authored
Merge pull request #23 from klapaudius/1.x
1.x Resource Management
2 parents 31c3d11 + eb856a9 commit 3ca2c9a

36 files changed

+2466
-33
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,4 @@ phpstan.neon
3030
testbench.yaml
3131
/coverage
3232
/phpunit.coverage.xml
33+
/docker/.env

README.md

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ klp_mcp_server:
9898

9999
The project includes a Docker setup that can be used for development. The Docker setup includes Nginx, PHP-FPM with Redis extension, and Redis server.
100100

101-
For detailed instructions on how to set up and use the Docker containers, please refer to the [Development Guidelines](docs/guidelines.md#docker-setup).
101+
For detailed instructions on how to set up and use the Docker containers, please refer to the [Development Guidelines](docs/development_guidelines.md#docker-setup).
102102

103103
## Strongly Recommended
104104
Enhance your application's security by implementing OAuth2 Authentication. You can use the [klapaudius/oauth-server-bundle](https://github.com/klapaudius/FOSOAuthServerBundle) or any other compatible OAuth2 solution.
@@ -211,11 +211,73 @@ klp_mcp_server:
211211
ttl: 100 # Message TTL in seconds
212212
```
213213

214+
## Resources
215+
216+
The package provides a flexible resource management system that allows you to store and retrieve resources from different providers (file system, database, etc.).
217+
218+
### Configuration
219+
220+
Configure resources in your `config/packages/klp_mcp_server.yaml` file:
221+
222+
```yaml
223+
klp_mcp_server:
224+
# ...
225+
resources:
226+
- App\MCP\Resources\MyCustomResource
227+
resources_templates:
228+
- App\MCP\Resources\MyCustomResourceTemplate
229+
```
230+
231+
### Usage
232+
233+
### Creating Custom Resource
234+
235+
```php
236+
use KLP\KlpMcpServer\Services\ResourceService\ResourceInterface;
237+
238+
class MyCustomResource implements ResourceInterface
239+
{
240+
// Resource implementation
241+
}
242+
```
243+
Then register your resource in the configuration:
244+
245+
```yaml
246+
klp_mcp_server:
247+
# ...
248+
resources:
249+
- App\MCP\Resources\MyCustomResource
250+
```
251+
252+
### Creating Custom Resource Template
253+
254+
You can create custom resource templates by implementing the `ResourceTemplateInterface`:
255+
256+
```php
257+
use KLP\KlpMcpServer\Services\ResourceService\ResourceTemplateInterface;
258+
259+
class MyCustomResourceTemplate implements ResourceTemplateInterface
260+
{
261+
// Implement the required methods
262+
}
263+
```
264+
265+
Then register your resource template in the configuration:
266+
267+
```yaml
268+
klp_mcp_server:
269+
# ...
270+
resources_templates:
271+
- App\MCP\Resources\MyCustomResourceTemplate
272+
```
273+
274+
**For deep diving into resources' management, please take a look at dedicated documentation [Here](https://github.com/klapaudius/symfony-mcp-server/blob/master/docs/building_resources.md)**
275+
214276
## Roadmap
215277
We are committed to actively pursuing the following key initiatives to enhance the package's functionality and ensure compliance with evolving standards.
216278

217279
- **Core Features:**
218-
- Resources implementation compliant with MCP specification.
280+
- Resources implementation compliant with MCP specification.
219281
- Prompts implementation compliant with MCP specification.
220282
- Support for Streamable HTTP (as specified in MCP 2025-03-26 version).
221283
- **Additional Adaptaters:**

composer.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
"require": {
99
"php": "^8.2",
1010
"ext-json": "*",
11+
"ext-fileinfo": "*",
1112
"psr/log": "^3.0",
1213
"symfony/cache": "^7.2",
1314
"symfony/config": "~7.0",
1415
"symfony/console": "~7.0",
1516
"symfony/dependency-injection": "~7.0",
17+
"symfony/finder": "~7.0",
1618
"symfony/http-foundation": "~7.0",
1719
"symfony/http-kernel": "~7.0",
1820
"symfony/routing": "~7.0"
File renamed without changes.

0 commit comments

Comments
 (0)