Day 05 Day 5

Day 5

Day 5

~1 hour Intermediate Hands-on Precision AI Academy

Today's Objective

Build a working custom MCP server that connects Claude to a real API. Learn the security model that keeps your credentials and data safe. Understand where MCP and agentic AI are heading — and how to stay ahead of it.

Build a working custom MCP server that connects Claude to a real API. Learn the security model that keeps your credentials and data safe. Understand where MCP and agentic AI are heading — and how to stay ahead of it.

When to build a custom MCP server

The 200+ community MCP servers cover the major tools. You need a custom server when:

Custom MCP servers are small Node.js programs. You don't need to be a senior engineer. If you can write basic JavaScript, you can build one in under an hour.

Build a custom MCP server from scratch

We'll build a server that gives Claude access to a simple REST API — in this case, a weather API and a custom note-taking function. This template works for any API.

Step 1: Initialize the project

terminal.txt
TERMINAL
mkdir my-mcp-server
cd my-mcp-server
npm init -y
npm install @modelcontextprotocol/sdk

Step 2: Create the server file

index.js
JAVASCRIPT
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
import { ListToolsRequestSchema, CallToolRequestSchema } from '@modelcontextprotocol/sdk/types.js';
import fs from 'fs';

// Create the MCP server
const server = new Server(
  { name: 'my-tools', version: '1.0.0' },
  { capabilities: { tools: {} } }
);

// Define available tools
server.setRequestHandler(ListToolsRequestSchema, async () => ({
  tools: [
    {
      name: 'save_note',
      description: 'Save a note to a local file for later reference',
      inputSchema: {
        type: 'object',
        properties: {
          title: { type: 'string', description: 'Note title' },
          content: { type: 'string', description: 'Note content' }
        },
        required: ['title', 'content']
      }
    },
    {
      name: 'get_weather',
      description: 'Get current weather for a city',
      inputSchema: {
        type: 'object',
        properties: {
          city: { type: 'string', description: 'City name' }
        },
        required: ['city']
      }
    }
  ]
}));

// Handle tool calls
server.setRequestHandler(CallToolRequestSchema, async (request) => {
  const { name, arguments: args } = request.params;

  if (name === 'save_note') {
    const filename = `./notes/${args.title.replace(/\s+/g,'-')}.md`;
    fs.mkdirSync('./notes', { recursive: true });
    fs.writeFileSync(filename, `# ${args.title}\n\n${args.content}`);
    return { content: [{ type: 'text', text: `Saved note to ${filename}` }] };
  }

  if (name === 'get_weather') {
    // Replace with your actual weather API key + endpoint
    const apiKey = process.env.WEATHER_API_KEY;
    const url = `https://api.openweathermap.org/data/2.5/weather?q=${args.city}&appid=${apiKey}&units=imperial`;
    const res = await fetch(url);
    const data = await res.json();
    const summary = `${data.name}: ${data.main.temp}°F, ${data.weather[0].description}`;
    return { content: [{ type: 'text', text: summary }] };
  }

  throw new Error(`Unknown tool: ${name}`);
});

// Start server
const transport = new StdioServerTransport();
await server.connect(transport);

Step 3: Update package.json for ES modules

package.json
JSON
{
  "name": "my-mcp-server",
  "version": "1.0.0",
  "type": "module",
  "main": "index.js",
  "scripts": {
    "start": "node index.js"
  }
}

Step 4: Register with Claude Desktop

claude_desktop_config.json
JSON
{
  "mcpServers": {
    "my-tools": {
      "command": "node",
      "args": ["/absolute/path/to/my-mcp-server/index.js"],
      "env": {
        "WEATHER_API_KEY": "your_api_key_here"
      }
    }
  }
}

Restart Claude Desktop. You'll now see your custom tools in the tool list. Ask Claude: "Save a note titled 'Meeting Notes' with the content 'Discussed Q2 roadmap.'" Claude will call your save_note tool and create the file.

Security: what to know before you connect anything

MCP servers run with your user permissions. A malicious MCP server could read, write, or delete files, make network requests, or exfiltrate data. Only install servers from sources you trust. Treat MCP servers like browser extensions.

For a home or personal development environment, the official Anthropic-maintained servers are safe. For corporate environments, discuss with your IT/security team before deploying MCP servers that access internal systems.

The future: AI that acts for you on your desktop

Agentic AI means AI that takes actions — not just answers questions, but actually does things on your behalf. MCP is 6 months old as of early 2026. The ecosystem is expanding fast:

The people who learn MCP now will have a significant advantage as these capabilities arrive. The concepts are the same: tools, context, agent loops. The scope just gets bigger.

You've completed the course.

You can now install Claude Desktop, build Projects with custom instructions, install and configure MCP servers, run advanced workflows, and build your own MCP server from scratch. That's more than most people with months of Claude experience.

Take the Live Bootcamp — $1,490

Course Complete

Completing all five days means having a solid working knowledge of Claude Desktop. The skills here translate directly to real projects. The next step is practice — pick a project and build something with what was learned.

Supporting Videos & Reading

Go deeper with these external references.

Day 5 Checkpoint

Before moving on, verify you can answer these without looking:

Live Bootcamp

Learn this in person — 2 days, 5 cities

Thu–Fri sessions in Denver, Los Angeles, New York, Chicago, and Dallas. $1,490 per seat. June–October 2026.

Reserve Your Seat →
Back to Course
Claude Desktop — Full Course Overview