Skip to content

Commit 940c7b5

Browse files
committed
feat: update Copilot instructions and add Cursor documentation
Revise Copilot instructions to reflect the inclusion of Cursor as an AI assistant. Create a new documentation file for Cursor, detailing its features, project structure, coding patterns, and best practices. These changes enhance clarity and provide comprehensive guidance for users integrating with both Copilot and Cursor.
1 parent b77df6e commit 940c7b5

File tree

2 files changed

+133
-2
lines changed

2 files changed

+133
-2
lines changed

.cursor/instructions.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# CodeLogic MCP Server - Cursor Instructions
2+
3+
## About This Codebase
4+
5+
This repository contains a Model Context Protocol (MCP) server that integrates with CodeLogic's knowledge graph APIs. It enables AI programming assistants to access dependency data from CodeLogic to analyze code and database impacts.
6+
7+
## Key Technologies
8+
9+
- **Python 3.13+** with extensive use of async/await
10+
- **Model Context Protocol SDK** (`mcp[cli]`)
11+
- **Neo4j** for graph database operations
12+
- **HTTPX** for API requests
13+
- **Environment variables** via dotenv for configuration
14+
15+
## Project Structure
16+
17+
- **src/codelogic_mcp_server/**: Core package
18+
- **`__init__.py`**: Package initialization and entry point
19+
- **`server.py`**: MCP server implementation
20+
- **`handlers.py`**: Tool handlers implementation
21+
- **`utils.py`**: API interaction utilities
22+
23+
## Core Coding Patterns
24+
25+
### MCP Server Pattern
26+
27+
```python
28+
server = Server("codelogic-mcp-server")
29+
30+
@server.list_tools()
31+
async def handle_list_tools() -> list[types.Tool]:
32+
# Define and return tools
33+
34+
@server.call_tool()
35+
async def handle_call_tool(name: str, arguments: dict | None) -> list[types.TextContent]:
36+
# Handle tool execution
37+
```
38+
39+
### Error Handling
40+
41+
```python
42+
try:
43+
# Operations that might fail
44+
except Exception as e:
45+
sys.stderr.write(f"Error: {str(e)}\n")
46+
return [types.TextContent(type="text", text=f"# Error\n\n{str(e)}")]
47+
```
48+
49+
## Style Guidelines
50+
51+
1. **Copyright Headers**: Include MPL 2.0 headers in all Python files
52+
2. **Docstrings**: Google-style docstrings for modules/classes/functions
53+
3. **Type Hints**: Always use Python type hints
54+
4. **Asynchronous**: Keep I/O operations asynchronous
55+
5. **Format Outputs**: Return markdown-formatted text in tool responses
56+
57+
## Tool Implementation Pattern
58+
59+
When implementing new MCP tools:
60+
61+
1. Add to `handle_list_tools()` with descriptive name (prefix: `codelogic-`)
62+
2. Add handler in `handle_call_tool()`
63+
3. Implement handler function with error handling
64+
4. Return results as markdown-formatted text
65+
66+
## Testing Approach
67+
68+
- **Unit Tests**: For functions without external dependencies
69+
- **Integration Tests**: For tests against a real CodeLogic server
70+
- Use the `CODELOGIC_TEST_MODE` environment variable
71+
72+
## Debugging
73+
74+
- Debug Mode: Set `CODELOGIC_DEBUG_MODE=true`
75+
- Remote Debugging: Use debugpy capabilities
76+
77+
## Key Environment Variables
78+
79+
- `CODELOGIC_SERVER_HOST`: CodeLogic server URL
80+
- `CODELOGIC_USERNAME`: Username for authentication
81+
- `CODELOGIC_PASSWORD`: Password for authentication
82+
- `CODELOGIC_MV_NAME`: Materialized view name
83+
- `CODELOGIC_DEBUG_MODE`: Enable debug logging
84+
- `CODELOGIC_TEST_MODE`: Used by test framework
85+
86+
## Cursor-Specific Features
87+
88+
### Code Analysis
89+
- Use semantic search for finding relevant code snippets
90+
- Utilize grep search for exact pattern matching
91+
- Analyze method impacts before making changes
92+
- Check database impacts for SQL and code changes
93+
94+
### File Operations
95+
- Direct file editing with context preservation
96+
- File creation and deletion capabilities
97+
- Directory listing and navigation
98+
99+
### Terminal Integration
100+
- Execute commands in the integrated terminal
101+
- Background process management
102+
- Environment variable handling
103+
104+
### Best Practices
105+
1. Always check method impacts before making changes
106+
2. Verify database impacts for SQL modifications
107+
3. Use semantic search before grep for broader context
108+
4. Maintain proper error handling and logging
109+
5. Keep code changes atomic and focused
110+
111+
### Tool Usage Guidelines
112+
1. **Code Search**: Use semantic search for understanding context
113+
2. **File Operations**: Use edit_file for precise changes
114+
3. **Terminal Commands**: Use run_terminal_cmd for shell operations
115+
4. **Impact Analysis**: Use codelogic-method-impact and codelogic-database-impact before changes
116+
5. **File Management**: Use list_dir and delete_file for file operations

.github/copilot-instructions.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# CodeLogic MCP Server - Copilot Instructions
1+
# CodeLogic MCP Server - AI Assistant Instructions
22

33
## About This Codebase
44

5-
This repository contains a Model Context Protocol (MCP) server that integrates with CodeLogic's knowledge graph APIs. It enables AI programming assistants (like GitHub Copilot) to access dependency data from CodeLogic to analyze code and database impacts.
5+
This repository contains a Model Context Protocol (MCP) server that integrates with CodeLogic's knowledge graph APIs. It enables AI programming assistants (like GitHub Copilot and Cursor) to access dependency data from CodeLogic to analyze code and database impacts.
66

77
## Key Technologies
88

@@ -82,3 +82,18 @@ When implementing new MCP tools:
8282
- `CODELOGIC_MV_NAME`: Materialized view name
8383
- `CODELOGIC_DEBUG_MODE`: Enable debug logging
8484
- `CODELOGIC_TEST_MODE`: Used by test framework
85+
86+
## AI Assistant Integration
87+
88+
### GitHub Copilot
89+
- Uses these instructions via `.github/copilot-instructions.md`
90+
- Integrates through GitHub's Copilot infrastructure
91+
92+
### Cursor
93+
- Uses these instructions via `.cursor/instructions.md`
94+
- Integrates through Cursor's AI infrastructure
95+
- Supports additional features like:
96+
- Direct file editing
97+
- Terminal command execution
98+
- Code search and analysis
99+
- Database impact analysis

0 commit comments

Comments
 (0)