Skip to main content
Glama
Local Runbook MCP Server

Local Runbook MCP Server

by danielhunex
README.md
# Local Runbook MCP Server

A tiny, read-only MCP server for searching two fictional troubleshooting notes. It's the companion code for the article [*Building Your First Tiny MCP Server*](https://devdigest.net/building-a-small-mcp-server/).

The server has one tool, `search_runbooks`. It looks for all query words across a runbook's title, tags and checks, then returns matching notes as JSON. It doesn't read your disk, run commands or contact a service.

## Run locally

The server requires Node.js 20 or newer. The optional MCP Inspector (version 2.14) requires Node.js 22.23.4+, 24.22.1+, or 26.12.1+.

```powershell
npm ci
npm start
```

The terminal prints `local-runbooks: ready on stdio` and waits. This is expected: an MCP client has to connect before anything else happens. Press Ctrl+C to stop this manual run.

## Test the tool without VS Code

```powershell
npm test
```

The tests launch the server over stdio, discover its tool, call it with a matching query, check a no-match result and verify that blank input is rejected.

For an interactive test, run:

```powershell
npx @modelcontextprotocol/inspector node server.mjs
```

Connect in the Inspector, open **Tools**, select `search_runbooks`, and try `{"query":"package restore"}`.

## Connect from VS Code

1. Open the Command Palette and choose **MCP: Add Server**.
2. Choose **Command (stdio)**.
3. Supply `node "C:\absolute\path\to\runbook-mcp-example\server.mjs"`, using your actual path.
4. Use the server ID `local-runbooks`. For personal use, choose **Global → Copilot Global** if offered.
5. Review the trust prompt and enable the tool for your agent.

Then ask in agent chat:

> Call search_runbooks with query "package restore". Show the runbook ID and summarize the checks. Do not execute any steps.

Expand the tool call to confirm that VS Code invoked `search_runbooks`. A plausible answer alone doesn't prove it did.

## Notes

- The runbooks are sample data, not production troubleshooting guidance.
- The tool description and read-only annotation are useful hints, not an enforcement mechanism. The implementation is read-only because it only searches a static array.
- Never log with `console.log` in a stdio server. Use `console.error` so protocol messages on stdout remain intact.
- Licensed under the [MIT License](LICENSE).

TDQS

B3.4/5.0

Scored across 1 tool

Disambiguation5/5

There is only one tool, so there is no possibility of selecting the wrong one. Its stated purpose (read-only lookup of troubleshooting notes) is unambiguous.

Naming Consistency5/5

The single name follows a clear verb_noun snake_case convention (search_runbooks) that would scale predictably. No conflicting conventions to reconcile.

Tool Count2/5

A server framed as a runbook manager exposes only one lookup operation, which is too thin for the apparent scope. There is no way to browse, read in full, or contribute runbooks, so the surface feels like a stub.

Completeness2/5

Search is the only operation; there is no tool to fetch a full runbook by id, list or index available runbooks, or add/update notes. After a search returns a match, an agent has no lifecycle path to act on it.