07

MCP Workshop

Hands-on: set up MCP servers, connect tools, build your own server.

MCP Workshop: Connecting AI to Everything

The Model Context Protocol (MCP) is an open standard created by Anthropic that lets AI assistants connect to external tools, data sources, and services. Think of it as the USB-C of AI — one universal connector that replaces dozens of custom integrations.

Before MCP, every AI tool needed its own bespoke integration for each data source. MCP changes that by providing a single protocol that any AI client can use to talk to any compatible server. This workshop walks you through understanding, configuring, and building MCP servers.

What is MCP?

MCP stands for Model Context Protocol. It is an open-source protocol that standardizes how AI applications connect to external data sources and tools. Instead of building a separate connector for every service your AI needs to access, you build one MCP server and any MCP-compatible client can use it.

Tip

The USB-C analogy: Before USB-C, every phone brand had its own charging cable. MCP does for AI integrations what USB-C did for device connectivity — one standard connector for everything.

MCP servers expose three core primitives: Resources (data the AI can read, like files or database records), Tools (actions the AI can perform, like running a query or creating a ticket), and Prompts (reusable prompt templates that guide the AI for specific tasks).

MCP Architecture

The MCP architecture follows a client-server model. An MCP Host (like Claude Code, Cursor, or Windsurf) contains an MCP Client that communicates over a Transport layer with one or more MCP Servers. Each server exposes Resources, Tools, and Prompts to the AI.

text
┌─────────────────────────────────────────┐
│  MCP Host (Claude Code, Cursor, etc.)   │
│                                         │
│  ┌─────────────┐   ┌─────────────┐      │
│  │ MCP Client  │   │ MCP Client  │      │
│  └──────┬──────┘   └──────┬──────┘      │
└─────────┼─────────────────┼─────────────┘
          │ Transport       │ Transport
          │ (stdio/HTTP)    │ (stdio/HTTP)
          │                 │
   ┌──────┴──────┐   ┌─────┴───────┐
   │ MCP Server  │   │ MCP Server  │
   │ (filesystem)│   │ (database)  │
   │             │   │             │
   │ Resources   │   │ Resources   │
   │ Tools       │   │ Tools       │
   │ Prompts     │   │ Prompts     │
   └─────────────┘   └─────────────┘
ComponentRoleExample
HostThe AI application that needs external dataClaude Code, Cursor, Windsurf
ClientManages the connection to a specific serverBuilt into the host application
TransportCommunication channel between client and serverstdio (local) or HTTP/SSE (remote)
ServerExposes capabilities to the AIFilesystem server, GitHub server, DB server
ResourcesRead-only data the AI can accessFiles, database records, API responses
ToolsActions the AI can invokeSearch, create, update, delete operations
PromptsReusable prompt templatesCode review template, bug report template

Setting Up Servers (stdio)

The simplest way to run an MCP server is via stdio transport. The host application spawns the server as a child process and communicates through standard input/output. This is ideal for local servers that run on your machine.

Here is an example configuration that sets up a filesystem MCP server for Claude Code. This server gives the AI read/write access to a specific directory:

json
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/dir"]
    }
  }
}

You can configure multiple servers at once. Each server gets a unique key and its own command configuration:

json
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/home/user/project"]
    },
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_TOKEN": "your-token-here"
      }
    },
    "postgres": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-postgres", "postgresql://localhost/mydb"]
    }
  }
}

Setting Up Servers (HTTP/SSE)

For remote servers hosted on another machine or in the cloud, MCP supports HTTP with Server-Sent Events (SSE). Instead of specifying a command, you provide a URL:

json
{
  "mcpServers": {
    "remote-db": {
      "url": "https://mcp.example.com/sse"
    }
  }
}

Remote servers are useful for shared team resources, services that need to run continuously, or connecting to APIs hosted in the cloud. The HTTP/SSE transport handles reconnection and streaming automatically.

Warning

