# MCP Servers

Model Context Protocol (MCP) lets you extend Invoke's AI capabilities by connecting to external tool servers. MCP servers provide specialized tools the AI can use—from file system access to database queries to web searches.

## What is MCP?

MCP is an open protocol that allows AI assistants to securely connect to external tools and data sources. With MCP, you can:

- Give the AI access to specific directories on your file system
- Connect to databases and query data
- Enable web search capabilities
- Add specialized reasoning tools
- Integrate with any service that has an MCP server

MCP servers run locally on your machine. You control which servers are enabled and what they can access.

## How It Works

You configure MCP server  
↓  
Invoke connects to server  
↓  
Server provides tools to AI  
↓  
AI uses tools during conversations  
↓  
Server executes tool and returns results

When you enable an MCP server, its tools automatically become available to the AI. You don't need to do anything special—just chat normally and the AI will use the appropriate tools when needed.

## Adding an MCP Server

### Open MCP Settings

Go to **Settings → MCP** to access the MCP configuration panel.

### Fill in server details

In the "Add New MCP Server" section, enter:

| Field | Description | Example |
| --- | --- | --- |
| **Server Name** | Unique identifier | `filesystem` |
| **Server Package** | NPM package name | `@modelcontextprotocol/server-filesystem` |
| **Arguments** | Command-line args (optional) | `/Users/me/projects` |
| **Environment Variables** | KEY=value pairs (optional) | `DEBUG=true` |

### Click "Add Server"

Invoke will:

1. Validate the configuration  
2. Download the package via npx  
3. Connect to the server  
4. Discover available tools

### Verify connection

The server appears in "MCP Servers" with a status indicator:

- **Running** (green) — Connected and ready  
- **Stopped** (gray) — Not currently running  
- **Error** (red) — Connection failed

Click **Ping** to test the connection.

## Managing Servers

### Enable/Disable

Toggle the switch next to any server to enable or disable it without removing the configuration. Disabled servers won't provide tools to the AI.

### Test Connection

Click **Ping** next to a server to test connectivity, or click **Ping All Servers** to test everything at once.

### Remove Server

Click the trash icon to permanently remove a server configuration.

### Edit Configuration

Click **Open in Editor** to edit the `mcp.json` configuration file directly for advanced changes.

## Popular MCP Servers

Here are commonly used MCP servers you can add:

### Sequential Thinking

Enables step-by-step reasoning for complex problems.

| Field | Value |
| --- | --- |
| **Name** | `sequential-thinking` |
| **Package** | `@modelcontextprotocol/server-sequential-thinking` |

### Filesystem Access

Gives the AI read/write access to specific directories.

| Field | Value |
| --- | --- |
| **Name** | `filesystem` |
| **Package** | `@modelcontextprotocol/server-filesystem` |
| **Arguments** | `/path/to/allowed/directory` |

Only grant access to directories you want the AI to read and modify. The path you specify is the only location the server can access.

### Git Operations

Enables Git repository operations.

| Field | Value |
| --- | --- |
| **Name** | `git` |
| **Package** | `@modelcontextprotocol/server-git` |
| **Arguments** | `--repository /path/to/repo` |

### SQLite Database

Query and modify SQLite databases.

| Field | Value |
| --- | --- |
| **Name** | `sqlite` |
| **Package** | `@modelcontextprotocol/server-sqlite` |
| **Arguments** | `/path/to/database.db` |

### Web Search

Search the web for information.

| Field | Value |
| --- | --- |
| **Name** | `web-search` |
| **Package** | `@modelcontextprotocol/server-web-search` |

## Configuration File

MCP servers are stored in a JSON configuration file. You can edit this directly for advanced configuration.

**Format:**

```
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [\
        "-y",\
        "@modelcontextprotocol/server-filesystem",\
        "/Users/me/projects"\
      ],
      "env": {
        "NODE_ENV": "production"
      },
      "enabled": true
    },
    "sequential-thinking": {
      "command": "npx",
      "args": [\
        "-y",\
        "@modelcontextprotocol/server-sequential-thinking"\
      ],
      "enabled": true
    }
  }
}
```

Use **Open in Editor** in MCP Settings to edit this file directly within Invoke.

## Using MCP Tools

Once servers are configured, their tools are automatically available. Just chat normally:

**Example with Filesystem server:**

```
You: Read the contents of package.json

AI: [Uses filesystem server's read_file tool]
    Here's the contents of package.json...
```

**Example with Sequential Thinking:**

```
You: Help me design a caching strategy for my API

AI: [Uses sequential-thinking tools]
    Let me think through this step by step...
```

The AI automatically selects the right tools based on your request.

## Requirements

To use MCP servers, you need:

- **Node.js 18+** — Required to run npx commands  
- **npm** — Package manager (comes with Node.js)  
- **Internet connection** — To download server packages

If you see "npx not found" errors, install Node.js from [nodejs.org](https://nodejs.org/).

## Server Lifecycle

MCP servers are managed automatically:

| Behavior | Details |
| --- | --- |
| **Startup** | Servers start when their tools are needed |
| **Auto-disconnect** | Idle servers disconnect after 2 minutes |
| **Health checks** | Active servers are monitored every 30 seconds |
| **Tool caching** | Available tools are cached for 30 seconds |

## Troubleshooting

### Server won't connect

- Check that Node.js is installed: `node --version`
- Verify the package name is correct
- Check for typos in arguments
- Look at the error message in the status column

### Tools not appearing

- Ensure the server is enabled (toggle is on)
- Click Ping to verify connection
- Wait a few seconds for tool discovery
- Try disabling and re-enabling the server

### Permission errors

- Check the paths in your arguments
- Ensure you have read/write access to specified directories
- On macOS, grant Terminal/Invoke disk access if needed

### Package not found

- Verify the exact package name on npmjs.com
- Check your internet connection
- Try running `npx -y <package-name>` in terminal to test

## Security Considerations

- **Local execution** — All servers run on your machine
- **Explicit configuration** — You choose which servers to enable
- **Path restrictions** — File servers only access directories you specify
- **No auto-install** — Servers only install when you add them

Only install MCP servers from sources you trust. Review what a server does before adding it.
