[WIP] Create model context protocol for MP's API #997
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Model context protocols (MCPs) are a generally architecture agnostic standard for allowing LLMs to access the key functionalities of an API or other walled-off data (or abstract functionality)
Want to note that a previous effort within LBL was undertaken to write an MCP for MP. This expands on that to encompass all of the API client's functionality.
This still uses the FastMCP package to generate an MCP. There is a 10-line, easy solution for generating an MCP programmatically from an OpenAPI spec. The FastMCP developer recommends this approach only for bootstrapping. Basically LLMs struggle to understand what is important in the API if there is no structure beyond the OpenAPI spec.
A more fleshed-out solution using the (mostly) auto-generated
mp_api.mcp.tools
is included as well. These basically structure the core functionalities of the API client by both usingMPRester
's convenience functions, and thesearch
features.Still needs work and testing