Skip to content

Commit 79a40b1

Browse files
committed
Add rules for developing with cursor
1 parent 00cf13f commit 79a40b1

12 files changed

+10586
-366
lines changed

.cursor/rules/about-codebase.mdc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
description: General information about the CodeLogic MCP Server codebase and its purpose
3+
globs:
4+
alwaysApply: false
5+
---
6+
- This repository contains a Model Context Protocol (MCP) server that integrates with CodeLogic's knowledge graph APIs
7+
- It enables AI programming assistants to access dependency data from CodeLogic to analyze code and database impacts
8+
- The core package is in src/codelogic_mcp_server/ with server.py, handlers.py, and utils.py

.cursor/rules/best-practices.mdc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
description: Best practices for working with the CodeLogic MCP Server codebase
3+
globs:
4+
alwaysApply: false
5+
---
6+
- Use semantic search before grep for broader context
7+
- Maintain proper error handling and logging
8+
- Keep code changes atomic and focused

.cursor/rules/codelogic-rules.md

Lines changed: 0 additions & 116 deletions
This file was deleted.

.cursor/rules/debugging.mdc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
description: Debugging guidance for the CodeLogic MCP Server
3+
globs: "**/*.py"
4+
alwaysApply: false
5+
---
6+
- Enable Debug Mode by setting `CODELOGIC_DEBUG_MODE=true`
7+
- Use debugpy capabilities for remote debugging
8+
- Check logs in the logs directory for detailed information
9+
- Use proper logging levels for different types of information
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
description: Key environment variables for the CodeLogic MCP Server
3+
globs: "**/*.py"
4+
alwaysApply: false
5+
---
6+
- `CODELOGIC_SERVER_HOST`: CodeLogic server URL
7+
- `CODELOGIC_USERNAME`: Username for authentication
8+
- `CODELOGIC_PASSWORD`: Password for authentication
9+
- `CODELOGIC_WORKSPACE_NAME`: Workspace name
10+
- `CODELOGIC_DEBUG_MODE`: Enable debug logging
11+
- `CODELOGIC_TEST_MODE`: Used by test framework

.cursor/rules/error-handling.mdc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
description: Error handling patterns for the CodeLogic MCP Server
3+
globs: "**/*.py"
4+
alwaysApply: false
5+
---
6+
- Use the following pattern for error handling in tool implementations:
7+
```python
8+
try:
9+
# Operations that might fail
10+
except Exception as e:
11+
sys.stderr.write(f"Error: {str(e)}\n")
12+
return [types.TextContent(type="text", text=f"# Error\n\n{str(e)}")]
13+
```
14+
- Always catch and report exceptions
15+
- Write errors to stderr
16+
- Return formatted error messages to the client

.cursor/rules/file-operations.mdc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
description: File operation guidance for working with the CodeLogic MCP Server
3+
globs:
4+
alwaysApply: false
5+
---
6+
- Direct file editing with context preservation
7+
- File creation and deletion capabilities
8+
- Directory listing and navigation
9+
- Maintain proper file organization and structure

.cursor/rules/mcp-server-pattern.mdc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
description: Core coding patterns for MCP Server implementation
3+
globs: "**/*.py"
4+
alwaysApply: false
5+
---
6+
- Use the following pattern for MCP server implementation:
7+
```python
8+
server = Server("codelogic-mcp-server")
9+
10+
@server.list_tools()
11+
async def handle_list_tools() -> list[types.Tool]:
12+
# Define and return tools
13+
14+
@server.call_tool()
15+
async def handle_call_tool(name: str, arguments: dict | None) -> list[types.TextContent]:
16+
# Handle tool execution
17+
```
18+
- New tools should be added to handle_list_tools() with descriptive names (prefix: `codelogic-`)
19+
- Tool handlers should be implemented in handle_call_tool()
20+
- Create handler functions with proper error handling
21+
- Return results as markdown-formatted text

.cursor/rules/style-guidelines.mdc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
description: Style guidelines for the CodeLogic MCP Server project
3+
globs: "**/*.py"
4+
alwaysApply: false
5+
---
6+
- Include MPL 2.0 copyright headers in all Python files
7+
- Use Google-style docstrings for modules/classes/functions
8+
- Always use Python type hints
9+
- Keep I/O operations asynchronous
10+
- Return markdown-formatted text in tool responses

.cursor/rules/technologies.mdc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
description: Key technologies used in the CodeLogic MCP Server project
3+
globs:
4+
alwaysApply: false
5+
---
6+
- Python 3.13+ with extensive use of async/await
7+
- Model Context Protocol SDK (`mcp[cli]`)
8+
- HTTPX for API requests
9+
- Environment variables via dotenv for configuration

.cursor/rules/testing-approach.mdc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
description: Testing approach for the CodeLogic MCP Server
3+
globs: "**/test/*.py"
4+
alwaysApply: false
5+
---
6+
- Use unit tests for functions without external dependencies
7+
- Use integration tests for tests against a real CodeLogic server
8+
- Set the `CODELOGIC_TEST_MODE` environment variable for test runs
9+
- Test both success cases and error handling patterns

0 commit comments

Comments
 (0)