How to Integrate DeusData codebase-memory-mcp with Other Tools: A Complete Guide

Integrating DeusData codebase-memory-mcp requires deploying the single static binary, starting the JSON-RPC 2.0 server over stdin/stdout or TCP, and issuing JSON-RPC calls using the provided Python or Node.js bindings, direct HTTP requests, or custom clients.

DeusData codebase-memory-mcp is a self-contained static binary that exposes 14 Model Context Protocol (MCP) tools through a standards-compliant JSON-RPC 2.0 interface. Because the server communicates over standard stdin/stdout pipes or TCP sockets, you can integrate it with AI agents, IDEs, CI pipelines, or custom automation using any language capable of sending JSON payloads.

Architecture Overview: How Integration Works

Understanding the internal architecture helps you choose the right integration pattern for your stack.

The Binary Entry Point

In src/main.c, the application parses command-line flags (such as --port or --ui=true), initializes the in-memory SQLite graph storage, and spawns the MCP server thread. This file handles the transport layer selection, defaulting to stdin/stdout unless a TCP port is specified.

The MCP Server Core

The JSON-RPC dispatcher is implemented in the test suite at tests/test_mcp.c (specifically the cbm_mcp_server_handle function), which routes incoming method requests to the appropriate tool implementation. Each tool resides under src/mcp/—for example, search.c handles search_graph, while trace.c handles trace_path.

Transport Options

The server supports two transport modes:

  • stdio (default): The binary reads JSON-RPC requests from stdin and writes responses to stdout, ideal for subprocess-based integrations.
  • TCP: Supply --port=7777 to expose an HTTP endpoint accepting POST requests with JSON-RPC payloads.

Integration Methods

Direct JSON-RPC via TCP Using curl

For quick prototyping or services that prefer HTTP, start the server in TCP mode and issue POST requests.


# Start the server on port 7777

codebase-memory-mcp --port=7777 &

# Search for all functions matching "*Handler*"

curl -s -X POST http://localhost:7777 \
  -d '{"jsonrpc":"2.0","id":1,"method":"search_graph","params":{"name_pattern":".*Handler.*","label":"Function"}}' \
  | jq .

The response follows the JSON-RPC 2.0 spec, returning matched nodes from the in-memory graph.

Python Integration (PyPI)

The official PyPI package provides a thin wrapper in pkg/pypi/src/codebase_memory_mcp/_cli.py that manages the subprocess lifecycle.

import subprocess
import json

# Launch the binary as a subprocess

proc = subprocess.Popen(
    ["codebase-memory-mcp"],
    stdin=subprocess.PIPE,
    stdout=subprocess.PIPE,
    text=True
)

def rpc_call(method, params):
    request = {"jsonrpc": "2.0", "id": 1, "method": method, "params": params}
    proc.stdin.write(json.dumps(request) + "\n")
    proc.stdin.flush()
    return json.loads(proc.stdout.readline())

# Example: semantic search

result = rpc_call(
    "semantic_query",
    {"query": "authentication middleware", "top_k": 5}
)
print(result["result"])

Node.js Integration (npm)

The npm package includes pkg/npm/install.js, which downloads the platform-specific binary and exposes a JavaScript wrapper.

const { spawn } = require('child_process');

const mcp = spawn('codebase-memory-mcp');
let requestId = 0;

function rpc(method, params) {
  return new Promise((resolve) => {
    const payload = JSON.stringify({
      jsonrpc: '2.0',
      id: ++requestId,
      method,
      params
    }) + '\n';
    mcp.stdin.write(payload);
    mcp.stdout.once('data', data => resolve(JSON.parse(data)));
  });
}

// Example: retrieve architecture overview
rpc('get_architecture', { project: 'my-repo' }).then(console.log);

Agent Configuration (Claude, Codex, VS Code)

AI agents that support the Model Context Protocol can auto-detect the binary or use a manual configuration file. The installer creates a config at ~/.claude/.mcp.json, but you can define it manually:

{
  "mcpServers": {
    "codebase-memory-mcp": {
      "command": "/usr/local/bin/codebase-memory-mcp",
      "args": ["--port", "7777"]
    }
  }
}

Place this in your agent’s configuration directory (e.g., .claude/, .codex/, or .vscode/) to enable tool calling directly from the chat interface.

Common Integration Workflows

These one-liners demonstrate how to invoke specific MCP tools via the CLI wrapper, which constructs the JSON-RPC payload internally:

  • Index a repository: codebase-memory-mcp cli index_repository '{"repo_path":"/path/to/project"}'
  • Trace call paths: codebase-memory-mcp cli trace_path '{"function_name":"processOrder","direction":"both"}'
  • Run graph queries: codebase-memory-mcp cli query_graph '{"query":"MATCH (f:Function)-[:CALLS]->(g) RETURN f.name,g.name"}'
  • Detect change impact: codebase-memory-mcp cli detect_changes '{"project":"my-repo","git_diff":"..."}'
  • Manage ADRs: codebase-memory-mcp cli manage_adr '{"action":"create","title":"ADR-001","content":"..."}'

Each command pipes the constructed JSON-RPC request to the running server, yielding results identical to direct TCP or stdio calls.

Key Source Files for Custom Integrations

When building custom clients or extending functionality, reference these canonical files:

Summary

  • DeusData codebase-memory-mcp exposes 14 MCP tools via a JSON-RPC 2.0 interface packaged as a single static binary.
  • Integration supports stdio (subprocess) or TCP transports, selectable via the --port flag.
  • Official bindings exist for Python (pkg/pypi) and Node.js (pkg/npm), but any HTTP client or subprocess wrapper works.
  • Key RPC methods include search_graph, trace_path, semantic_query, detect_changes, and get_architecture.
  • Configuration files for AI agents (Claude, Codex) follow standard MCP server definitions pointing to the binary path.

Frequently Asked Questions

Can I integrate codebase-memory-mcp without using Python or Node.js?

Yes. Because the server speaks plain JSON-RPC over stdin/stdout or TCP, you can integrate using any language. Write JSON payloads to the process stdin or POST to the TCP port using curl, Go’s net/http, Rust’s reqwest, or any other HTTP/stdio client.

What transport protocols does codebase-memory-mcp support?

The binary supports standard input/output (the default MCP transport) and TCP sockets when started with --port=<number>. There is no WebSocket or gRPC support; the TCP transport accepts raw HTTP POST requests containing JSON-RPC payloads.

How do I configure codebase-memory-mcp for Claude Desktop or other AI agents?

Install the binary and run the provided installer, which creates the configuration file automatically (e.g., ~/.claude/.mcp.json). For manual setup, create an MCP server configuration entry pointing the command field to the binary path and include any necessary args such as ["--port", "7777"] if using TCP mode instead of stdio.

Is the TCP server suitable for production microservices deployments?

The TCP server is designed for local development and agent integration. While functional, it lacks authentication, TLS, and horizontal scaling features required for public-facing microservices. For production scenarios, run the binary as a sidecar container using stdio transport, or place the TCP endpoint behind a reverse proxy with proper security controls.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →