MCP Server for DiscoPoP - Enables Claude to interact with DiscoPoP profiling and analysis tools
Project description
DiscoPoP MCP Server
A Model Context Protocol (MCP) server that exposes DiscoPoP functionality to Claude, enabling Claude to execute instrumented code locally and request analysis of profiling data.
Overview
The DiscoPoP MCP Server bridges the gap between Claude and DiscoPoP's profiling and analysis tools. It allows Claude to:
- Retrieve profiling information from executed instrumented code
- Execute pattern analysis on profiled data
- List and discover available profiling data
- Process results and provide recommendations
Features
- Standalone CLI executable - Run independently via command line
- Local deployment - Uses stdio for direct Claude integration
- Comprehensive logging - View all incoming calls and outgoing responses
- Type-safe - Full type hints throughout
- Extensible - Easy to add new tools and capabilities
Installation
Option 1: Install from source (Recommended for development)
cd mcp_server
pip install -e ".[dev]"
Option 2: Install as standalone package
pip install .
Option 3: Direct script usage
python mcp_server/server.py --debug
Quick Start
Run the server
discopop-mcp-server --debug
This starts the server in stdio mode, which is used by Claude. The --debug flag enables verbose logging.
Usage Examples
From the command line
# Basic usage
discopop-mcp-server
# With debug logging
discopop-mcp-server --debug
Integration with Claude Code
Use the built-in setup flag for easy integration:
discopop-mcp-server --setup claude_code
This automatically configures Claude Code to use the server, handling virtual environment detection, configuration directory creation, and path resolution.
See SETUP_GUIDE.md for more options or CLAUDE_INTEGRATION.md for detailed setup instructions.
Available Tools
1. get_configurations
Retrieves the list of defined execution configurations from a target project.
Parameters:
project_path(string, required): Path to the target project
Looks for configuration directories under <project_path>/.discopop/project/configs/.
Example:
{
"project_path": "./my_project"
}
2. get_execution_results
Retrieves execution results from prior program executions.
Parameters:
project_path(string, required): Path to the target project
Reads <project_path>/.discopop/project/execution_results.json.
Example:
{
"project_path": "./my_project"
}
Logging Output
The server logs all incoming and outgoing communication:
2026-05-19 10:30:00 - discopop-mcp - INFO - Starting DiscoPoP MCP Server (stdio mode)
2026-05-19 10:30:05 - discopop-mcp - INFO - → Incoming call: get_configurations
2026-05-19 10:30:05 - discopop-mcp - DEBUG - Arguments: {"project_path": "./my_project"}
2026-05-19 10:30:05 - discopop-mcp - INFO - ← Outgoing response: get_configurations
Enable --debug for full argument/response logging.
Testing
Run the test suite:
python -m unittest discover -s mcp_server -p "test_*.py" -v
Or with pytest:
pytest mcp_server/test_server.py -v
Architecture
Transport Mode
Uses Stdio Mode for local Claude integration:
- Bidirectional communication via stdin/stdout
- Lightweight, no additional dependencies
- Direct integration with Claude Desktop
Tool Handler Flow
- Claude calls a tool
- Server logs the incoming call with arguments
- Handler processes the request
- Server logs the outgoing response
- Response returned to Claude
Shipping to Users
Method 1: PyPI Package (Recommended)
- Update version in
pyproject.toml - Build:
python -m build - Publish:
python -m twine upload dist/* - Users install:
pip install discopop-mcp-server
Method 2: Source Distribution
Include in your DiscoPoP repository:
pip install git+https://github.com/discopop-tool/discopop.git#subdirectory=mcp_server
Method 3: Bundled Binary
Use PyInstaller to create standalone executables:
pip install pyinstaller
pyinstaller --onefile mcp_server/server.py --name discopop-mcp-server
Development
Adding New Tools
- Define tool schema in
_register_tools():
Tool(
name="your_tool",
description="...",
inputSchema={...}
)
- Add handler method:
def _handle_your_tool(self, arguments: dict[str, Any]) -> list[TextContent]:
self._log_call("your_tool", arguments)
# Implementation here
self._log_response("your_tool", result)
return [TextContent(type="text", text=json.dumps(result))]
- Register in tool call handler:
elif name == "your_tool":
return self._handle_your_tool(arguments)
Type Checking
mypy mcp_server/server.py
Troubleshooting
Claude setup issues
- Automatically configure Claude Code:
discopop-mcp-server --setup claude_code
- Verify the setup with:
discopop-mcp-server --verify claude_code
- See CLAUDE_INTEGRATION.md for detailed troubleshooting
Server won't start
- Check Python version (requires 3.8+)
- Verify MCP package is installed:
pip show mcp - Run with
--debugfor detailed error messages
Claude can't connect
- Verify server is running:
discopop-mcp-server --debug - Check claude configuration points to correct command
- Ensure stdio mode is being used (default)
- Check setup status:
discopop-mcp-server --status
Missing dependencies
# Install all dependencies
pip install -e ".[dev,sse]"
License
This software is part of DiscoPoP and is licensed under the 3-Clause BSD License. See the LICENSE file in the package base directory for details.
Support
For issues, questions, or contributions:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file discopop_mcp_server-0.0.1a2.tar.gz.
File metadata
- Download URL: discopop_mcp_server-0.0.1a2.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3279f37b55d8e5672235a21869c72e6b7bee4df850e40cfd45cb822f88540939
|
|
| MD5 |
1ea38aa36ea116e194fe38b35833c70a
|
|
| BLAKE2b-256 |
32910e5e097f748c1a03e81d2730a1cce2a9828fc5602608420d6a9215535104
|
Provenance
The following attestation bundles were made for discopop_mcp_server-0.0.1a2.tar.gz:
Publisher:
publish_mcp_server.yml on discopop-project/discopop
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
discopop_mcp_server-0.0.1a2.tar.gz -
Subject digest:
3279f37b55d8e5672235a21869c72e6b7bee4df850e40cfd45cb822f88540939 - Sigstore transparency entry: 1573636230
- Sigstore integration time:
-
Permalink:
discopop-project/discopop@18123d091d55fb244205b78327ef4907f1d24d2c -
Branch / Tag:
refs/tags/mcp_server_v0.0.1a2 - Owner: https://github.com/discopop-project
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_mcp_server.yml@18123d091d55fb244205b78327ef4907f1d24d2c -
Trigger Event:
push
-
Statement type:
File details
Details for the file discopop_mcp_server-0.0.1a2-py3-none-any.whl.
File metadata
- Download URL: discopop_mcp_server-0.0.1a2-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
295e5b0fde0882eee53a3c3dbaefd9a389065fea8252b654da29f91f4863ba51
|
|
| MD5 |
c3d00e6c1b78d673e3824d649ed27cfa
|
|
| BLAKE2b-256 |
b468978f051f68cd6af2a2c47f3abf731b6f4764543e04d9ff3f7f5d69cfbe18
|
Provenance
The following attestation bundles were made for discopop_mcp_server-0.0.1a2-py3-none-any.whl:
Publisher:
publish_mcp_server.yml on discopop-project/discopop
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
discopop_mcp_server-0.0.1a2-py3-none-any.whl -
Subject digest:
295e5b0fde0882eee53a3c3dbaefd9a389065fea8252b654da29f91f4863ba51 - Sigstore transparency entry: 1573636267
- Sigstore integration time:
-
Permalink:
discopop-project/discopop@18123d091d55fb244205b78327ef4907f1d24d2c -
Branch / Tag:
refs/tags/mcp_server_v0.0.1a2 - Owner: https://github.com/discopop-project
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_mcp_server.yml@18123d091d55fb244205b78327ef4907f1d24d2c -
Trigger Event:
push
-
Statement type: