Skip to content

Conversation

esoteric-ephemera
Copy link
Contributor

@esoteric-ephemera esoteric-ephemera commented Aug 28, 2025

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 using MPRester's convenience functions, and the search features.

Still needs work and testing

Copy link
Member

@tschaume tschaume left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Only have a couple of comments.

Should regenerating the tools be integrated with Github actions and run during a release?

@esoteric-ephemera
Copy link
Contributor Author

@tschaume Re:

Should regenerating the tools be integrated with Github actions and run during a release?

It's mostly automated but requires some cleanup work. A key thing is ensuring that the typing is correct (FastMCP needs explicit type annotations) and that any new types are imported. Could be done if that's of interest

Before this gets merged, I'd like to test a bit or get feedback from those who are more in the LLM space

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.

2 participants