MCP#
gptme acts as a MCP client supporting MCP servers (Model Context Protocol), allowing integration with external tools and services through a standardized protocol.
We also intend to expose tools in gptme as MCP servers, allowing you to use gptme tools in other MCP clients.
Configuration#
You can configure MCP in your ~/.config/gptme/config.toml
file:
[mcp]
enabled = true
auto_start = true
[[mcp.servers]]
name = "my-server"
enabled = true
command = "server-command"
args = ["--arg1", "--arg2"]
env = { API_KEY = "your-key" }
Configuration Options#
enabled
: Enable/disable MCP support globallyauto_start
: Automatically start MCP servers when neededservers
: List of MCP server configurationsname
: Unique identifier for the serverenabled
: Enable/disable individual servercommand
: Command to start the serverargs
: List of command-line argumentsenv
: Environment variables for the server
MCP Server Examples#
Memory Server#
The memory server is a useful example of an MCP server that provides persistent knowledge storage:
[[mcp.servers]]
name = "memory"
enabled = true
command = "npx"
args = [
"-y",
"@modelcontextprotocol/server-memory"
]
env = { MEMORY_FILE_PATH = "/path/to/memory.json" }
The memory server provides these tools for knowledge graph manipulation:
create_entities
: Create new entities with observationscreate_relations
: Create relationships between entitiesadd_observations
: Add new observations to entitiesread_graph
: Read the entire knowledge graphsearch_nodes
: Search for entities and their relations
Running MCP Servers#
Each server provides its own set of tools that become available to the assistant.
MCP servers can be run in several ways:
Using package managers like
npx
,uvx
, orpipx
for convenient installation and executionRunning from source or pre-built binaries
Using Docker containers
Warning
Be cautious when using MCP servers from unknown sources, as they run with the same privileges as your user.
You can find a list of available MCP servers in the example servers and MCP directories like MCP.so.