Model Context Protocol
Model Context Protocol (MCP) is an open protocol that allows AI models to safely interact with external tools and data sources. Pythinker Code supports connecting to MCP servers to extend AI capabilities.
What is MCP
MCP servers provide "tools" for AI to use. For example, a database MCP server can provide query tools that allow AI to execute SQL queries; a browser MCP server can let AI control browsers for automation tasks.
Pythinker Code has built-in tools (file read/write, shell commands, web fetching, etc.). Through MCP, you can add more tools, such as:
- Accessing specific APIs or databases
- Controlling browsers or other applications
- Integrating with third-party services (GitHub, Linear, Notion, etc.)
MCP server management
Use the pythinker mcp command to manage MCP servers.
Add a server
Add an HTTP server:
# Basic usage
pythinker mcp add --transport http context7 https://mcp.context7.com/mcp
# With headers
pythinker mcp add --transport http context7 https://mcp.context7.com/mcp \
--header "CONTEXT7_API_KEY: your-key"
# Using OAuth authentication
pythinker mcp add --transport http --auth oauth linear https://mcp.linear.app/mcpAdd a stdio server (local process):
pythinker mcp add --transport stdio chrome-devtools -- npx chrome-devtools-mcp@latestList servers
pythinker mcp listWhile Pythinker Code is running, you can also enter /mcp to view connected servers and loaded tools.
Remove a server
pythinker mcp remove context7OAuth authorization
For servers using OAuth, you need to complete authorization first:
pythinker mcp auth linearThis will open a browser to complete the OAuth flow. After successful authorization, Pythinker Code will save the token for future use.
Test a server
pythinker mcp test context7MCP configuration file
MCP server configuration is stored in ~/.pythinker/mcp.json, in a format compatible with other MCP clients:
{
"mcpServers": {
"context7": {
"url": "https://mcp.context7.com/mcp",
"headers": {
"CONTEXT7_API_KEY": "your-key"
}
},
"chrome-devtools": {
"command": "npx",
"args": ["chrome-devtools-mcp@latest"],
"env": {
"SOME_VAR": "value"
}
}
}
}Temporary configuration loading
Use the --mcp-config-file flag to load a configuration file from another location:
pythinker --mcp-config-file /path/to/mcp.jsonUse the --mcp-config flag to pass JSON configuration directly:
pythinker --mcp-config '{"mcpServers": {"test": {"url": "https://..."}}}'Loading status
MCP servers initialize asynchronously after the shell UI starts, so the interface is usable immediately. The shell status bar shows live connection progress, automatically switching to a ready state once all servers are connected. The web interface also reflects each server's connection status in real time.
If multiple MCP servers are configured, loading may take a moment. The status bar progress indicator keeps you informed while connections are being established.
Security
MCP tools may access and operate external systems. Be aware of security risks.
Approval mechanism
Pythinker Code requests user confirmation for sensitive operations (such as file modifications and command execution). MCP tools follow the same approval mechanism, with all MCP tool calls prompting for confirmation.
Prompt injection risks
Content returned by MCP tools may contain malicious instructions attempting to trick the AI into performing dangerous operations. Pythinker Code marks tool return content to help the AI distinguish between tool output and user instructions, but you should still:
- Only use MCP servers from trusted sources
- Check whether AI-proposed operations are reasonable
- Keep manual approval for high-risk operations
Note
In YOLO or auto mode, MCP tool calls will also be automatically approved. Use these modes only when you fully trust the MCP servers.