Model Context Protocol (MCP) Integration
Extend Thox.ai capabilities with MCP servers for enhanced AI-assisted development.
The Model Context Protocol (MCP) is an open standard that enables AI models to interact with external tools and data sources. Thox.ai supports MCP, allowing you to extend your AI assistant with custom capabilities like file access, database queries, and API integrations.
What is MCP?
MCP (Model Context Protocol) is a standardized protocol that allows AI models to:
Access External Tools
Read/write files, execute commands, query databases
Maintain Context
Understand your project structure and codebase
Secure Integration
Permission-based access with user confirmation
Extensible Design
Add custom MCP servers for your specific needs
Built-in MCP Servers
Thox.ai includes several pre-configured MCP servers:
Filesystem
Read, write, and manage files in your project directories
Git
Interact with Git repositories for version control operations
Database
Query and manage SQL databases directly from the AI
Terminal
Execute shell commands and scripts securely
Configuring MCP
MCP Configuration File
Edit the MCP configuration at ~/.thox/mcp.json:
{
"mcpServers": {
"filesystem": {
"command": "mcp-server-filesystem",
"args": ["--root", "/home/thox/projects"],
"env": {}
},
"git": {
"command": "mcp-server-git",
"args": [],
"env": {}
},
"sqlite": {
"command": "mcp-server-sqlite",
"args": ["--db-path", "/home/thox/data/app.db"],
"env": {}
}
}
}Via CLI
Manage MCP servers using the CLI:
# List configured MCP servers
thox mcp list
# Enable/disable an MCP server
thox mcp enable filesystem
thox mcp disable sqlite
# Add a new MCP server
thox mcp add my-server --command "mcp-server-custom" --args "--config /path/to/config"Using MCP in Practice
Once configured, MCP tools are automatically available to the AI. Here are some examples:
Ask the AI to read a file:
"Read the contents of src/index.ts and explain what it does"
Request code changes:
"Add error handling to the fetchData function in utils/api.ts"
Database queries:
"Show me the last 10 users who signed up from the database"
Git operations:
"Create a new branch called feature/auth and commit the current changes"
Creating Custom MCP Servers
You can create custom MCP servers to integrate with your specific tools and services:
import { Server } from "@modelcontextprotocol/sdk/server";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio";
const server = new Server({
name: "my-custom-server",
version: "1.0.0",
});
// Define a tool
server.setRequestHandler("tools/list", async () => ({
tools: [{
name: "my_tool",
description: "Does something useful",
inputSchema: {
type: "object",
properties: {
input: { type: "string", description: "Input parameter" }
},
required: ["input"]
}
}]
}));
// Handle tool calls
server.setRequestHandler("tools/call", async (request) => {
if (request.params.name === "my_tool") {
const result = await doSomethingUseful(request.params.arguments.input);
return { content: [{ type: "text", text: result }] };
}
});
const transport = new StdioServerTransport();
await server.connect(transport);Security Considerations
Confirmation prompts
Sensitive operations (file writes, commands) require user confirmation by default.
Sandboxed execution
MCP servers run in isolated environments with limited permissions.
Review third-party servers
Only install MCP servers from trusted sources. Review their code and permissions before use.
Related Articles
Need help with MCP?
Check the MCP documentation or contact support for integration assistance.