MCP Server Configuration Manual

Version 0.1.0

Welcome to the MCP Servers Configuration Manual.

Introduction

The MCP Flake provides declarative configuration for Model Control Protocol servers and clients.

Features

Configuration Options

Base Options

services.mcpServers.enable

Whether to enable MCP servers functionality.

Details
  • Type: boolean
  • Default: false
  • Example: true

Server Options

services.mcpServers.servers..command

Command to run the MCP server.

Details
  • Type: string
  • Default: "npx"
  • Example: "/path/to/custom/command"

services.mcpServers.servers..enable

Enable or disable this MCP server configuration.

Details
  • Type: boolean
  • Default: false
  • Example: true

services.mcpServers.servers..env

Environment variables to set when running the server.

Details
  • Type: attribute set of strings
  • Default: {}
  • Example: { GITHUB_PERSONAL_ACCESS_TOKEN = "ghp_abcdef123456"; }

services.mcpServers.servers..filesystem.args

Default arguments for the filesystem MCP server.

Details
  • Type: list of strings
  • Default: ["-y", "@modelcontextprotocol/server-filesystem"]

services.mcpServers.servers..filesystem.extraArgs

Directories to provide access to.

Details
  • Type: list of strings
  • Example: ["/home/user/Documents", "/home/user/Projects"]

services.mcpServers.servers..type

Type of MCP server.

Details
  • Type: string
  • Example: "filesystem" or "github"

Client Options

services.mcpServers.clients..clientType

Type of MCP client to configure.

Details
  • Type: string, one of "claudeDesktop", "cursor"
  • Default: Depends on the client name
  • Example: "claudeDesktop"

services.mcpServers.clients..configPath

Path to the client configuration file. If not specified, a default path will be used.

Details
  • Type: string
  • Default: ""
  • Example: "~/Library/Application Support/Claude/claude_desktop_config.json"

services.mcpServers.clients..enable

Whether to enable this MCP client configuration.

Details
  • Type: boolean
  • Default: false
  • Example: true

services.mcpServers.clients..servers

List of MCP server names to enable for this client.

Details
  • Type: list of strings
  • Default: []
  • Example: ["filesystem", "github"]

Example Configuration

{
  services.mcpServers = {
    enable = true;

    servers.filesystem = {
      enable = true;
      type = "filesystem";
      command = "npx";
      filesystem.extraArgs = [
        "/home/user/projects"
        "/home/user/documents"
      ];
    };

    servers.github = {
      enable = true;
      type = "github";
      command = "npx";
      env.GITHUB_PERSONAL_ACCESS_TOKEN = "ghp_yourtokenhere";
    };

    clients.claude = {
      enable = true;
      clientType = "claudeDesktop";
      servers = [ "filesystem" "github" ];
    };

    clients.cursor = {
      enable = true;
      clientType = "cursor";
      servers = [ "filesystem" ];
    };
  };
}

Source Code

For more details, check out the source code on GitHub.