Skip to content
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions mcp-run-python/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
"@modelcontextprotocol/sdk": "npm:@modelcontextprotocol/sdk@^1.15.1",
"@std/cli": "jsr:@std/cli@^1.0.15",
"@std/path": "jsr:@std/path@^1.0.8",
// do NOT upgrade above this version until there is a workaround for https://github.com/pyodide/pyodide/pull/5621
"pyodide": "npm:[email protected]",
"pyodide": "npm:[email protected]",
"zod": "npm:zod@^3.24.2"
},
"fmt": {
Expand Down
12 changes: 6 additions & 6 deletions mcp-run-python/deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions mcp-run-python/src/runCode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ export async function runCode(
files: CodeFile[],
log: (level: LoggingLevel, data: string) => void,
): Promise<RunSuccess | RunError> {
// remove once we can upgrade to pyodide 0.27.7 and console.log is no longer used.
const realConsoleLog = console.log
// deno-lint-ignore no-explicit-any
console.log = (...args: any[]) => log('debug', args.join(' '))
// // remove once we can upgrade to pyodide 0.27.7 and console.log is no longer used.
// const realConsoleLog = console.log;
// // deno-lint-ignore no-explicit-any
// console.log = (...args: any[]) => log("debug", args.join(" "));

const output: string[] = []
const pyodide = await loadPyodide({
Expand Down Expand Up @@ -90,7 +90,7 @@ export async function runCode(
}
sys.stdout.flush()
sys.stderr.flush()
console.log = realConsoleLog
// console.log = realConsoleLog;
return runResult
}

Expand Down
7 changes: 5 additions & 2 deletions mcp-run-python/test_mcp_servers.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ async def test_list_tools(mcp_session: ClientSession) -> None:
<status>run-error</status>
<error>
Traceback (most recent call last):
...<9 lines>...
.run_async(globals, locals)
File "main.py", line 1, in <module>
print(unknown)
^^^^^^^
Expand Down Expand Up @@ -225,7 +227,8 @@ async def logging_callback(params: types.LoggingMessageNotificationParams) -> No
</return_value>\
"""
assert content.text == expected_output
assert len(logs) >= 18
assert len(logs) >= 16
assert re.search(
r"debug: Didn't find package numpy\S+?\.whl locally, attempting to load from", '\n'.join(logs)
r"debug: loadPackage: Didn't find package numpy\S*\.whl locally, attempting to load from",
'\n'.join(logs),
)