# How to Import MCP Tool Definitions from codebase-memory-mcp

> Learn how to import MCP tool definitions into DeusData/codebase-memory-mcp using JSON-RPC, agent configuration, or the CLI helper. Quickly integrate useful tools.

- Repository: [Martin Vogel/codebase-memory-mcp](https://github.com/DeusData/codebase-memory-mcp)
- Tags: how-to-guide
- Published: 2026-07-03

---

**You can import MCP tool definitions by querying the JSON-RPC `tools/list` endpoint, adding a static server entry to your agent's configuration file, or running the built-in CLI helper to inspect schemas locally.**

The `codebase-memory-mcp` repository implements a Model Context Protocol (MCP) server that exposes 14 codebase analysis tools—including `search_graph`, `trace_path`, and `get_architecture`—through a zero-dependency binary. Rather than manually defining tool contracts, you can import MCP tool definitions dynamically using the standard discovery protocol or static configuration methods provided by the server.

## Run the JSON-RPC Discovery Call

The canonical way to import MCP tool definitions is through the **`tools/list`** method defined in the MCP specification. When an agent connects to the server, it sends a JSON-RPC request to discover available tools and their schemas.

The server implementation lives in `src/mcp/`, where the tool registry advertises all 14 available methods. The protocol schema is declared in [`server.json`](https://github.com/DeusData/codebase-memory-mcp/blob/main/server.json), which validates the JSON-RPC 2.0 structure.

To retrieve definitions programmatically:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/list",
  "params": {}
}

```

The response includes each tool's name, description, parameter schema, and result schema. This dynamic discovery ensures your agent always uses the latest tool definitions without configuration updates.

## Configure via Static JSON Entry

For agents that require manual setup, you can import MCP tool definitions by registering the server in your agent's configuration file. This static approach lets the agent fetch tool definitions on first use.

Create or edit `~/.claude/.mcp.json` (or the equivalent path for your specific agent):

```json
{
  "mcpServers": {
    "codebase-memory-mcp": {
      "command": "/path/to/codebase-memory-mcp",
      "args": []
    }
  }
}

```

The `codebase-memory-mcp install` command automates this process. Located in [`pkg/pypi/src/codebase_memory_mcp/_cli.py`](https://github.com/DeusData/codebase-memory-mcp/blob/main/pkg/pypi/src/codebase_memory_mcp/_cli.py), the install logic detects installed agents on your system and writes the appropriate `*.mcp.json` files to each agent's configuration directory, eliminating manual path configuration.

## Inspect Definitions with the CLI Helper

If you need to import MCP tool definitions for inspection or debugging without running a full agent session, use the CLI helper bundled in [`_cli.py`](https://github.com/DeusData/codebase-memory-mcp/blob/main/_cli.py). This Python shim downloads the static binary (containing 158 Tree-Sitter grammars and the Hybrid LSP type-resolution layer) and forwards arguments directly to the server.

Run the following to print tool definitions locally:

```bash
codebase-memory-mcp cli tools/list

```

This outputs the same JSON-RPC response you would receive over the wire, allowing you to verify tool schemas before integration:

```bash
codebase-memory-mcp cli tools/list | jq '.tools[] | {name, description}'

```

The command returns structured metadata for all 14 tools, including `search_graph` for structured codebase queries and `trace_path` for BFS traversal analysis.

## Why Automatic Discovery Works

**Zero-dependency binary.** The server compiles all Tree-Sitter grammars and the Hybrid LSP type-resolution layer into a single executable, requiring no external language-server processes.

**Standard MCP protocol.** The server follows the Model Context Protocol JSON-RPC 2.0 specification as defined in [`server.json`](https://github.com/DeusData/codebase-memory-mcp/blob/main/server.json). The `tools/list` method is the canonical discovery mechanism, ensuring compatibility with Claude Code, Codex CLI, Gemini CLI, and VS Code extensions.

**Auto-configuration.** The installation script in [`_cli.py`](https://github.com/DeusData/codebase-memory-mcp/blob/main/_cli.py) validates checksums, caches the binary, and automatically registers the server with detected agents, streamlining the import process.

## Summary

- **Dynamic discovery:** Send a JSON-RPC `tools/list` request to `src/mcp/` to retrieve live tool definitions.
- **Static configuration:** Add the server entry to `~/.claude/.mcp.json` or let `codebase-memory-mcp install` auto-detect your agent.
- **Local inspection:** Use `codebase-memory-mcp cli tools/list` to view schemas without starting an agent session.
- **Self-contained:** The binary includes 158 Tree-Sitter grammars and requires no external dependencies.

## Frequently Asked Questions

### Where are the tool definitions stored in the codebase?

The tool registry is implemented in the C source under `src/mcp/`, while the JSON-RPC protocol schema is declared in [`server.json`](https://github.com/DeusData/codebase-memory-mcp/blob/main/server.json). The [`_cli.py`](https://github.com/DeusData/codebase-memory-mcp/blob/main/_cli.py) file in `pkg/pypi/src/codebase_memory_mcp/` handles binary distribution and CLI argument forwarding.

### Do I need to manually write JSON schemas for each tool?

No. `codebase-memory-mcp` automatically advertises tool schemas through the MCP `tools/list` endpoint. When you import MCP tool definitions via discovery or the CLI helper, you receive complete parameter and result schemas without manual configuration.

### What agents are compatible with the tool definitions?

Any MCP-compatible client can import these definitions, including Claude Code, Codex CLI, Gemini CLI, and VS Code with MCP extensions. The server speaks standard JSON-RPC 2.0 over stdio, making it transport-agnostic.

### How do I verify the tool definitions before connecting an agent?

Run `codebase-memory-mcp cli tools/list` to print the JSON-RPC response locally. This validates that the binary downloaded correctly and shows the exact schemas—for tools like `search_graph` and `trace_path`—that your agent will receive during discovery.