Run your first server
Start with the tool server example. It answers questions about the type, growth habit, maturity time, and traits of two made-up pea varieties. It includes both ordinary tests and tests of AI tool choice and explanations.
You need Git, Node.js 22 or newer, and npm. Continuous integration (CI) exercises Node.js 22 and 24. This is a local development quickstart, not production deployment guidance.
The tool server example directory contains the maintained source and the public initializer package used below.
Create the project
Section titled “Create the project”Run this command from a directory where you keep projects. Choose another name
if my-mcp already exists.
npm init @emseepea/tool-server -- my-mcpcd my-mcpThe initializer creates a private standalone project. Its package.json uses
published versions of @emseepea/server and @emseepea/testing. Em See Pea is
beta; see
maturity and support
for the limits of that label.
Install and check it
Section titled “Install and check it”Run these commands inside my-mcp:
npm install --ignore-scriptsnpm testnpm run lintThe tests build your server and call it through MCP. They do not require a language-model account. A passing run ends with no failed tests.
Start your server
Section titled “Start your server”npm startThe terminal prints its local MCP address, normally
http://127.0.0.1:3000/mcp. Keep that terminal open while using the server.
Stop it with Control-C. If port 3000 is in use, stop the other local example first.
Connect using an MCP client that supports MCP 2026-07-28 and Streamable HTTP.
Add the printed address to that client’s server connections, then try asking:
What are the pea type, growth habit, days to maturity, and traits of Highland Snap?
Client setup varies. Older clients may not support this protocol version. The example’s tests use the matching official MCP client.
Make it yours
Section titled “Make it yours”Open src/capabilities/tool.get-pea-variety.ts in your project:
varietiescontains the sample data. Replace it with your own data.inputSchemadescribes the names the tool accepts.outputSchemadescribes the details it returns.handlerlooks up the pea variety and returns structured data.
Em See Pea checks the input and output, returns the data as MCP
structuredContent, and serializes the same data as JSON text for clients that
do not consume structured content. Your handler supplies the behaviour.
Update test/server.test.mjs for your data, then run npm test again.
src/server.ts calls discoverCapabilities(new URL("./capabilities/", import.meta.url))
once during startup. Explicit tools, resources, and prompts arrays still
work when you need them.
Check the AI’s tool choice and explanation
Section titled “Check the AI’s tool choice and explanation”The example’s eval/meaning.test.mjs checks that a model does not confuse pea
type, growth habit, maturity time, and traits. Adapt its question and expected facts
when you change the tool.
This check requires a signed-in Claude CLI and uses model allowance. See the AI testing guide for setup and what the results prove.
npm run test:llmThe model sees the advertised tools and must select get-pea-variety with
arguments that the real server accepts. The test then checks whether the model
understands the returned pea variety details.
Add another capability
Section titled “Add another capability”Browse the examples to connect a public API, add authentication, send progress updates, or add a web form.
Build a production container
Section titled “Build a production container”To build and configure this project as a production container, read Build a production container.