From 06e24ab993c8b49c27d81d9c99ba2f925224f27b Mon Sep 17 00:00:00 2001 From: esoteric-ephemera Date: Fri, 20 Mar 2026 09:11:05 -0700 Subject: [PATCH 1/2] update synthesis schema --- mp_api/client/routes/materials/synthesis.py | 8 ++++---- mp_api/mcp/server.py | 7 +++---- tests/mcp/test_server.py | 6 +++++- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/mp_api/client/routes/materials/synthesis.py b/mp_api/client/routes/materials/synthesis.py index 6788814ce..ac0db6c1e 100644 --- a/mp_api/client/routes/materials/synthesis.py +++ b/mp_api/client/routes/materials/synthesis.py @@ -2,7 +2,7 @@ from emmet.core.synthesis import ( OperationTypeEnum, - SynthesisSearchResultModel, + SynthesisRecipe, SynthesisTypeEnum, ) @@ -11,7 +11,7 @@ class SynthesisRester(BaseRester): suffix = "materials/synthesis" - document_model = SynthesisSearchResultModel # type: ignore + document_model = SynthesisRecipe # type: ignore def search( self, @@ -29,7 +29,7 @@ def search( condition_mixing_media: list[str] | None = None, num_chunks: int | None = None, chunk_size: int | None = 10, - ) -> list[SynthesisSearchResultModel] | list[dict]: + ) -> list[SynthesisRecipe] | list[dict]: """Search synthesis recipe text. Arguments: @@ -50,7 +50,7 @@ def search( Returns: - ([SynthesisSearchResultModel], [dict]): List of synthesis documents or dictionaries. + ([SynthesisRecipe], [dict]): List of synthesis documents or dictionaries. """ # Turn None and empty list into None keywords = keywords or None diff --git a/mp_api/mcp/server.py b/mp_api/mcp/server.py index 6d9a180b0..8fdf6b6f1 100644 --- a/mp_api/mcp/server.py +++ b/mp_api/mcp/server.py @@ -16,9 +16,8 @@ MCP_SERVER_INSTRUCTIONS = """ This MCP server defines search and document retrieval capabilities -for data in the Materials Project. -Use the search tool to find relevant documents based on materials -keywords. +for data in the Materials Project (https://next-gen.materialsproject.org/). +Use the search tool to find relevant documents based on materials keywords. Then use the fetch tool to retrieve complete materials summary information. """ @@ -82,5 +81,5 @@ def _run_mp_mcp_server() -> None: mcp.run(**parse_server_args()) -if __name__ == "__main__": +if __name__ == "__main__": # pragma: no cover _run_mp_mcp_server() diff --git a/tests/mcp/test_server.py b/tests/mcp/test_server.py index 68523b99e..df2c8ceb3 100644 --- a/tests/mcp/test_server.py +++ b/tests/mcp/test_server.py @@ -10,7 +10,7 @@ ) from mp_api.client.core.exceptions import MPRestError -from mp_api.mcp.server import get_core_mcp, parse_server_args +from mp_api.mcp.server import get_core_mcp, parse_server_args, MCP_SERVER_INSTRUCTIONS async def get_mcp_tools(): @@ -35,6 +35,10 @@ def test_mcp_server(): fetch_tool = asyncio.run(get_mcp_tool("fetch")) assert fetch_tool.parameters["properties"] == {"idx": {"type": "string"}} + mcp_server = get_core_mcp() + assert isinstance(mcp_server, fastmcp.FastMCP) + assert mcp_server.instructions == MCP_SERVER_INSTRUCTIONS + def test_server_cli(): assert parse_server_args( From f898181d165d0b814642630ceefdbba6bbe64865 Mon Sep 17 00:00:00 2001 From: esoteric-ephemera Date: Fri, 20 Mar 2026 09:54:58 -0700 Subject: [PATCH 2/2] undo synth doc changes --- mp_api/client/routes/materials/synthesis.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mp_api/client/routes/materials/synthesis.py b/mp_api/client/routes/materials/synthesis.py index ac0db6c1e..6788814ce 100644 --- a/mp_api/client/routes/materials/synthesis.py +++ b/mp_api/client/routes/materials/synthesis.py @@ -2,7 +2,7 @@ from emmet.core.synthesis import ( OperationTypeEnum, - SynthesisRecipe, + SynthesisSearchResultModel, SynthesisTypeEnum, ) @@ -11,7 +11,7 @@ class SynthesisRester(BaseRester): suffix = "materials/synthesis" - document_model = SynthesisRecipe # type: ignore + document_model = SynthesisSearchResultModel # type: ignore def search( self, @@ -29,7 +29,7 @@ def search( condition_mixing_media: list[str] | None = None, num_chunks: int | None = None, chunk_size: int | None = 10, - ) -> list[SynthesisRecipe] | list[dict]: + ) -> list[SynthesisSearchResultModel] | list[dict]: """Search synthesis recipe text. Arguments: @@ -50,7 +50,7 @@ def search( Returns: - ([SynthesisRecipe], [dict]): List of synthesis documents or dictionaries. + ([SynthesisSearchResultModel], [dict]): List of synthesis documents or dictionaries. """ # Turn None and empty list into None keywords = keywords or None