|
85 | 85 | }, |
86 | 86 | { |
87 | 87 | "cell_type": "code", |
88 | | - "execution_count": 1, |
| 88 | + "execution_count": null, |
89 | 89 | "id": "b3c72322", |
90 | 90 | "metadata": {}, |
91 | | - "outputs": [ |
92 | | - { |
93 | | - "name": "stdout", |
94 | | - "output_type": "stream", |
95 | | - "text": [ |
96 | | - "β
API key helper ready.\n" |
97 | | - ] |
98 | | - } |
99 | | - ], |
| 91 | + "outputs": [], |
100 | 92 | "source": [ |
101 | 93 | "import os\n", |
102 | 94 | "from dotenv import load_dotenv\n", |
|
133 | 125 | }, |
134 | 126 | { |
135 | 127 | "cell_type": "code", |
136 | | - "execution_count": 16, |
| 128 | + "execution_count": null, |
137 | 129 | "id": "5032d7ac", |
138 | 130 | "metadata": {}, |
139 | | - "outputs": [ |
140 | | - { |
141 | | - "name": "stdout", |
142 | | - "output_type": "stream", |
143 | | - "text": [ |
144 | | - "β
bio_tools_server.py written to disk.\n" |
145 | | - ] |
146 | | - } |
147 | | - ], |
| 131 | + "outputs": [], |
148 | 132 | "source": [ |
149 | 133 | "server_code = '''\n", |
150 | 134 | "#!/usr/bin/env python\n", |
|
321 | 305 | " \n", |
322 | 306 | "Do **not** run this in a notebook cell with `!` β it blocks the kernel and no other cells will run.\n", |
323 | 307 | "\n", |
324 | | - "**4.** Wait a few seconds until cloudflared prints a line like:\n", |
| 308 | + "**4.** Wait a few seconds until cloudflared prints a line like. Read through the terminal logs to identify the correct URL.\n", |
325 | 309 | "```\n", |
326 | 310 | "https://abc-def-123.trycloudflare.com\n", |
327 | 311 | "```\n", |
328 | | - "Copy that URL, paste it into the cell below, and run it.\n" |
| 312 | + "Copy that URL, paste it into the cell below, and run it. \n", |
| 313 | + "\n", |
| 314 | + "Do not close the terminal as we want to keep the Cloudflare tunnel open.\n" |
329 | 315 | ] |
330 | 316 | }, |
331 | 317 | { |
332 | 318 | "cell_type": "code", |
333 | 319 | "execution_count": null, |
334 | 320 | "id": "e4e0f7ca", |
335 | 321 | "metadata": {}, |
336 | | - "outputs": [ |
337 | | - { |
338 | | - "name": "stdout", |
339 | | - "output_type": "stream", |
340 | | - "text": [ |
341 | | - "1.27.0\n" |
342 | | - ] |
343 | | - } |
344 | | - ], |
| 322 | + "outputs": [], |
345 | 323 | "source": [ |
346 | 324 | "# Paste your cloudflared URL here (e.g. https://xxxx.trycloudflare.com)\n", |
347 | 325 | "tunnel_url = \" https://xxxx.trycloudflare.com\"" |
348 | 326 | ] |
349 | 327 | }, |
350 | 328 | { |
351 | | - "cell_type": "code", |
352 | | - "execution_count": null, |
| 329 | + "cell_type": "markdown", |
353 | 330 | "id": "c91457af", |
354 | 331 | "metadata": {}, |
355 | | - "outputs": [ |
356 | | - { |
357 | | - "name": "stdout", |
358 | | - "output_type": "stream", |
359 | | - "text": [ |
360 | | - "β
MCP URL set: https://difficulty-ages-stuck-corrections.trycloudflare.com/mcp\n" |
361 | | - ] |
362 | | - } |
363 | | - ], |
364 | 332 | "source": [ |
365 | | - "mcp_url = tunnel_url.rstrip(\"/\") + \"/mcp\"\n", |
366 | | - "mcp_server_config = {\"type\": \"url\", \"url\": mcp_url, \"name\": \"bio_tools\"}\n", |
367 | | - "print(f\"β
MCP URL set: {mcp_url}\")" |
| 333 | + "Now let's make sure if we can connect to the MCP server" |
368 | 334 | ] |
369 | 335 | }, |
370 | 336 | { |
371 | 337 | "cell_type": "code", |
372 | | - "execution_count": 19, |
| 338 | + "execution_count": null, |
373 | 339 | "id": "695692ff", |
374 | 340 | "metadata": {}, |
375 | | - "outputs": [ |
376 | | - { |
377 | | - "name": "stdout", |
378 | | - "output_type": "stream", |
379 | | - "text": [ |
380 | | - "HTTP 400 β tunnel is up but server rejected the request (this is OK)\n" |
381 | | - ] |
382 | | - } |
383 | | - ], |
| 341 | + "outputs": [], |
384 | 342 | "source": [ |
385 | 343 | "import urllib.request\n", |
| 344 | + "\n", |
| 345 | + "mcp_url = tunnel_url.rstrip(\"/\") + \"/mcp\"\n", |
| 346 | + "mcp_server_config = {\"type\": \"url\", \"url\": mcp_url, \"name\": \"bio_tools\"}\n", |
| 347 | + "print(f\"β
MCP URL set: {mcp_url}\")\n", |
| 348 | + "\n", |
386 | 349 | "req = urllib.request.Request(\n", |
387 | 350 | " mcp_server_config[\"url\"],\n", |
388 | 351 | " headers={\"Accept\": \"application/json, text/event-stream\"}\n", |
389 | 352 | ")\n", |
| 353 | + "\n", |
390 | 354 | "try:\n", |
391 | 355 | " with urllib.request.urlopen(req, timeout=10) as r:\n", |
392 | 356 | " print(f\"β
Reachable: HTTP {r.status}\")\n", |
|
415 | 379 | }, |
416 | 380 | { |
417 | 381 | "cell_type": "code", |
418 | | - "execution_count": 30, |
| 382 | + "execution_count": null, |
419 | 383 | "id": "61810bd4", |
420 | 384 | "metadata": {}, |
421 | | - "outputs": [ |
422 | | - { |
423 | | - "name": "stdout", |
424 | | - "output_type": "stream", |
425 | | - "text": [ |
426 | | - "Anthropic client ready.\n" |
427 | | - ] |
428 | | - } |
429 | | - ], |
| 385 | + "outputs": [], |
430 | 386 | "source": [ |
431 | 387 | "from anthropic import Anthropic\n", |
432 | 388 | "\n", |
|
510 | 466 | "execution_count": null, |
511 | 467 | "id": "6f726632", |
512 | 468 | "metadata": {}, |
513 | | - "outputs": [ |
514 | | - { |
515 | | - "name": "stdout", |
516 | | - "output_type": "stream", |
517 | | - "text": [ |
518 | | - "π§ͺ Question: \n", |
519 | | - "I'm studying the role of EGFR in non-small-cell lung cancer.\n", |
520 | | - "Here is a fragment of its amino acid sequence:\n", |
521 | | - "\n", |
522 | | - "MRPSGTAGAA...\n", |
523 | | - "\n", |
524 | | - "ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ\n", |
525 | | - "I'll analyze this EGFR fragment in two parallel ways: computing its biophysical properties from the sequence, and pulling together its biological/disease context. Then I'll synthesize drug discovery hypotheses." |
526 | | - ] |
527 | | - } |
528 | | - ], |
| 469 | + "outputs": [], |
529 | 470 | "source": [ |
530 | 471 | "egfr_sequence_fragment = (\n", |
531 | 472 | " \"MRPSGTAGAALLALLAALCPASRALEEKKVCQGTSNKLTQLGTFEDHFLSLQRMFNNCEVVLGNLEITYVQRNYDLSFLKTIQ\"\n", |
|
0 commit comments