How to use MCP servers
What is an MCP server?
The Model Context Protocol (MCP) is an open-source standard for connecting AI applications to external systems. Its own documentation compares it to a USB-C port for AI applications: one standard plug instead of a different cable for every device. An MCP server is a program that offers an AI app access to something: your files, a database, a calendar, a design tool or a search engine.
Hosts, clients and servers
- Host: the AI app you use, such as Claude Desktop or Visual Studio Code.
- Client: a connection the host creates, one for each server.
- Server: the program that provides the context or actions.
According to the MCP architecture overview, servers offer three kinds of thing:
| Primitive | What it is | Example |
|---|---|---|
| Tools | Actions the AI can run | Query a database, create a file, call an API |
| Resources | Data the AI can read for context | A file's contents, a database schema |
| Prompts | Reusable templates for common tasks | A ready-made "review this pull request" prompt |
Try it: this question describes something a server offers and asks whether it is a tool, a resource or a prompt.
Multiple choice: is each feature a tool, a resource or a prompt?
Press Mark to have your answer marked in the MCP Servers course.
How to use MCP servers: step by step
- Pick an app that supports MCP. The MCP site lists AI assistants such as Claude and ChatGPT and developer tools such as Visual Studio Code and Cursor.
- Choose a server you trust. Start with official servers from the company whose service you are connecting, or the reference servers maintained by the MCP project.
- Add it in the app's settings or config file. Local servers are added as a command to run; remote ones by URL.
- Restart or reload the app so it connects and discovers the server's tools.
- Ask for something that needs the tool, such as "list the files in my notes folder", and approve the action when the app asks.
Local and remote servers
A local server runs on your own computer and talks to the app through standard input and output (the stdio transport). A remote server runs on the provider's systems and is reached over the internet with the Streamable HTTP transport; the MCP documentation recommends OAuth for signing in to them. Underneath, both send the same JSON-RPC 2.0 messages.
Many apps describe local servers in a JSON config file. An entry names the server and the command that starts it, with any arguments. For example, the MCP project's reference filesystem server is given the folders it may access:
{
"mcpServers": {
"notes": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/me/notes"]
}
}
}The exact file and format differ between apps, so follow your app's MCP instructions. If a server needs an API key, put it in the config's environment section rather than in a prompt; our guide to API keys explains why.
Using MCP servers safely
- Install only servers you trust. A server runs code and can see whatever you connect it to.
- Give the least access needed, such as one folder rather than your whole drive, or a read-only database account.
- Read approval requests. Check what a tool is about to do before allowing it, especially anything that deletes, sends or pays.
- Watch for prompt injection. Text the AI reads, such as a web page or document, can contain hidden instructions trying to make it misuse a tool. Approvals are your safety net.
Building your own MCP server
Official SDKs let you write a server in a few dozen lines: you describe each tool with a name, a description and the inputs it takes, and write the function that does the work. The MCP Servers course builds one in TypeScript and Python and tests it with the MCP Inspector. Try one: this question shows a broken server and asks you to find the fix.
Multiple choice: diagnose common problems when building and connecting a server.
Press Mark to have your answer marked in the MCP Servers course.
Common mistakes
- Invalid JSON in the config file. One missing comma or quote stops every server loading.
- Forgetting to restart the app after changing its MCP settings.
- Wrong paths. Local servers need full paths to the folders or programs they use.
- Missing software. A server started with npx needs Node.js installed; one written in Python needs Python.
- Granting too much access "just to make it work".
Common questions
What is an MCP server?
Which apps support MCP servers?
Do I need to code to use an MCP server?
What is the difference between a local and a remote MCP server?
Are MCP servers safe?
Revision cards
Read the front, say your answer, then flip to check.
Where to go next
- Solve it
Code Editor
Write and run code right in your browser
Open the tool - Learn it
MCP Servers
What MCP servers are, how to plug them into AI apps and how to build your own
Start the course