Welcome to this SysSeder guide to MCP integration.
If you’ve been tracking the AI space lately, you’ve probably noticed a massive shift in how we talk about Large Language Models. We are rapidly moving away from the "chatbot" paradigm—where a human types a prompt and waits for a text block—and moving headfirst into the era of agentic workflows. We want our LLMs to act, execute, orchestrate, and play.
Clawfight.ai documents an agent battle game and an MCP endpoint using Streamable HTTP. This establishes an integration interface, not the internal architecture of its game engine.
The useful engineering question is how an application connects a model to data and tools. We will examine MCP and an illustrative TypeScript tool server; the examples below were not executed.
What is the Model Context Protocol (MCP)?
Before we look at the code, we need to understand the problem MCP solves. Historically, if you wanted to give an LLM access to external tools or data (like your database, GitHub repository, or local filesystem), you had to write custom, ad-hoc integrations. You’d write some glue code, format it as JSON Schema for OpenAI's function calling or Anthropic's tool use API, and handle the execution lifecycle yourself.
Custom integrations can duplicate work across applications. MCP standardizes the connection, while model adapters, permissions and application behavior still need implementation.
Anthropic introduced the Model Context Protocol (MCP) to establish an open standard for how applications provide context and tools to LLMs. Think of MCP as "LSP (Language Server Protocol) but for AI." Just as LSP decoupled programming language intelligence from specific IDEs, MCP decouples data sources and developer tools from LLM clients.
The architecture is elegantly split into three main components:
- MCP Hosts: Client applications (like Claude Desktop, cursor, or your custom agentic app) that initiate connections and orchestrate the LLM's reasoning loop.
- MCP Clients: Components within a host that communicate with individual servers. Connection security depends on the transport and deployment.
- MCP Servers: Lightweight, modular services that expose specific capabilities (like reading a database, querying an API, or compiling code) via standard JSON-RPC 2.0 messages.
The MCP Conceptual Architecture
┌─────────────────────────────────────────────────────────┐
│ MCP Host │
│ ┌─────────────────┐ ┌───────────────────┐ │
│ │ LLM Engine │◀───────────▶│ MCP Client │ │
│ └─────────────────┘ └───────────────────┘ │
└────────────────────────────────────────────▲────────────┘
│
JSON-RPC │ (stdio / Streamable HTTP)
Protocol │
▼
┌─────────────────────────────────────────────────────────┐
│ MCP Server │
│ ┌───────────────────────────────────────────────────┐ │
│ │ Exposed Resources, Prompts, and Tools │ │
│ │ (e.g., PostgreSQL, Git, File System, Game Engine) │ │
│ └───────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────┘
MCP as an interface for agent applications
A game-playing agent may need to inspect state and choose permitted moves. Clawfight documents such interactions as tools.
In a hypothetical game integration, an MCP server could expose state through resources and actions through tools; reusable prompts are another optional primitive. This is a design example, not a verified description of Clawfight. Other integration patterns are possible without MCP.
A stable tool interface can reduce changes to the game service when switching models. The host must still adapt model-specific tool calling and test capability, behavior and policy differences.
Hands-On: Building Your First MCP Tool Server in TypeScript
The illustrative server exposes aggregate CPU and memory metrics. It is not a security boundary or a complete diagnostic system. Use only a reviewed server with minimal OS privileges, and consider where the host sends its output.
The following unexecuted setup targets the TypeScript SDK v1 API used by this example; it is not a claim that v1 is the latest major version. Review and pin dependency versions before local use.
mkdir system-monitor-mcp
cd system-monitor-mcp
npm init -y
npm pkg set type=module
npm install @modelcontextprotocol/sdk@1 systeminformation@5
npm install --save-dev typescript@5 @types/node tsx
# Review and retain package-lock.json; no commands were run for this article.
Now, let's write our server code. Create a file named index.ts. We will use the systeminformation library to pull real metrics and expose them as an MCP tool.
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import {
CallToolRequestSchema,
ListToolsRequestSchema,
} from "@modelcontextprotocol/sdk/types.js";
import si from "systeminformation";
// 1. Initialize the MCP Server
const server = new Server(
{
name: "system-monitor-mcp",
version: "1.0.0",
},
{
capabilities: {
tools: {}, // We are registering tools capabilities
},
}
);
// 2. Define the tools available on this server
server.setRequestHandler(ListToolsRequestSchema, async () => {
return {
tools: [
{
name: "get_system_metrics",
description: "Retrieves real-time CPU load, memory utilization, and platform details from the host machine.",
inputSchema: {
type: "object",
properties: {},
additionalProperties: false,
},
},
],
};
});
// 3. Implement the tool execution logic
server.setRequestHandler(CallToolRequestSchema, async (request) => {
if (request.params.name !== "get_system_metrics") {
throw new Error(`Tool not found: ${request.params.name}`);
}
const args = request.params.arguments ?? {};
if (Object.keys(args).length !== 0) {
throw new Error("This tool accepts no arguments");
}
try {
const cpu = await si.currentLoad();
const mem = await si.mem();
const osInfo = await si.osInfo();
const metrics = {
platform: osInfo.platform,
distro: osInfo.distro,
cpuLoadPercent: Math.round(cpu.currentLoad),
memoryActiveGiB: (mem.active / 1024 / 1024 / 1024).toFixed(2),
memoryTotalGiB: (mem.total / 1024 / 1024 / 1024).toFixed(2),
memoryFreePercent: Math.round((mem.free / mem.total) * 100),
};
return {
content: [
{
type: "text",
text: JSON.stringify(metrics, null, 2),
},
],
};
} catch (error) {
return {
isError: true,
content: [
{
type: "text",
text: `Failed to retrieve system metrics: ${(error as Error).message}`,
},
],
};
}
});
// 4. Start the server using standard input/output (STDIO) transport
async function run() {
const transport = new StdioServerTransport();
await server.connect(transport);
console.error("System Monitor MCP Server running on stdio");
}
run().catch((error) => {
console.error("Fatal error running MCP server:", error);
process.exit(1);
});
Why STDIO?
StdioServerTransport uses a child process and JSON-RPC over stdin and stdout; diagnostics belong on stderr. Avoiding a listening socket reduces one exposure but does not sandbox the process, validate dependencies or prevent data leakage. Streamable HTTP is another standard transport.
Connecting Your Custom Server to an MCP Host
Claude Desktop is one possible MCP host. The configuration below is an illustration to review locally, not a tested installation or an instruction to grant additional permissions.
First, build your TypeScript file into executable JavaScript:
npx tsc index.ts --module NodeNext --moduleResolution NodeNext --target ES2022 --outDir dist --esModuleInterop --skipLibCheck
Next, find your Claude Desktop configuration file. On macOS, this is located at:
~/Library/Application Support/Claude/claude_desktop_config.json
On Windows, it is located at:
%APPDATA%\Claude\claude_desktop_config.json
Open that file (create it if it doesn't exist) and add your server configuration under the mcpServers key:
{
"mcpServers": {
"system-monitor": {
"command": "node",
"args": ["/absolute/path/to/system-monitor-mcp/dist/index.js"]
}
}
}
After reviewing the configuration and restarting the host, check its MCP status and logs; UI icons vary by version. An example request is: “Show aggregate CPU and memory metrics, without changing the system.”
If the host supports the tool and its permissions allow the call, it can return these metrics to the model for explanation. A single sample does not establish a diagnosis; no host or server was run here.
The Security Paradigm Shift with MCP
As security-minded developers, your alarm bells should be ringing. Giving an LLM access to execute code or read local system state is inherently risky (remember prompt injection?).
MCP describes security responsibilities; implementations must enforce them:
- Execution and disclosure: A local stdio server runs with its process privileges, not in an automatic sandbox. Hosts may forward tool results to a cloud model; expose only necessary information. Remote servers require separate transport and access controls.
- Validation and authorization: A schema describes inputs; the server must validate requests and independently authorize every operation. A valid argument can still request a forbidden or unsafe action.
- Consent: Hosts should provide informed user control. Approval behavior varies by product and configuration; do not assume every state-changing call prompts. Review permissions and retain human review for consequential actions.
Conclusion: The Future of Developer Tooling
Clawfight provides one documented example of an MCP-facing application. More generally, MCP can standardize tool connectivity; it does not establish agent reliability or replace application controls.
A development environment could expose separate tools for tests, code review and deployment. Treat these as different permission domains: inspecting a test failure must not implicitly authorize a commit or deployment. This is a design possibility, not a uniform-security guarantee.
What are your thoughts? Have you played around with MCP or integrated it into your workflows yet? Let me know in the comments below!
Until next time, happy coding!
— SysSeder
Primary documentation
- Host/client/server roles and optional primitives; protocol does not dictate application orchestration.
- stdio and Streamable HTTP transports; old HTTP+SSE replaced; process and HTTP security considerations.
- Security and consent responsibilities are implementation requirements, not universal guarantees.
- v1 TypeScript server API and stdio design; example deliberately targets v1 branch.
- Project describes an MCP endpoint over Streamable HTTP and tool-based gameplay, not the source article inferred resource/prompt architecture.
- osInfo returns distro, not distrib.
- mem total/free/active/available semantics in bytes.
- currentLoad is CPU load percentage.
- Local server configuration and Claude Desktop paths; no UI inspected.