Skip to content
DocsUse AItoolsMCP Servers
Chapter 8 of 15·tools·12 min read

MCP Servers

MCP Servers

Model Context Protocol servers for extended capabilities

Hover or tap any paragraph to see Vietnamese translation

What is MCP?

MCP (Model Context Protocol) is an open protocol that allows AI assistants to connect to external data sources and tools. It acts as a bridge between Claude and services like databases, APIs, file systems, and more.

With MCP, Claude Code can access realtime information from systems you use, instead of relying only on trained knowledge. This opens up unlimited integration possibilities.

How MCP Works

MCP servers run as independent processes and communicate with Claude through a standard protocol. Each server provides a set of tools and resources that Claude can use.

MCP Architecture
External Service
Database, API, etc.
MCP Server
Tools, Resources, Prompts
Claude Code
AI Assistant
Tools
Query database
Create files
Send messages
Resources
Schema info
File contents
API docs
Prompts
Templates
Workflows
Shortcuts

Filesystem Server

Allows Claude to access and manipulate the file system safely, with controlled permissions.

settings.json
1{2  "mcpServers": {3    "filesystem": {4      "command": "npx",5      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/allowed/dir"]6    }7  }8}

GitHub Server

Integrates with GitHub to manage issues, PRs, repositories, and workflows.

settings.json
1{2  "mcpServers": {3    "github": {4      "command": "npx",5      "args": ["-y", "@modelcontextprotocol/server-github"],6      "env": {7        "GITHUB_TOKEN": "ghp_xxxxxxxxxxxx"8      }9    }10  }11}

PostgreSQL Server

Allows Claude to query PostgreSQL database, view schema, and perform CRUD operations.

settings.json
1{2  "mcpServers": {3    "postgres": {4      "command": "npx",5      "args": ["-y", "@modelcontextprotocol/server-postgres"],6      "env": {7        "DATABASE_URL": "postgresql://user:pass@localhost:5432/mydb"8      }9    }10  }11}

Slack Server

Integrates Slack to read messages, send notifications, and manage channels.

settings.json
1{2  "mcpServers": {3    "slack": {4      "command": "npx",5      "args": ["-y", "@modelcontextprotocol/server-slack"],6      "env": {7        "SLACK_BOT_TOKEN": "xoxb-xxxxxxxxxxxx"8      }9    }10  }11}

Configuring MCP Servers

MCP servers are configured in Claude Code's settings.json file. You can add multiple servers and Claude will automatically use tools from all configured servers.

settings.json
1# Location of settings file:2# macOS/Linux: ~/.claude/settings.json3# Windows: %USERPROFILE%\.claude\settings.json45# Example with multiple servers:6{7  "mcpServers": {8    "filesystem": {9      "command": "npx",10      "args": ["-y", "@modelcontextprotocol/server-filesystem", "."]11    },12    "github": {
Tip
You can use environment variables ($VAR) in configuration to avoid hardcoding credentials.

Using MCP Tools

When an MCP server is configured, its tools automatically become available in Claude. You can ask Claude to use them in natural language.

Usage Examples
1# With GitHub server configured:2"Create a new issue in the repo for the login bug"34# With PostgreSQL server configured:5"Show me all users who signed up in the last week"67# With Slack server configured:8"Send a message to #dev channel about the deployment"910# Claude will automatically use the appropriate MCP tools

Creating Custom MCP Servers

You can create your own MCP server to integrate with any service. MCP SDK is available for multiple languages.

custom-server.ts
1// Example: Simple MCP server in TypeScript2import { Server } from "@modelcontextprotocol/sdk/server/index.js";3import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";45const server = new Server({6  name: "my-custom-server",7  version: "1.0.0"8}, {9  capabilities: {10    tools: {}11  }12});

Debugging MCP Servers

When an MCP server has errors, you can debug by viewing logs and testing tools manually.

Debugging
1# View MCP server logs2claude --mcp-debug34# Test MCP server directly5npx @modelcontextprotocol/inspector67# List available MCP tools in Claude8/mcp list910# Check MCP server status11/mcp status

Key Takeaways

Điểm Chính

  • MCP connects Claude to external data sources and toolsMCP kết nối Claude với nguồn dữ liệu và công cụ bên ngoài
  • Servers are configured in ~/.claude/settings.jsonServers được cấu hình trong ~/.claude/settings.json
  • Popular servers: filesystem, GitHub, PostgreSQL, SlackServers phổ biến: filesystem, GitHub, PostgreSQL, Slack
  • You can create custom MCP servers for any integrationBạn có thể tạo MCP server tùy chỉnh cho bất kỳ tích hợp nào

Practice

Test your understanding of this chapter

Quiz

What does MCP stand for?

MCP là viết tắt của gì?

True or False

MCP servers must be written in JavaScript/TypeScript.

MCP servers phải được viết bằng JavaScript/TypeScript.

Code Challenge

Complete the settings.json path for MCP configuration

Hoàn thành đường dẫn settings.json cho cấu hình MCP

~/./settings.json
Quiz

What components does an MCP server provide?

MCP server cung cấp những thành phần nào?

← → to navigate chapters
Built: 4/8/2026, 12:01:11 PM