Module 8 Β· Intermediate Β· ~50 min
π MCP β Connecting Claude to the World
The Model Context Protocol (MCP) lets you connect Claude Code to external tools, databases, and services β giving it superpowers beyond your local files.
In this module
What is MCP?
Plain English: what is MCP?
By default, Claude Code can only work with files on your computer. MCP is a standard
way to connect Claude to other things: a database, a website, GitHub, Google Drive,
Zotero, your calendar β anything you can write a connector for.
Think of MCP servers as plugins that give Claude new abilities.
Claude Code with MCP
Claude Code
Your AI assistant
MCP Protocol
Standard connector
Any tool
DB, web, APIs, files
Claude acts
Queries, writes, fetches
How MCP works
An MCP server is a small program that runs on your computer (or a remote server) and exposes tools that Claude can call. For example:
- A database MCP server exposes tools like
query_database(sql)andlist_tables() - A GitHub MCP server exposes tools like
create_pr(title, body)andlist_issues() - A Zotero MCP server exposes tools like
search_library(query)andget_citation(key)
You configure which servers to run in ~/.claude/settings.json, and Claude automatically has access to their tools.
Adding MCP servers
You add MCP servers to your settings file:
// ~/.claude/settings.json
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/you/research"]
},
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "your_token_here"
}
}
}
}
Or add them via the command line (easier for beginners):
# Add the official Anthropic filesystem server
claude mcp add filesystem npx @modelcontextprotocol/server-filesystem ~/research
# Add a GitHub server
claude mcp add github npx @modelcontextprotocol/server-github
# List all configured servers
claude mcp list
MCP servers for researchers
| Server | What it does | How to install |
|---|---|---|
| Filesystem | Enhanced file access across multiple directories | @modelcontextprotocol/server-filesystem |
| GitHub | Create issues, PRs, manage repos from Claude | @modelcontextprotocol/server-github |
| SQLite | Query SQLite databases with natural language | @modelcontextprotocol/server-sqlite |
| Postgres | Connect to PostgreSQL databases | @modelcontextprotocol/server-postgres |
| Brave Search | Search the web from within Claude | @modelcontextprotocol/server-brave-search |
| Zotero (community) | Search your Zotero library, get citations | See community MCP registry |
| Google Scholar (community) | Search academic papers | See community MCP registry |
Research example: Query a database directly
# With SQLite MCP server configured:
> Connect to my database at data/survey.db and:
1. Show me all table names
2. Count observations in the main household table
3. Find all villages where more than 50% of households took up insurance
4. Export that list to a CSV file
Research example: Search your Zotero library
> Search my Zotero library for papers about
"index insurance smallholder Africa" and give me:
- The 5 most relevant papers with their key findings
- A properly formatted bibliography entry for each
- Which ones I should cite in my literature review
Building a simple MCP server
You can build your own MCP server to connect Claude to any tool in your research stack. Here's a minimal example in Python:
# A simple MCP server that reads Stata datasets
from mcp.server import Server
from mcp.server.models import InitializationOptions
import mcp.types as types
app = Server("stata-reader")
@app.list_tools()
async def handle_list_tools() -> list[types.Tool]:
return [
types.Tool(
name="read_stata",
description="Read a Stata .dta file and return summary info",
inputSchema={
"type": "object",
"properties": {
"filepath": {"type": "string"}
}
}
)
]
@app.call_tool()
async def handle_call_tool(name: str, arguments: dict):
if name == "read_stata":
import pandas as pd
df = pd.read_stata(arguments["filepath"])
return [types.TextContent(
type="text",
text=str(df.describe())
)]
Module 12 (Agents & API) goes deeper into building custom MCP servers.
Module 8 Exercise: Add your first MCP server
Add the official filesystem MCP server and use it:
- Run:
claude mcp add filesystem npx @modelcontextprotocol/server-filesystem ~/Documents - Start a Claude Code session and ask: "Using the filesystem server, list all .csv files in my Documents folder"
- Try: "Find all .do files (or .R or .py files) in my Documents and summarise what research projects I have"
- If you have a SQLite database, add that server too and try a natural language query
TerminalMCP~30 min