Skip to content

Fix bug: request_meta is not available in server.request_context #104

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

Closed
wants to merge 2 commits into from

Conversation

phact
Copy link

@phact phact commented Dec 17, 2024

Fixes #103

Fix the issue where server.request_context.meta does not include the progressToken.

  • Extract _meta field: Extract the _meta field from request parameters and assign it to message.request_meta in src/mcp/server/__init__.py.
  • Update RequestContext: Update RequestContext instantiation to include progressToken in src/mcp/server/__init__.py.
  • Allow extra fields: Update RequestParams instantiation to include model_config = ConfigDict(extra="allow") in src/mcp/types.py.

For more details, open the Copilot Workspace session.

Fixes modelcontextprotocol#103

Fix the issue where `server.request_context.meta` does not include the `progressToken`.

* **Extract `_meta` field**: Extract the `_meta` field from request parameters and assign it to `message.request_meta` in `src/mcp/server/__init__.py`.
* **Update `RequestContext`**: Update `RequestContext` instantiation to include `progressToken` in `src/mcp/server/__init__.py`.
* **Allow extra fields**: Update `RequestParams` instantiation to include `model_config = ConfigDict(extra="allow")` in `src/mcp/types.py`.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/modelcontextprotocol/python-sdk/issues/103?shareId=XXXX-XXXX-XXXX-XXXX).
@phact
Copy link
Author

phact commented Dec 18, 2024

@dsp-ant here's a quick take on this issue (works in my test setup)

@dsp-ant dsp-ant changed the base branch from main to v1.1.x December 20, 2024 15:59
@dsp-ant dsp-ant changed the base branch from v1.1.x to main December 20, 2024 16:00
@dsp-ant
Copy link
Member

dsp-ant commented Dec 21, 2024

Thank you for this. This helped me figuring out a fix. I think my fix in #108 is more general and we should probably go down that route. I'll close out this PR. Thank you so much for the bug report and the attempted fix!

@dsp-ant dsp-ant closed this Dec 21, 2024
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.

Bug: request_meta is not available in server.request_context
2 participants