BrainIT Consulting · Free Field Guide No. 5
Build Your First Useful Business MCP Server
Go from a new computer to a tested, read-only business connection using fictional data, free tools and ChatGPT sign-in.
See what you are building
MCP stands for Model Context Protocol. It is a standard way for an AI application to discover approved information and narrowly described tools. It does not make every business system available to an AI.
Codex is the host. The MCP connection is the client that carries structured requests and results. Your local program is the server that decides what is technically possible.
| Capability | What it returns | What it cannot do |
|---|---|---|
| business://profile | Approved fictional business information | Change the profile |
| search_services | Matches from the recorded catalogue | Invent a service or price |
| check_service_area | Exact matches from the town list | Book or promise availability |
The server uses STDIO: Codex starts the program and speaks through its input and output streams. It is not a public website and does not listen on a network port.
Draw the safety boundary first
When someone asks about the fictional business, return only approved profile, service and service-area facts. If the information is absent, say that a person must review it. Do not take an external action.
Included
- Read three known JSON files in this project.
- Return the fictional business profile.
- Search the approved fictional service catalogue.
- Check a town against the recorded service-area list.
Deliberately excluded
- Real customer, employee, payment, health or identity data.
- Email, appointments, prices, estimates or payments.
- File changes, CRM access, databases or web requests.
- Remote hosting, OAuth or public deployment.
A local MCP startup command runs software on your computer with the privileges of the application that launched it. Read an unfamiliar command and its source before approving it. Here, you build the source and can see every file it reads.
Install the free foundations
These instructions use Windows PowerShell. The project files are the same on macOS or Linux, but paths and install commands differ.
node --version
npm --version
npx --versionSet-Location "$env:USERPROFILE\Documents"
New-Item -ItemType Directory -Name business-facts-mcp
Set-Location .\business-facts-mcp
Get-Locationnpm installs project packages. npx can run a package temporarily. If a version command fails, stop here and use the troubleshooting chapter.
Create the project and approved information
Run these commands from the empty business-facts-mcp folder. Versions are pinned to the combination that passed this guide’s six-test suite on August 1, 2026.
npm init -y
npm install @modelcontextprotocol/server@2.0.0 zod@4.4.3
npm install -D @modelcontextprotocol/client@2.0.0 @types/node@26.1.2 typescript@7.0.2
New-Item -ItemType Directory -Name src
New-Item -ItemType Directory -Name data
New-Item -ItemType Directory -Name test
code .If code is not recognized, open Visual Studio Code normally, choose File → Open Folder, and select business-facts-mcp.
Use the complete tested starter
Download, unzip and compare every file. It contains the code, fictional data, pinned packages, build settings, README and six automated checks. Generated packages and compiled output are not included.
After setup, the project should have this shape:
The JSON files hold the approved facts. The server code controls how those facts may be exposed. A future owner can update an approved service without rewriting the server.
Build the server and profile resource
Create src\server.ts or use the starter version. It imports Node’s file reader, the MCP server class, the local STDIO transport and Zod for input validation.
The helper readJson reads only a named file from this project’s data folder. The server instructions explicitly prohibit invented prices, availability, bookings, promises and service areas.
server.registerResource(
"business-profile",
"business://profile",
{
title: "Approved business profile",
description: "Fictional public business facts for this learning exercise.",
mimeType: "application/json",
},
async (uri) => {
const business = await readJson("business.json");
return {
contents: [{
uri: uri.href,
mimeType: "application/json",
text: JSON.stringify(business, null, 2),
}],
};
},
);A resource is reference information a host can read. Reading this profile does not change anything. The complete source file in the starter also registers the tools and starts the transport.
Add two useful read-only tools
A tool accepts structured input and performs one described operation. Zod rejects missing or malformed input before the handler does any work.
search_services
Accepts a short query such as gutter. Returns only matching entries from services.json. Zero matches means “not recorded,” never permission to invent an answer.
check_service_area
Accepts a town such as Clayton. Reports an exact match against the recorded list. A supported town still does not promise availability.
annotations: {
readOnlyHint: true,
destructiveHint: false,
openWorldHint: false,
}Annotations help a client understand a tool’s consequence. They do not create safety by themselves: the actual handler must remain read-only. The starter handlers read local files, filter or compare values, and return structured results. They do not write files, access a network or contact anyone.
| Input | Expected server result | Boundary retained |
|---|---|---|
| gutter | One recorded service match | No price or booking |
| pool repair | Zero matches and human review | No inferred offering |
| Athens | Not on the approved list | No claim about wider service |
Build it without breaking STDIO
Compile the TypeScript and check that the server file exists:
npm run build
Test-Path .\build\server.jsThe build should return to the prompt without an error. The path check should print True.
If you run node build\server.js directly, the blank-looking terminal is normal: the server is waiting for an MCP client. Press Ctrl+C to stop it.
- Source
- src/server.ts
- Compiled
- build/server.js
- Transport
- Local STDIO
- Network
- None
- Writes
- None
- Startup log
- Standard error only
Test before an AI model is involved
MCP Inspector lets you inspect the resource and tools directly. Run it from the project folder:
npx @modelcontextprotocol/inspector node build/server.jsThe first run may download Inspector. A browser window should open; if it does not, open the local address printed in PowerShell.
| Case | Expected |
|---|---|
| Profile resource | Fictional Cedar Bridge profile |
| gutter | One service match |
| pool repair | Zero matches; do not infer |
| Clayton | supported: true |
| Athens | supported: false |
| Missing required field | Validation error |
Run the automated launch check
npm testA successful run ends with:
# tests 6
# pass 6
# fail 0Starter verified: six tests passed
This is the observed result from the supplied starter on August 1, 2026. Do not continue to Codex if your local run shows a failure.
Install Codex and sign in with ChatGPT
The server and Inspector work without an AI account. Add Codex only after the server has passed its own checks.
Install on Windows
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"The official npm alternative is:
npm install -g @openai/codexClose and reopen PowerShell, then check:
codex --version
codex loginChoose Sign in with ChatGPT and complete the browser flow. This guide does not use an API key. ChatGPT sign-in uses subscription access when available; API-key sign-in is a separate usage-based path.
codex login statusOfficial instructions may change. If the installer behaves differently, use the current OpenAI Codex CLI documentation.
Connect Codex and run the Launch Card
Return to the project folder, rebuild, and ask PowerShell for the exact compiled path:
npm run build
$serverPath = (Resolve-Path .\build\server.js).Path
$serverPath
codex mcp add business-facts -- node $serverPath
codex mcp list
codexThe list should show business-facts. Inside Codex, type /mcp and confirm that the server is active.
MCP Server Launch Card
Troubleshoot, verify and extend safely
“node,” “npm,” or “npx” is not recognized
The TypeScript build reports an error
Inspector cannot connect
The server does not appear in Codex
The tool appears but Codex does not choose it
The answer contains an invented business fact
Advance one boundary at a time
Do not jump directly to email sending, live customer data, CRM changes or public hosting. Those steps need identity, authorization, privacy, activity records, error recovery and consequence-specific tests.
A useful MCP server is not the one with the most tools. It is the one whose information, actions and limits the business can explain and test.
Use it alone—or ask for a second pair of eyes
You can complete the guide and use the starter entirely on your own. If another perspective would help, BrainIT can review the boundary, help replace fictional information with approved facts, or plan one carefully controlled next connection.
Sources and limits
This guide uses current official documentation from the Model Context Protocol project, Node.js, and OpenAI. The package versions passed the included six-test suite on August 1, 2026.
The Launch Card and fictional Customer Inquiry Helper are BrainIT teaching devices. This is general educational guidance, not legal advice, a security certification, or a guarantee that a model or server will behave correctly in every environment.
Emile du Toit · BrainIT Consulting