mcp
This commit is contained in:
@@ -39,7 +39,9 @@ def get_shell(shell_name: str):
|
||||
@app.post("/shells/{shell_name}/run")
|
||||
def run_code(
|
||||
shell_name: Annotated[str, Path(..., description="The shell to run code in")],
|
||||
code: Annotated[str, Body(..., description="The code to execute", media_type="text/plain")],
|
||||
code: Annotated[
|
||||
str, Body(..., description="The code to execute", media_type="text/plain")
|
||||
],
|
||||
options: Annotated[CallOptions, Depends()],
|
||||
):
|
||||
return ShellApp.run_code(code, shell_name, options=options)
|
||||
@@ -47,13 +49,21 @@ def run_code(
|
||||
|
||||
@app.post("/run")
|
||||
def run_code_2(
|
||||
code: Annotated[str, Body(..., description="The code to execute", media_type="text/plain")],
|
||||
code: Annotated[
|
||||
str, Body(..., description="The code to execute", media_type="text/plain")
|
||||
],
|
||||
options: Annotated[CallOptions, Depends()],
|
||||
shell_name: Annotated[str, Query(description="The shell to run code in")] = "last",
|
||||
):
|
||||
return ShellApp.run_code(code, shell_name, options=options)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
def main() -> None:
|
||||
"""Run the HTTP API with Uvicorn."""
|
||||
import uvicorn
|
||||
|
||||
uvicorn.run(app, host="::", port=8000, log_level="info")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user