Skip to main content

Model Context Protocol (MCP)

The Model Context Protocol (MCP) is an open standard that enables AI models to securely interact with external data and tools. In the Jinba ecosystem, MCP is the bridge that turns a conversational interface into a powerful execution engine.

What is MCP?

Traditionally, connecting an LLM to a database or API required building custom integrations for each tool. MCP standardizes this process.

  • MCP Servers: Lightweight services that expose "Resources" (data) and "Tools" (functions) to the AI.
  • MCP Clients: Applications like Jinba that consume these resources and allow the AI to use them.

By using MCP, Jinba can connect to any MCP-compliant server, whether it's for PostgreSQL, Slack, Google Drive, or your local file system, without the need to use custom code in the Jinba App itself.

How Jinba Uses MCP

When you connect an MCP Server to Jinba:

  1. Discovery: Jinba asks the server, "What can you do?"
  2. Tool Registration: The server replies with a list of tools (e.g., query_database, send_slack_message).
  3. Dynamic Execution: When you ask Jinba to "Find the latest user," it knows to use the query_database tool. It generates the correct parameters, asks for your confirmation if configured, and executes the action.

Setting Up an MCP Server

Jinba uses a configuration file (usually jinba.config.json or managed via the settings UI) to define which MCP servers to launch.

Prerequisites

  • Node.js or Docker (depending on the server type).
  • Access credentials (API keys, database URLs) for the services you want to connect.

Basic Configuration

To add a server, you define the command Jinba should run to start it.

jinba.config.json
{
"mcpServers": {
"my-postgres-db": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"-e", "POSTGRES_CONNECTION_STRING=postgres://user:pass@localhost:5432/mydb",
"mcp/postgres-server"
]
}
}
}

Here are some common servers you might want to integrate with Jinba:

ServerDescriptionUse Case
FilesystemAccess local files."Read the logs in ./var/log and summarize errors."
PostgreSQLQuery SQL databases."Find all users who signed up yesterday."
GitHubManage repos and issues."Create a bug report for the error in auth.ts."
SlackSend messages and read channels."Post the deployment status to #engineering."

Security & Sandboxing

Jinba takes security seriously. Even though MCP servers run locally or in containers:

  • Explicit Permissions: You must explicitly enable each server.
  • Human-in-the-Loop: You can configure specific tools (like delete operations) to require manual approval before execution.
  • Environment Isolation: Credentials are passed via environment variables, keeping them out of your chat history.

Developing Custom MCP Servers

If you have proprietary internal tools, you can build your own MCP server. The protocol is simple and language-agnostic.

  1. Define the Interface: List the tools and resources your server provides.
  2. Implement Logic: Write the code to handle tool calls.
  3. Connect to Jinba: Add your local script to the Jinba configuration.
simple-server.js
// Example: A simple Node.js MCP server
import { Server } from "@modelcontextprotocol/server-sdk";

const server = new Server({
name: "my-custom-tool",
version: "1.0.0"
});

server.defineTool("greet", { name: "string" }, async ({ name }) => {
return `Hello, ${name}! Welcome to Jinba.`;
});

server.start();

Troubleshooting

  • Server won't start: Check your paths and environment variables. Ensure Docker is running if using containerized servers.
  • Tools not appearing: Restart the Jinba App to force a re-discovery of capabilities.
  • Permission Denied: Check if the tool requires confirmation in the Jinba settings.

If you want to expand your toolkit? Check out the Official MCP Server Registry for more information.