or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

authentication.mdcli-interface.mdcli-options.mdconfiguration.mdcustom-commands.mdhooks.mdide-integration.mdindex.mdmcp-integration.mdsdk-integration.mdslash-commands.md
tile.json

mcp-integration.mddocs/

MCP Integration

Claude Code integrates with Model Context Protocol (MCP) servers to extend capabilities with external tools, data sources, and services. MCP enables secure, standardized communication between Claude Code and third-party tools.

Capabilities

MCP Server Configuration

Configure MCP servers through JSON configuration files.

{
  "servers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "@modelcontextprotocol/server-filesystem",
        "/path/to/allowed-directory"
      ],
      "env": {
        "NODE_ENV": "production"
      }
    },
    "git": {
      "command": "mcp-server-git",
      "args": [
        "--repository",
        ".",
        "--branch",
        "main"
      ]
    },
    "database": {
      "command": "python3",
      "args": [
        "/path/to/mcp-database-server.py",
        "--connection-string",
        "postgresql://localhost/mydb"
      ],
      "env": {
        "DB_PASSWORD": "${DB_PASSWORD}"
      }
    }
  }
}

Configuration Options:

  • command: Executable command to start the MCP server
  • args: Array of command-line arguments
  • env: Environment variables for the server process
  • Server-specific configuration through command arguments

Built-in MCP Servers

Claude Code supports various pre-built MCP servers for common functionality.

Filesystem Server

Provides secure file system access with path restrictions.

{
  "filesystem": {
    "command": "npx",
    "args": [
      "@modelcontextprotocol/server-filesystem",
      "/allowed/directory",
      "--read-only",
      "--exclude-hidden"
    ]
  }
}

Filesystem Server Features:

  • Path-restricted file access
  • Read-only mode option
  • Hidden file exclusion
  • Symlink handling
  • File type filtering

Git Server

Git repository operations and information.

{
  "git": {
    "command": "mcp-server-git",
    "args": [
      "--repository", "/path/to/repo",
      "--branch", "main",
      "--allow-push"
    ]
  }
}

Git Server Capabilities:

  • Repository status and history
  • Branch management
  • Commit operations
  • Diff and merge operations
  • Remote repository interaction

Web Search Server

Web search and content retrieval.

{
  "web-search": {
    "command": "node",
    "args": ["/path/to/web-search-server.js"],
    "env": {
      "SEARCH_API_KEY": "${SEARCH_API_KEY}",
      "MAX_RESULTS": "10"
    }
  }
}

Web Search Features:

  • Search engine integration
  • Content summarization
  • URL content extraction
  • Rate limiting and caching

Database Server

Database query and management operations.

{
  "database": {
    "command": "python3",
    "args": [
      "/path/to/db-server.py",
      "--connection-string", "postgresql://localhost/mydb",
      "--read-only"
    ],
    "env": {
      "DB_PASSWORD": "${DB_PASSWORD}"
    }
  }
}

Database Server Capabilities:

  • SQL query execution
  • Schema introspection
  • Data export/import
  • Connection pooling
  • Security and access control

MCP Server Management

Manage MCP servers through CLI commands and configuration.

# List available MCP servers
/mcp --list

# Add new MCP server
/mcp --add server-name

# Remove MCP server
/mcp --remove server-name

# Check server status
/mcp --status

# Restart server
/mcp --restart server-name

# View server logs
/mcp --logs server-name

Server Management Features:

  • Real-time server health monitoring
  • Automatic server restart on failure
  • Log aggregation and viewing
  • Configuration validation
  • Performance metrics

Command Line MCP Configuration

Configure MCP servers via command-line arguments.

# Single MCP config file
claude --mcp-config servers.json

# Multiple MCP config files
claude --mcp-config server1.json server2.json

# MCP with debugging
claude --mcp-config servers.json --mcp-debug

# MCP timeout configuration
MCP_TIMEOUT=30000 MCP_TOOL_TIMEOUT=10000 claude --mcp-config servers.json

Command-line Options:

  • --mcp-config: Specify MCP server configuration files
  • --mcp-debug: Enable MCP debugging output
  • MCP_TIMEOUT: Overall MCP operation timeout
  • MCP_TOOL_TIMEOUT: Individual tool execution timeout

MCP Tool Integration

Access MCP server tools directly through Claude Code.

# Use filesystem tools
"Read the config file using the filesystem server"

# Use git tools
"Show recent commits using git server"

# Use database tools
"Query the users table using database server"

# Use web search tools
"Search for React best practices using web search"

Tool Discovery:

  • Automatic tool discovery from connected servers
  • Tool documentation and usage examples
  • Parameter validation and type checking
  • Error handling and retry logic

Resource Access

MCP servers can provide resources like files, database records, or web content.

