Skip to content

feat: add resource seeding to mcpserver#2414

Open
mplemay wants to merge 2 commits intomodelcontextprotocol:mainfrom
mplemay:mcp-server-incoming-tools
Open

feat: add resource seeding to mcpserver#2414
mplemay wants to merge 2 commits intomodelcontextprotocol:mainfrom
mplemay:mcp-server-incoming-tools

Conversation

@mplemay
Copy link
Copy Markdown

@mplemay mplemay commented Apr 9, 2026

Summary

Add constructor-time resource seeding to ResourceManager and wire MCPServer through it so servers can preload concrete resources at initialization, matching the existing tool manager pattern.

Motivation and Context

This makes resource registration consistent with tool registration and removes the manual loop from MCPServer.__init__. It also makes it easier to create pre-populated servers without adding extra setup code after construction.

How Has This Been Tested?

  • uv run --frozen pytest tests/server/mcpserver/resources/test_resource_manager.py
  • uv run --frozen pytest tests/server/mcpserver/test_server.py -k init_with_resources
  • uv run --frozen ruff check src/mcp/server/mcpserver/resources/resource_manager.py src/mcp/server/mcpserver/server.py tests/server/mcpserver/resources/test_resource_manager.py tests/server/mcpserver/test_server.py

Breaking Changes

None. ResourceManager(resources=...) and MCPServer(resources=...) are additive.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

Resource seeding now happens inside ResourceManager.__init__, so MCPServer no longer needs a manual registration loop. Duplicate resources continue to flow through add_resource(...), preserving first-write-wins behavior and existing duplicate warnings.

@mplemay mplemay changed the title Mcp server incoming tools feat: add resource seeding to mcpserver Apr 9, 2026
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