MCP Configuration Guide

February 2, 2026 · View on GitHub

This document explains how to configure Model Context Protocol (MCP) services.

Overview

MCP (Model Context Protocol) is a standardized protocol that allows agents to safely interact with external systems, such as:

  • File system operations
  • GitHub repository access
  • Web search
  • Database queries

Prerequisites

Required Dependencies

pip install mcp>=1.0.0

Node.js

MCP servers are typically Node.js packages. Ensure Node.js 18+ is installed (Node.js 20+ recommended).

node --version  # Should be v18+ (v20+ recommended)

Environment Variables

Configure the following in your .env file:

VariableRequiredDescription
WORKING_DIRECTORYData directory for filesystem MCP server
TAVILY_API_KEYAPI key for web-search MCP server
GITHUB_TOKENPersonal access token for github MCP server

Example .env:

# Your data storage path (also used by filesystem MCP server)
WORKING_DIRECTORY = ./data/

# MCP (Model Context Protocol) Settings (optional)
# Tavily API key for web-search MCP server
TAVILY_API_KEY = your_tavily_api_key_here
# GitHub token for github MCP server
GITHUB_TOKEN = your_github_token_here

Global Configuration

File Location

MCP services are centrally defined in config/mcp.yaml:

servers:
  filesystem:
    command: npx
    args: ["-y", "@modelcontextprotocol/server-filesystem", "${WORKING_DIRECTORY}"]
    description: Local filesystem access for data files
    
  web-search:
    command: npx
    args: ["-y", "@anthropic/mcp-server-web-search"]
    env:
      TAVILY_API_KEY: ${TAVILY_API_KEY}
    description: Web search capabilities
    
  github:
    command: npx
    args: ["-y", "@modelcontextprotocol/server-github"]
    env:
      GITHUB_PERSONAL_ACCESS_TOKEN: ${GITHUB_TOKEN}
    description: GitHub repository access

defaults:
  - filesystem   # Enabled for all agents by default

Configuration Structure

FieldDescription
serversAll available MCP service definitions
servers.{name}.commandCommand to start the service
servers.{name}.argsCommand arguments
servers.{name}.envEnvironment variables
servers.{name}.descriptionHuman-readable description
defaultsServices enabled for all agents by default

Agent-Specific Configuration

Enable in config.yaml

In addition to global defaults, each agent can enable additional services:

# config/agents/search_agent/config.yaml
mcp_servers:
  - filesystem
  - web-search

Final Result

Agent's enabled services = defaults ∪ Agent-specific mcp_servers


Available Tools

Filesystem Server

The filesystem MCP server provides 14 tools:

ToolDescription
read_fileRead file contents as text
read_text_fileRead file with encoding support
read_media_fileRead image/audio as base64
read_multiple_filesRead multiple files simultaneously
write_fileCreate or overwrite file
edit_fileMake line-based edits to text file
create_directoryCreate directory
list_directoryList directory contents
list_directory_with_sizesList with file sizes
directory_treeRecursive tree view as JSON
move_fileMove or rename file
search_filesSearch for files by pattern
get_file_infoGet file metadata
file_existsCheck if file exists

Note

Filesystem access is restricted to ${WORKING_DIRECTORY}.

Web Search Server

Requires TAVILY_API_KEY. Provides web search capabilities.

GitHub Server

Requires GITHUB_TOKEN. Provides access to repositories, issues, and pull requests.


Programmatic Usage

import asyncio
from src.core.mcp_manager import get_mcp_manager

async def use_mcp():
    manager = get_mcp_manager()
    
    # Discover tools from a server
    tools = await manager.discover_tools("filesystem")
    
    # Call a tool
    result = await manager.call_tool(
        "filesystem",
        "read_file",
        {"path": "data/sample.csv"}
    )
    
    # Cleanup
    await manager.close_all()

asyncio.run(use_mcp())

Security Considerations

Warning

MCP services have powerful system access capabilities. Ensure:

  • Only enable necessary services
  • Securely store API tokens
  • Limit file system access scope via WORKING_DIRECTORY