Security matters: Only connect to MCP servers you trust. A malicious server could expose sensitive data or execute harmful actions. Always verify the source and review what tools and resources a server exposes before granting access.

Connecting to Claude Code

Claude Code reads MCP configuration from a JSON settings file. You can configure servers at the project level or globally for all projects.

To add an MCP server to your project, use the Claude Code CLI:

bash
# Add a stdio-based MCP server
claude mcp add filesystem npx -y @modelcontextprotocol/server-filesystem /path/to/dir

# Add a remote HTTP server
claude mcp add remote-api --url https://mcp.example.com/sse

# List configured servers
claude mcp list

# Remove a server
claude mcp remove filesystem

After adding a server, restart Claude Code. The AI will automatically discover the tools and resources exposed by your MCP servers. You can verify the connection by asking Claude to list its available tools.

Tip

To test MCP servers locally before connecting them to your AI tool, you can use the MCP Inspector. Run "npx @modelcontextprotocol/inspector" to launch a web UI that lets you browse a server's tools, resources, and prompts interactively.

Popular MCP Servers

The MCP ecosystem is growing rapidly. Here are some widely used servers you can set up today:

ServerPurposeInstall Command
FilesystemRead/write local filesnpx -y @modelcontextprotocol/server-filesystem /path
GitHubManage repos, issues, PRsnpx -y @modelcontextprotocol/server-github
PostgreSQLQuery and manage databasesnpx -y @modelcontextprotocol/server-postgres connstr
SlackRead and send messagesnpx -y @modelcontextprotocol/server-slack
Google DriveSearch and read documentsnpx -y @modelcontextprotocol/server-gdrive
PuppeteerBrowser automation and scrapingnpx -y @modelcontextprotocol/server-puppeteer
MemoryPersistent knowledge graphnpx -y @modelcontextprotocol/server-memory
Brave SearchWeb search integrationnpx -y @modelcontextprotocol/server-brave-search

Building Your Own MCP Server

When existing servers do not cover your use case, you can build your own. The MCP SDK is available in Python and TypeScript. Here is a basic Python server that exposes a documentation search tool:

python
from mcp.server import Server
from mcp.types import Tool, TextContent

app = Server("my-server")

@app.tool()
async def search_docs(query: str) -> list[TextContent]:
    """Search project documentation."""
    results = do_search(query)
    return [TextContent(type="text", text=str(results))]

if __name__ == "__main__":
    app.run()

You can also build MCP servers in TypeScript using the official SDK:

typescript
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";

const server = new McpServer({
  name: "my-server",
  version: "1.0.0",
});

server.tool(
  "search-docs",
  "Search project documentation",
  { query: z.string() },
  async ({ query }) => {
    const results = await doSearch(query);
    return {
      content: [{ type: "text", text: JSON.stringify(results) }],
    };
  }
);

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

Start small: Build a server with one or two tools first. Test it with the MCP Inspector, then connect it to Claude Code. You can always add more tools and resources later.

Enterprise Considerations

As MCP adoption grows within organizations, teams need to think about governance, security, and standardization. Here are the key areas to address when rolling out MCP at scale.

AreaConcernRecommendation
GovernanceWho approves new MCP servers?Establish a review process similar to dependency approval
SecurityServers can access sensitive dataAudit server permissions, use least-privilege access
AuthenticationServers may need credentialsUse environment variables, never hardcode secrets
MonitoringTracking server usage and errorsLog all tool invocations, set up alerting for failures
VersioningServer updates may break clientsPin server versions, test updates in staging first
DiscoveryTeams need to find available serversMaintain an internal server registry or catalog

Organizations should maintain an approved server catalog — an internal marketplace where teams can discover, request, and deploy vetted MCP servers. This prevents shadow IT while still enabling teams to extend their AI tooling.

Security reviews should cover what data each server can access, what actions its tools can perform, and how authentication credentials are managed. Treat MCP server approval with the same rigor as approving a new third-party dependency in your codebase.

Vibe Voyager — The Agentic Coding Odyssey