Skip to content

Feat/support mcp resources #1042

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 48 commits into
base: main
Choose a base branch
from

Conversation

amri369
Copy link
Contributor

@amri369 amri369 commented Jul 8, 2025

Summary

Integrate MCP Resources. This allows MCP servers to expose data and content that can be read by clients and used as context for LLM interactions.

Key changes:

  • Added three abstract methods to the to the base class MCPServer: list_resources, list_resource_templates and read_resource
  • Implemented the abstract methods in the base class _MCPServerWithClientSession which is parent of classes MCPServerStdio, MCPServerSse , and MCPServerStreamableHttp.
  • Created example MCP resources server with working demonstration.
  • Updated documentation with MCP resources usage examples.

Note: This PR does not implement subscribe_resource and unsubscribe_resource methods.

Test plan

Unit tests: Added 4 comprehensive tests in tests/mcp/test_resources_server.py covering:

  • Resources listing and retrieval
  • Error handling for missing resource
  • Integration tests: Updated existing MCP test suite to handle new abstract methods

Example verification: Created working example with MCP resources server and client
All tests pass: 453/453 tests passing after adding optional dependencies

Issue number

Partially addresses #544 (resources only)

Checks

  • I've added new tests (if relevant)
  • I've added/updated the relevant documentation
  • I've run make lint and make format
  • I've made sure tests pass

@amri369 amri369 marked this pull request as draft July 8, 2025 19:43
@amri369 amri369 marked this pull request as ready for review July 8, 2025 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant