MCPAgent tools
Ask about Ada from your editor.
“Ada Lovelace worked on the Analytical Engine.” My cursor stops there. Worked on it how, exactly? This is usually where I open twelve tabs and lose the paragraph. Let’s give the editor a smaller job. Find Source Scout, show me what it can look up, and ask where I should start reading.
Resume at bookmarkFrom editor to hub
Run these real calls
Use Node.js 22 or newer. In a new folder, save the script below, install both packages and run the guest example. The script launches the server on your computer over stdio.
npm install @thalovant/mcp-server @modelcontextprotocol/sdk@1
node research.mjsYou’ll see up to three current catalog entries followed by Source Scout (source-scout).
To ask the Ada question, create an API client for Source Scout in Explore and download its identity JSON. Use the path to that file. The example uses WSS by default. For an HTTPS-only identity, add https after the file name.
node research.mjs "source-scout.json"View the complete script
import { existsSync } from "node:fs";
import { resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
const [identity, protocol = "wss"] = process.argv.slice(2);
const client = new Client({ name: "journal", version: "1.0.0" });
const server = new StdioClientTransport({
command: process.execPath,
args: [fileURLToPath(import.meta.resolve("@thalovant/mcp-server"))],
});
async function call(name, args) {
const result = await client.callTool({ name, arguments: args });
const block = result.content.find(item => item.type === "text");
if (!block) throw new Error("The tool returned no text.");
if (result.isError) throw new Error(block.text);
return JSON.parse(block.text);
}
try {
await client.connect(server);
const { data } = await call("thalovant_list_public_hubs", { limit: 3 });
for (const hub of data) console.log(hub.title, hub.slug);
const scout = await call("thalovant_get_public_hub", { hubRef: "source-scout" });
console.log(scout.title + " (" + scout.slug + ")");
if (identity) {
if (!existsSync(identity)) throw new Error("Cannot find the identity file: " + identity);
const reply = await call("thalovant_ask", {
identityFile: resolve(identity),
protocol,
text: "Who was Ada Lovelace, and what should I read next?",
lang: "en-ca",
});
if (!reply.text) throw new Error("The hub returned no answer text.");
console.log(reply.text);
}
} catch (error) {
console.error(error.message);
process.exitCode = 1;
} finally {
await client.close();
}Give the editor one small job
An editor already has the paragraph. Source Scout has research skills that can look outside it. What I wanted was a way for the two to work together without another chat window or a widget I’d have to maintain. The Model Context Protocol gives the editor a vocabulary for this. A tool has a name, a set of arguments and a result the editor can read. You can watch the same exchange from a terminal with the example above.
Browse, then choose
The first tool asks the public catalog for three hubs. The list can change by the time you try it. The second tool takes a specific slug, source-scout, so our research project doesn’t depend on Source Scout winning a popularity contest. Both calls work as a guest.
Look at the source badges on the listing. Wikipedia is a useful starting point for this question. A badge tells us something about the hub. It’s the source returned with a particular answer that you should read before putting a claim in your own paragraph.
Let the public listing be just that
Here’s the detail that trips me up when I skim an example. Opening the Source Scout listing doesn’t switch your agent over to that hub. For an actual question, the MCP server needs a client identity issued for Source Scout. Create an API client for that hub in Explore and save the downloaded identity in a private folder. The file path stays on the computer running the server.
The terminal example takes the path as its optional argument. Without it, it runs the two catalog calls and stops. With it, it makes the third call. The same tool names work in an editor that connects to the server over stdio.
Ask for the thing you’ll actually use
“Who was Ada Lovelace, and what should I read next?” The second half asks for the useful bit. The agent sends text through thalovant_ask. The local script reads the text from the tool result, including any sources the hub mentions in its reply. There’s no microphone involved. Source Scout can use AI to word an answer from sources, so I still want to open the reference and decide for myself.
When the demo changes hands
If the list and listing both appear but the question fails, focus on the runtime connection. Check that the identity file exists on the computer running the server, belongs to Source Scout and is still active. If an editor presents only the catalog tools, check which tools the host has enabled. For a shared remote server, its operator maps each signed-in user to their own credentials. A path on your laptop only makes sense to a server on your laptop.
Back to the paragraph
Here’s my test for whether this was worth building. Can I go back to the sentence with a more precise question than I started with? Ask what Ada’s notes added to the account of the Analytical Engine, follow the reading suggestion, and compare it with the first reply. One reference you’ve actually opened beats a very convincing paragraph you haven’t checked. And the browser can probably handle one more tab.