Skip to content

Commit 7afbf4b

Browse files
committed
Add some more details and clarity about the relationship between wasmcp and spin up front.
1 parent 96059c0 commit 7afbf4b

File tree

1 file changed

+30
-14
lines changed

1 file changed

+30
-14
lines changed

content/blog/mcp-with-wasmcp.md

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ author = "Ian McDonald"
1010

1111
---
1212

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+
1321
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.
1422

1523
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 {
146154
"required": ["a", "b"]
147155
}"#
148156
.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,
156158
},
157159
Tool {
158160
name: "subtract".to_string(),
@@ -269,13 +271,7 @@ class StringsTools(exports.Tools):
269271
},
270272
"required": ["text"]
271273
}),
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,
279275
),
280276
],
281277
meta=None,
@@ -321,6 +317,26 @@ Now our server has four tools: `add`, `subtract`, `reverse`, and `uppercase`! Tw
321317

322318
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).
323319

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/).
323+
324+
```
325+
$ wkg publish polyglot.wasm --package mygithub:[email protected]
326+
```
327+
328+
Anyone with read access to this artifact can then download and run the server using `wkg`.
329+
330+
```
331+
$ wkg get mygithub:[email protected]
332+
333+
$ spin up -f mygithub:[email protected]
334+
335+
Serving http://127.0.0.1:3000
336+
```
337+
338+
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+
324340
## An Open Foundation for AI Agents
325341

326342
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

Comments
 (0)