-
Notifications
You must be signed in to change notification settings - Fork 3
Implement CI Pipeline for K* Planner MCP Server and Resolve Python Package Naming Conflict #24
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
Changes from all commits
6843261
5e5f0ab
1e137d8
a8ceff1
2a7d3d8
d604606
a8c682f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "python.testing.pytestArgs": [ | ||
| "tests" | ||
| ], | ||
| "python.testing.unittestEnabled": false, | ||
| "python.testing.pytestEnabled": true | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| FROM python:3.11 | ||
|
|
||
| RUN apt-get update && apt-get install -y cmake make g++ | ||
| COPY mcp_server /src/mcp_server | ||
| WORKDIR /src | ||
| RUN pip install -r mcp_server/requirements.txt | ||
|
|
||
| EXPOSE 8000 | ||
| CMD ["fastmcp", "run", "mcp_server/server.py:mcp", "--transport", "http", "--port", "8000", "--host", "0.0.0.0"] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| pytest | ||
| pytest-asyncio | ||
| mcp[cli] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| domain = """ | ||
| (define (domain blocksworld) | ||
| (:requirements :strips :typing) | ||
| (:types block) | ||
|
|
||
| (:predicates | ||
| (on ?x ?y - block) ; Block ?x is on top of block ?y | ||
| (ontable ?x - block) ; Block ?x is on the table | ||
| (clear ?x - block) ; Nothing is on top of block ?x | ||
| (handempty) ; The robot arm is empty | ||
| (holding ?x - block) ; The robot arm is holding block ?x | ||
| ) | ||
|
|
||
| (:action pick-up | ||
| :parameters (?x - block) | ||
| :precondition (and (clear ?x) (ontable ?x) (handempty)) | ||
| :effect (and (not (ontable ?x)) (not (clear ?x)) (not (handempty)) (holding ?x)) | ||
| ) | ||
|
|
||
| (:action put-down | ||
| :parameters (?x - block) | ||
| :precondition (holding ?x) | ||
| :effect (and (not (holding ?x)) (clear ?x) (handempty) (ontable ?x)) | ||
| ) | ||
|
|
||
| (:action stack | ||
| :parameters (?x ?y - block) | ||
| :precondition (and (holding ?x) (clear ?y)) | ||
| :effect (and (not (holding ?x)) (not (clear ?y)) (clear ?x) (handempty) (on ?x ?y)) | ||
| ) | ||
|
|
||
| (:action unstack | ||
| :parameters (?x ?y - block) | ||
| :precondition (and (on ?x ?y) (clear ?x) (handempty)) | ||
| :effect (and (not (on ?x ?y)) (not (clear ?x)) (clear ?y) (holding ?x) (not (handempty))) | ||
| ) | ||
| ) | ||
| """ | ||
|
|
||
| problem = """ | ||
| (define (problem p01) | ||
| (:domain blocksworld) | ||
| (:objects A B - block) ; Two blocks, A and B | ||
| (:init | ||
| (ontable A) ; Block A is on the table | ||
| (on B A) ; Block B is on top of block A | ||
| (clear B) ; Nothing is on top of B | ||
| (handempty) ; The arm is empty | ||
| ) | ||
| (:goal (and | ||
| (on A B) ; Block A should be on block B | ||
| (clear A) ; Block A should be clear | ||
| (ontable B) ; Block B should be on the table | ||
| )) | ||
| ) | ||
| """ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import os | ||
| import pytest | ||
| from mcp_server.tests.data.pddl.pddl_example import domain, problem | ||
| from fastmcp import Client | ||
| from fastmcp.client.transports import StreamableHttpTransport | ||
|
|
||
|
|
||
| def get_client(server_url) -> Client: | ||
| transport = StreamableHttpTransport(url=server_url) | ||
| return Client(transport) | ||
|
|
||
| class TestMcpContainer: | ||
| @pytest.mark.skipif( | ||
| "MCP_SERVER_URL" not in os.environ, reason="Requires MCP_SERVER_URL to be set" | ||
| ) | ||
| @pytest.mark.asyncio | ||
| async def test_planner_tool_t(self) -> None: | ||
| client = get_client(os.getenv("MCP_SERVER_URL", "http://localhost:8000/mcp")) | ||
|
|
||
| async with client: | ||
| tool_list = await client.list_tools() | ||
| assert tool_list is not None | ||
|
|
||
| payload = await client.call_tool( | ||
| "KstarPlannerUnorderedTopQ", | ||
| {"domain": domain, "problem": problem}, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should explicitly provide the important parameters here without depending on defaults not changing:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This pull request is for establishing the CI pipeline for K* MCP Server nothing else. |
||
| ) | ||
| assert payload is not None | ||
| assert len(payload.structured_content["plans"]) == 1 | ||
| optimal_plan = payload.structured_content["plans"][0] | ||
| assert len(optimal_plan["actions"]) == 4 | ||
| assert optimal_plan["cost"] == 4 | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need cmake and g++?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line was supposed to be checked at your pull request for using K* package binary. Did you check it?