Commit graph php-sdk/src/Server
Author SHA1 Message Date
Volodymyr Panivko
e3f4b88768
[Server] Oauth2 based on middleware (#221)
* Add Middleware handlers to StreamableHttpTransport

* OAuth Implementation based on middleware

* OAuth Implementation based on middleware

* Add Middleware handlers to StreamableHttpTransport

* OAuth Implementation based on middleware

* OAuth Implementation based on middleware

Signed-off-by: Volodymyr Panivko <sveneld300@gmail.com>

* Address PR review feedback for OAuth middleware

* Apply php-cs-fixer to satisfy QA

* Use Mcp exception classes in OAuth middleware

* Refactor OAuth HTTP stack and add Microsoft example policies

* Fix QA PHPStan findings in OAuth examples and auth middleware

* Require OIDC discovery in JWKS provider and refine OAuth proxy behavior

* Remove local development docker artifacts from VCS

* Revert .gitignore changes for local docker files

* Fix body retrieval in OAuthRequestMetaMiddleware for proper string conversion

Signed-off-by: Volodymyr Panivko <sveneld300@gmail.com>

* Address OAuth PR review feedback and align example configs

* Fix QA style issues and add authorization docs

* Fix PHPStan typing issues in OAuth middleware

* Remove duplicate Middleware namespace, consolidate under Http\Middleware

Remove old Mcp\Server\Transport\Middleware\ classes that were duplicated
in Mcp\Server\Transport\Http\Middleware\ and Http\OAuth\. Update docs
to reference the correct namespaces.

* Address PR review: replace Throwable catch with specific exceptions, add JSON_THROW_ON_ERROR

- JwtTokenValidator: replace catch(\Throwable) with explicit
  \InvalidArgumentException|\UnexpectedValueException|\DomainException,
  letting RuntimeException from JwksProvider propagate as infrastructure errors
- OAuthProxyMiddleware: add \JSON_THROW_ON_ERROR to json_encode for metadata response
- Update tests to expect RuntimeException for JWKS infrastructure failures

---------

Signed-off-by: Volodymyr Panivko <sveneld300@gmail.com>
Co-authored-by: Volodymyr Panivko <volodymyr.panivko@togethernetworks.com>
2026-03-10 17:10:07 +01:00
Antoine Bluchet
61c20f1450
fix(session): initialize data lazily in save() to prevent uninitialized property access (#252) 2026-03-05 00:07:49 +01:00
Edouard Courty
1f5f7e16a3
chore(http): create constant for session id header (#246) 2026-02-23 22:42:54 +01:00
Edouard Courty
158e64627f
feat(server): add server lifecycle events (#175)
Signed-off-by: Edouard Courty <edouard.courty2@gmail.com>
2026-02-23 22:40:43 +01:00
Sule-Balogun Olanrewaju
2166b38d56
Add missing handler for resource subscribe and unsubscribe (#220) 2026-02-18 00:11:35 +01:00
Johannes Wachter
02e86377e4
Add elicitation support for server-to-client user input requests (#228)
- Add ElicitAction enum (accept/decline/cancel)
- Add schema definitions for elicitation fields (string, number, boolean, enum)
- Add ElicitationSchema wrapper for requestedSchema
- Add ElicitRequest and ElicitResult for elicitation/create method
- Update ClientCapabilities to support elicitation capability
- Add elicit() method to ClientGateway
- Store client capabilities in session during initialization
- Add comprehensive unit tests
- Add elicitation example server with book_restaurant, confirm_action, and collect_feedback tools
2026-02-15 23:34:19 +01:00
Volodymyr Panivko
8f8af90007
Fix Invalid data in Session (#241)
Signed-off-by: Volodymyr Panivko <sveneld300@gmail.com>
2026-02-11 20:35:41 +01:00
Volodymyr Panivko
43e7a39a21
Add Middleware handlers to StreamableHttpTransport (#218) 2026-02-11 20:33:31 +01:00
Ridwan Kasim
f3ecb2ebd8
[Server] Fix HTTP Transport Header Compliance (#227)
* fix: added the Allow header for bad method status code

* fix code style

---------

Co-authored-by: Tobias Nyholm <tobias.nyholm@gmail.com>
2026-02-08 15:58:13 +01:00
Christopher Hertel
c19d550c27
[Server] Shift away session decode from constructor (#238)
* Shift away session decode from constructor

* add a small test

---------

Co-authored-by: Tobias Nyholm <tobias.nyholm@gmail.com>
2026-02-08 15:49:14 +01:00
Christopher Hertel
6503059a4b
Throw package specific exceptions in CallbackStream (#233) 2026-02-08 15:42:10 +01:00
Christopher Hertel
9621039e54
Rename Psr16StoreSession to Psr16SessionStore for consistency (#236) 2026-02-08 15:31:19 +01:00
Jonathan Hefner
940eb90872
Add API documentation generation with phpDocumentor (#184)
* Add API documentation generation with phpDocumentor

- Add phpDocumentor configuration and `docs` Makefile target
- Generate docs during CI to catch errors before releases
- Set up GitHub Pages with Jekyll for hosting generated docs
- Add GitHub Actions workflow to deploy docs to GitHub Pages on releases

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Fix phpDocumentor errors in type annotations

Change class-string union types to use phpDocumentor-compatible syntax
and reorder docblock tags so class descriptions precede `@author` tags.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Fix CI: pin phar-io/composer-distributor ^1.0.2

phar-io/composer-distributor 1.0.0 has a bug where it uses the wrong
package version when determining the phpDocumentor download URL,
causing CI to fail with 404 errors when using --prefer-lowest.
Version 1.0.2 fixes this issue.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Integrate markdown guides into phpDocumentor output

Configure phpDocumentor to generate both API documentation and user
guides in a single unified site. This replaces the previous Jekyll-based
approach where API docs were copied into the docs folder.

- Add `<guide>` configuration to `phpdoc.dist.xml`
- Create custom template with "Guides" navigation link
- Replace `docs/index.html` redirect with `docs/index.md` guide index
- Update workflow to publish `build/docs` directly without Jekyll
- Track `.phpdoc/template/` while still ignoring `.phpdoc/cache/`

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Fine-tuning for path, config, and layout

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Christopher Hertel <mail@christopher-hertel.de>
2026-02-01 16:22:40 +01:00
Christopher Hertel
c081b90d74
Update codestyle based on updated Symfony rules (#229) 2026-02-01 11:54:31 +01:00
Tobias Nyholm
8b57fdf3d0
Add $runnerControl parameter to StdioTransport constructor (#205)
* Add $runnerControl parameter to StdioTransport constructor

* fix cs

* fix phpstan baseline

---------

Co-authored-by: Christopher Hertel <mail@christopher-hertel.de>
2026-01-11 22:12:33 +01:00
Antoine Bluchet
7cb29125bd
Add interface abstractions for SchemaGenerator and Discoverer with DI improvements (#215)
* schema generator injection

* add interface for schema generator

* improve discoverer dependency

* remove some comments

* make some classes final

* simplify condition

* code review

* Extend changelog for covering interfaces

* Adopt SchemaGeneratorInterface after rebase and #153

---------

Co-authored-by: Christopher Hertel <mail@christopher-hertel.de>
2026-01-11 22:03:43 +01:00
落月
1de4ea933f
Rename schema to resource in Capability and related classes (#217) 2026-01-11 21:52:04 +01:00
Tobias Nyholm
ed205ef793
Use SchemaValidator to validate tool input (#203)
* Use SchemaValidator to validate tool input

* add test

* add changelog

* fix cs

* Improve error message

* fix tests

* fix tests

* fix baseline

* update snapshot files

* Remove BC compat while switching to v0.3.0

---------

Co-authored-by: Christopher Hertel <mail@christopher-hertel.de>
2026-01-11 21:46:53 +01:00
Sule-Balogun Olanrewaju
c0938a19bd
feat: Add output schema support to MCP tools (#153) 2026-01-11 21:14:48 +01:00
Tobias Nyholm
7f02285753
Use the throwable object in $context['exception'] (#207)
* Use the throwable object in $context['excpetion']

* add changelog

* remove 'exception' from context

* revert debug
2025-12-27 23:46:35 +01:00
Tobias Nyholm
df2563fd20
make sure StdioTransport does not break BC for 0.2.1 (#201)
* make sure StdioTransport does not break BC for 0.2.1

* fix phpstan baseline
2025-12-27 16:05:06 +01:00
Tobias Nyholm
7a8045a5ef
Add a way to stop the stdioTransport in a graceful way (#195)
* Add a way to stop the stdioTransport in a graceful way

* fix cs

* fix: minors

* move around files

* add changelog
2025-12-27 14:21:55 +01:00
Tobias Nyholm
3b31954ac6
Add changelog for 0.2.0 (#187) 2025-12-20 08:50:08 +01:00
Tobias Nyholm
69cd04f752
fix bug with Builder::addLoders() (#186) 2025-12-16 07:48:00 +01:00
Tobias Nyholm
a1e0f61b6b
Add RequestContext and logging (#176)
* Implemented MCP logging specification with auto-injection

* Add RequestContext

* fix tests and style

* Better deprecation

* fix: minor

* Remove ClientAwareInterface

* fix cs

* fix docs

---------

Co-authored-by: Adam Jamiu <jamiuadam120@gmail.com>
2025-12-16 00:12:02 +01:00
Antoine Bluchet
369932378f
align addLoaders with addRequestHandlers (#183) 2025-12-09 09:47:31 +01:00
落月
691e4f7d1a
fix: delete http code (#158) 2025-11-30 14:56:15 +01:00
Tobias Nyholm
b250f4ad1a
Allow users to not specify server info (#164)
* Allow users to not specify server info

* change to default name
2025-11-30 11:30:31 +01:00
落月
280e8b62be
Decouple Server from TransportInterface for reusability (#160) 2025-11-30 11:21:21 +01:00
Tobias Nyholm
532d102c4e
fix cs in main (#171) 2025-11-30 11:12:22 +01:00
Tobias Nyholm
48634bd8c0
Tell clients that they are allowed to use Mcp-Session-Id header (#165) 2025-11-30 11:00:51 +01:00
Tobias Nyholm
59ab0888b1
remove redundant methods in Transport (#163) 2025-11-22 11:56:46 +01:00
Camille Islasse
470237ad0b
Make logger nullable in Transport constructors (#152)
- BaseTransport: Accept ?LoggerInterface parameter and convert null to NullLogger
- StdioTransport: Change logger parameter to nullable
- StreamableHttpTransport: Change logger parameter to nullable
- InMemoryTransport: Fix missing parent::__construct() call and add logging
2025-11-20 19:48:17 +01:00
Christopher Hertel
7cd281d0c7
Rework registry to combine provider and registry interface, move capabilities out and enable Registry injection in Builder (#150) 2025-11-20 19:36:57 +01:00
Bujar Begisholli - C24
7a58ab3f5a
Add meta to addPrompt and addResourceTemplate methods and null coalesce nullable properties (#149) 2025-11-14 17:11:38 +01:00
Christopher Hertel
056c7b6103
[Server] Add support for icons on explicit builder registration and attributes (#142)
* Add support for icons on explicit builder registration and attributes

* Update docs/server-builder.md

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-13 22:39:18 +01:00
Bujar Begisholli - C24
63ffeed0cc
[Server] Fix wrong parameter order when creating the tool from array (#147)
Previously, the meta parameter was incorrectly passed to the icons position
due to missing icons argument. Also adds icons support to Builder::addTool()
for consistency with the Tool schema.
2025-11-12 11:34:17 +01:00
Bujar Begisholli - C24
8daca8129e
[Server] Add meta parameter to addTool and addResource methods (#144) 2025-11-12 10:36:31 +01:00
落月
982706851a
Change visibility of handleFiberTermination and flushOutgoingMessages to protected (#143) 2025-11-11 21:42:04 +01:00
Christopher Hertel
5804ba9773
Add support for icons and website url (#141) 2025-11-09 14:53:36 +01:00
Kaipi Yann
d3a07912b0
Roll out meta properties in attributes and more schema classes (#129) 2025-11-08 13:58:26 +01:00
ineersa
09596c0382
Ability to set custom protocol version (#117) 2025-11-08 00:37:01 +01:00
Antoine Bluchet
85549cb835
session save return type (#133) 2025-11-04 22:45:41 +01:00
Antoine Bluchet
9be9e38815
ability to append loaders to server builder (#132) 2025-11-04 22:44:53 +01:00
Christopher Hertel
ff26b4ff61
refactor: transport agnostic examples (#131) 2025-11-02 18:07:43 +01:00
Christopher Hertel
fb3c1e65a6
Enable servers to send sampling messages to clients (#101) 2025-11-01 09:02:24 +01:00
Christopher Hertel
67cc641247
fix(server): consistent arg name in session store impl (#127) 2025-10-31 21:02:54 +01:00
Kyrian Obikwelu
ca18caf29d
[Server] Fix: standardize error handling across handlers with MCP specificatio… (#124)
* fix: standardize error handling across handlers with MCP specification compliance

* Update mcp-elements.md

Co-authored-by: Christopher Hertel <mail@christopher-hertel.de>

* docs: clarify error handling behavior for all element types

* docs: remove unnecessary whitespace in mcp-elements.md

* fix: simplify exception signatures to accept simple messages

* refactor: use specific exceptions in examples for better error handling

* feat: throw exceptions from reference provider instead of returning null

---------

Co-authored-by: Christopher Hertel <mail@christopher-hertel.de>
2025-10-30 17:30:58 +01:00
Christopher Hertel
8885d29a4e
fix(server): add completion handler to builder (#126) 2025-10-30 11:49:13 +01:00
Kyrian Obikwelu
55f860808c
fix: extract and pass URI template variables to resource handlers (#123) 2025-10-27 22:20:48 +01:00