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: content/blog/mcp-with-wasmcp.md
+30-14Lines changed: 30 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,14 @@ author = "Ian McDonald"
10
10
11
11
---
12
12
13
+
[spin](https://github.com/spinframework/spin) is an open source framework for building and running fast, secure, and composable cloud microservices with WebAssembly.
14
+
15
+
[wasmcp](https://github.com/wasmcp/wasmcp) is a [WebAssembly Component](https://component-model.bytecodealliance.org/) development kit for the [Model Context Protocol](https://modelcontextprotocol.io/docs/getting-started/intro).
16
+
17
+
Together they form a polyglot toolchain for extending the capabilities of language models in a composable, portable, and secure way.
18
+
19
+
## What are tools?
20
+
13
21
Large language models (LLMs) are trained on vast heaps of data that they use to generate natural language responses to input queries. But that knowledge is static once training is over. They are unable to answer simple questions that require current data, like “What time is it?” or “What's the weather tomorrow in Atlanta?”. This highlights the gap between a simple model and an intelligent system that can actually *do* things and acquire new information, or context, dynamically. This is generally where the term *agent* starts to enter the conversation.
14
22
15
23
All LLMs are dependent on functions, also called tools, to interact with the outside world beyond the prompt and to perform deterministic actions. Just like you might use a calculator to accurately crunch numbers, or a web browser to explore the internet, an LLM might use its own calculator and fetch tools in the same way. Even basic capabilities like reading a file from disk are implemented via tools.
@@ -146,13 +154,7 @@ impl Guest for Calculator {
146
154
"required": ["a", "b"]
147
155
}"#
148
156
.to_string(),
149
-
options:Some(ToolOptions {
150
-
meta:None,
151
-
annotations:None,
152
-
description:Some("Add two numbers together".to_string()),
153
-
output_schema:None,
154
-
title:Some("Add".to_string()),
155
-
}),
157
+
options:None,
156
158
},
157
159
Tool {
158
160
name:"subtract".to_string(),
@@ -269,13 +271,7 @@ class StringsTools(exports.Tools):
269
271
},
270
272
"required": ["text"]
271
273
}),
272
-
options=mcp.ToolOptions(
273
-
meta=None,
274
-
annotations=None,
275
-
description="Convert text to uppercase",
276
-
output_schema=None,
277
-
title="Uppercase",
278
-
),
274
+
options=None,
279
275
),
280
276
],
281
277
meta=None,
@@ -321,6 +317,26 @@ Now our server has four tools: `add`, `subtract`, `reverse`, and `uppercase`! Tw
321
317
322
318
This example only scratched the surface of what we can potentially do with `wasmcp`. To see some of the more advanced patterns like custom middleware components and session-enabled features, check out the [examples](https://github.com/wasmcp/wasmcp/tree/main/examples).
323
319
320
+
## Publishing to OCI Registries
321
+
322
+
We can use [wkg](https://github.com/bytecodealliance/wasm-pkg-tools) to publish our server to an [OCI](https://opencontainers.org/) registry, like [GitHub Container Registry](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry), [Docker Hub](https://docs.docker.com/docker-hub/repos/manage/hub-images/oci-artifacts/), or [Amazon Elastic Container Registry](https://aws.amazon.com/ecr/).
We can publish any individual component, or any sequence of composed MCP feature components and middleware, as a standalone artifact in the same way. This enables dynamic and flexible composition of reusable components across servers in a kind of recursive drag-and-drop way, supporting composition and distribution of pre-built patterns which are themselves further composable. See `wasmcp compose --help` for more details on creating standalone feature compositions.
339
+
324
340
## An Open Foundation for AI Agents
325
341
326
342
By building on two complementary open standards, MCP and the WebAssembly component model, we can expose new context to AI applications and agents in a portable and composable way.
0 commit comments