You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: asciidoc/courses/genai-mcp-build-custom-tools-python/modules/1-getting-started/lessons/2-setup/lesson.adoc
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -59,11 +59,11 @@ Throughout this course, you'll connect your MCP server to a Neo4j database with
59
59
60
60
We have created a Neo4j Sandbox instance for you to use during this course, loaded with thousands of movies, actors, directors, and user ratings.
61
61
62
-
To define the connection details as environment variables, create a `.env` file in the `server/` directory with the following values:
62
+
To define the connection details as environment variables, create a `.env` file in the project root with the following values:
Copy file name to clipboardExpand all lines: asciidoc/courses/genai-mcp-build-custom-tools-python/modules/1-getting-started/lessons/3c-create-first-server/code/solution.py
Copy file name to clipboardExpand all lines: asciidoc/courses/genai-mcp-build-custom-tools-python/modules/1-getting-started/lessons/3c-create-first-server/lesson.adoc
+12-10Lines changed: 12 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
= Create Your First MCP Server
1
+
= Create Your First MCP Server
2
2
:type: challenge
3
3
:order: 3
4
4
@@ -13,7 +13,7 @@ Your challenge is to create a simple MCP server that demonstrates the core conce
13
13
====
14
14
If you haven't completed the setup lesson yet, go back to link:../2-setup/[Setting Up Your Development Environment^] to configure your Codespace and environment variables.
15
15
16
-
You can keep the Codespace open while completing the course.
16
+
You can keep the Codespace open while completing the course.
17
17
You can open your existing codespaces at link:https://github.com/codespaces[github.com/codespaces^].
18
18
====
19
19
@@ -80,10 +80,10 @@ uv add "mcp[cli]"
80
80
=== Step 4: Create your MCP server
81
81
82
82
83
-
Open `main.py` in your editor and add the following code to create a simple MCP server:
83
+
Open `strawberry/main.py` in your editor and add the following code to create a simple MCP server:
84
84
85
85
[source,python]
86
-
.main.py
86
+
.strawberry/main.py
87
87
----
88
88
from mcp.server.fastmcp import FastMCP
89
89
@@ -93,17 +93,17 @@ mcp = FastMCP("Strawberry")
93
93
@mcp.tool()
94
94
def count_letters(text: str, search: str) -> int:
95
95
"""Count occurrences of a letter in the text"""
96
-
return text.lower().count(search.lower())
96
+
return text.lower().count(search.lower())
97
97
98
98
# Run the server when executed directly
99
99
if __name__ == "__main__":
100
-
mcp.run(transport="streaming-http")
100
+
mcp.run(transport="streamable-http")
101
101
----
102
102
103
103
[NOTE]
104
-
.Streaming HTTP
104
+
.Streamable HTTP
105
105
====
106
-
This example uses the `streaming-http` transport method to run the server.
106
+
This example uses the `streamable-http` transport method to run the server.
107
107
This differs from `stdio` in that the client uses HTTP to communicate with the server.
108
108
109
109
We have made this choice to make it easier to test the server in GitHub Codespaces with the interactive Python client.
@@ -130,7 +130,7 @@ If the server is running successfully, you will see output similar to:
130
130
INFO: Started server process [30256]
131
131
INFO: Waiting for application startup.
132
132
[10/15/25 12:52:22] INFO StreamableHTTP session manager streamable_http_manager.py:110
133
-
started
133
+
started
134
134
INFO: Application startup complete.
135
135
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
136
136
----
@@ -166,7 +166,7 @@ The client will connect to your server and display an interactive menu showing a
Select a tool, resource, or template (enter number):
169
+
Select a tool, resource, or template (enter number):
170
170
----
171
171
172
172
Enter `1` to select the `count_letters` tool.
@@ -229,6 +229,8 @@ Try testing with different inputs to verify the tool works correctly. Press Ente
229
229
230
230
You have just created and tested your first MCP server!
231
231
232
+
Once you are finished, you can stop both the client and server by pressing `CMD+C` (Mac) or `Ctrl+C` (Windows) in the terminal windows where they are running.
Copy file name to clipboardExpand all lines: asciidoc/courses/genai-mcp-build-custom-tools-python/modules/2-database-features/lessons/10c-paginated-tool/code/solution.py
0 commit comments