{
  "resources": [
    {
      "uri": "file:///path/to/config.json",
      "name": "Application Configuration",
      "description": "Main application configuration file",
      "mimeType": "application/json"
    },
    {
      "uri": "git://repository/commit/abc123",
      "name": "Recent Commit",
      "description": "Latest commit in main branch",
      "mimeType": "text/plain"
    }
  ]
}

Resource Features:

  • URI-based resource identification
  • MIME type specification
  • Resource metadata and annotations
  • Access control and permissions
  • Caching and invalidation

Authentication and Security

MCP servers support various authentication methods.

{
  "servers": {
    "secure-api": {
      "command": "node",
      "args": ["/path/to/secure-server.js"],
      "env": {
        "API_KEY": "${API_KEY}",
        "CLIENT_SECRET": "${CLIENT_SECRET}"
      },
      "auth": {
        "type": "oauth",
        "clientId": "your-client-id",
        "scopes": ["read", "write"]
      }
    }
  }
}

Authentication Types:

  • API key authentication
  • OAuth 2.0 flow
  • Basic authentication credentials
  • JWT token authentication
  • Custom authentication schemes

Server-Sent Events (SSE)

Support for streaming responses and real-time updates.

{
  "streaming-server": {
    "command": "python3",
    "args": ["/path/to/sse-server.py"],
    "features": ["sse", "streaming"],
    "env": {
      "ENABLE_STREAMING": "true"
    }
  }
}

SSE Features:

  • Real-time data streaming
  • Progress updates for long operations
  • Live monitoring and alerts
  • Bidirectional communication
  • Connection management

Custom MCP Server Development

Create custom MCP servers for specific needs.

# Python MCP server example
from mcp import Server, Tool, Resource

class CustomMCPServer(Server):
    def __init__(self):
        super().__init__("custom-server", "1.0.0")
        
    @Tool("custom-tool")
    async def custom_tool(self, param1: str, param2: int = 10):
        """Custom tool implementation"""
        result = await self.process_data(param1, param2)
        return {"result": result, "success": True}
    
    @Resource("custom-resource")
    async def custom_resource(self, uri: str):
        """Custom resource provider"""
        data = await self.fetch_resource(uri)
        return {
            "content": data,
            "mimeType": "application/json"
        }

# Start server
if __name__ == "__main__":
    server = CustomMCPServer()
    server.run()

Custom Server Features:

  • Tool registration and implementation
  • Resource provider implementation
  • Request/response handling
  • Error handling and validation
  • Health checks and monitoring

MCP Server Examples

Code Analysis Server

{
  "code-analyzer": {
    "command": "python3",
    "args": [
      "/path/to/code-analyzer-server.py",
      "--languages", "python,javascript,typescript",
      "--max-file-size", "1MB"
    ]
  }
}

Code Analysis Tools:

  • Static code analysis
  • Code quality metrics
  • Security vulnerability scanning
  • Dependency analysis
  • Performance profiling

API Testing Server

{
  "api-tester": {
    "command": "node",
    "args": [
      "/path/to/api-test-server.js",
      "--base-url", "https://api.example.com"
    ],
    "env": {
      "API_TOKEN": "${API_TOKEN}",
      "TIMEOUT": "30000"
    }
  }
}

API Testing Tools:

  • HTTP request execution
  • Response validation
  • Load testing capabilities
  • API documentation generation
  • Mock server functionality

Documentation Server

{
  "docs": {
    "command": "python3",
    "args": [
      "/path/to/docs-server.py",
      "--docs-dir", "/path/to/documentation",
      "--format", "markdown"
    ]
  }
}

Documentation Tools:

  • Documentation search and retrieval
  • API reference generation
  • Code example extraction
  • Cross-reference linking
  • Version management

Error Handling and Debugging

Debug MCP server issues and handle errors gracefully.

# Enable MCP debugging
claude --mcp-debug --mcp-config servers.json

# Check server health
/mcp --status

# View server logs
/mcp --logs server-name --tail

# Restart failed server
/mcp --restart server-name

# Validate configuration
/doctor --check-mcp

Error Types:

  • Server startup failures
  • Communication timeouts
  • Authentication failures
  • Tool execution errors
  • Resource access errors

Performance Optimization

Optimize MCP server performance and resource usage.

{
  "optimization": {
    "serverTimeout": 30000,
    "toolTimeout": 10000,
    "maxConcurrentRequests": 5,
    "connectionPoolSize": 10,
    "cacheEnabled": true,
    "cacheTTL": 300
  }
}

Performance Features:

  • Connection pooling
  • Request caching
  • Timeout configuration
  • Concurrent request limiting
  • Resource usage monitoring

MCP Protocol Details

Understanding the MCP protocol for advanced usage.

{
  "protocol": {
    "version": "1.0",
    "capabilities": {
      "tools": true,
      "resources": true,
      "prompts": true,
      "completion": true
    },
    "transport": "stdio"
  }
}

Protocol Features:

  • Standard communication protocol
  • Capability negotiation
  • Transport layer abstraction
  • Version compatibility
  • Extension mechanisms