Skip to main content

MCP Integration Guide

This guide shows you how to integrate CodeFire’s MCP server into your daily AI-assisted development workflow.

Core Concepts

Project Auto-Detection

The MCP server automatically detects which CodeFire project you’re working on based on your current working directory when the AI CLI tool starts. How it works:
  1. The MCP server reads the working directory from your shell environment
  2. It queries the CodeFire database for projects matching that path
  3. It falls back to parent directory matching (so /path/to/project/src matches /path/to/project)
  4. If a match is found, that project becomes the default project for the session
Example:
# Navigate to a project directory
cd ~/projects/my-web-app

# Start your AI tool
claude

# Ask the agent to check which project was detected
"What CodeFire project am I working on?"

# Agent calls: get_current_project
# Returns: "Current project: my-web-app (ID: abc123)"
Benefits:
  • You can omit project_id from most tool calls
  • The agent automatically works with the correct project
  • No manual configuration needed per session
When auto-detection fails: If you’re working in a directory that isn’t tracked by CodeFire, you’ll see:
No project detected for working directory: /Users/you/random-folder
Use list_projects to find the correct project_id and pass it explicitly.
To fix this:
  1. Add the project to CodeFire (open the GUI and add the folder)
  2. Or, explicitly pass project_id to each tool call
  3. Or, cd into a directory that matches a tracked project

Global vs Project-Scoped Data

CodeFire supports both project-specific and global tasks and notes:
ScopeDescriptionWhen to Use
ProjectData tied to a specific projectMost development tasks, project-specific context
GlobalData visible on the home board, not tied to any projectCross-project tasks, personal reminders, general planning
To work with global data, set global: true in tool calls:
# Create a global task
"Create a global task to review billing settings"
# Agent calls: create_task({ title: "Review billing", global: true })

# List global tasks
"Show me all global planner tasks"
# Agent calls: list_tasks({ global: true })

# Create a global note
"Create a global note with my weekly goals"
# Agent calls: create_note({ title: "Weekly Goals", content: "...", global: true })

Real-World Usage Examples

1. Starting a New Session

When you begin a new coding session, help your AI agent get oriented:
You: What CodeFire project am I working on? Show me all in-progress tasks.

Agent:
- Calls: get_current_project
- Calls: list_tasks({ status: "in_progress" })

Output:
Current project: my-web-app (ID: abc123)

In-progress tasks (3):
  #42 [in_progress] (high) Implement user authentication
  #38 [in_progress] (medium) Add dark mode support
  #29 [in_progress] (low) Update README
Now the agent knows exactly what you’re working on and can reference these tasks throughout the session.

2. Creating Tasks During Development

As you discover bugs or ideas, create tasks on the fly:
You: I found a bug in the login form validation. Create a high-priority task for it.

Agent:
- Calls: create_task({
    title: "Fix login form validation bug",
    priority: 3,
    labels: ["bug", "frontend"],
    description: "Login form accepts invalid email formats"
  })

Output:
Created task #47: Fix login form validation bug
The task immediately appears in CodeFire’s task board. You can triage it later or assign it to yourself.

3. Logging Progress with Task Notes

Use task notes to create an audit trail of your work:
You: Add a note to task #42 explaining that I discovered the auth issue is in the middleware, not the controller.

Agent:
- Calls: add_task_note({
    task_id: 42,
    content: "Discovered the auth issue is in the middleware (src/middleware/auth.ts), not the controller. The JWT verification is failing silently."
  })

Output:
Added note to task #42
Later, you or another developer can review the task notes to understand the investigation process.

4. Capturing Architecture Decisions

Use project notes to document important decisions:
You: Create a pinned note titled "API Design Decisions" explaining why we chose REST over GraphQL.

Agent:
- Calls: create_note({
    title: "API Design Decisions",
    content: "We chose REST over GraphQL for this project because:\n1. Simpler caching with HTTP\n2. Team is more familiar with REST\n3. Our use case doesn't require complex nested queries",
    pinned: true
  })

Output:
Created note #8: API Design Decisions
Pinned notes appear at the top of the notes list in CodeFire, making them easy to reference.

5. Searching Project Context

Before starting work, search notes for relevant context:
You: Search notes for "authentication" to see if we have any existing documentation.

Agent:
- Calls: search_notes({ query: "authentication" })

Output:
Search results for 'authentication' (2):
  #12 [pinned] Auth Flow Documentation
    Detailed flow: User submits credentials → API validates → JWT issued → Client stores...
  #7 Third-Party Auth Integration
    We evaluated Auth0 and Firebase. Chose Firebase because it integrates better with our...
Now the agent can read these notes and incorporate that context into its responses.

6. Browser Automation for Testing

Test your web app directly from your AI session:
You: Navigate to localhost:3000, take a screenshot, then click the login button and check if the form appears.

Agent:
- Calls: browser_navigate({ url: "http://localhost:3000" })
- Calls: browser_screenshot()
- Calls: browser_snapshot()
- Calls: browser_click({ ref: "e12" }) // ref for login button from snapshot
- Calls: browser_wait({ selector: "form#login" })
- Calls: browser_snapshot()

Output:
Screenshot saved to: /tmp/screenshot-123.png
Login form is now visible with fields: email, password, and a "Sign In" button.
The agent can visually verify your app is working correctly.

7. Git Workflow Integration

Manage git operations without leaving your AI session:
You: Show me the git status, then stage all changes and commit them with message "Add login validation".

Agent:
- Calls: git_status()
- Calls: git_stage() // omit file_path to stage all
- Calls: git_commit({ message: "Add login validation" })

Output:
Branch: feature/auth
Staged: src/components/LoginForm.tsx, src/utils/validation.ts
Commit created: a3f2b1c

Find relevant code without knowing exact file names:
You: Find all functions that handle user registration.

Agent:
- Calls: context_search({ query: "user registration", types: ["function"] })

Output:
Found 3 matches:
  1. registerUser() in src/api/auth.ts:45-67
  2. createUserAccount() in src/services/user.ts:12-34
  3. validateRegistrationData() in src/utils/validation.ts:89-102
The agent can now read those functions and understand your registration flow.

9. Generating Assets

Create images for your project:
You: Generate a 16:9 hero image of a modern office workspace with warm lighting.

Agent:
- Calls: generate_image({
    prompt: "modern office workspace with warm lighting, professional photography, high quality",
    aspect_ratio: "16:9",
    size: "2K"
  })

Output:
Image generated: /Users/you/projects/my-app/assets/generated/image-2026-03-04-1234.png
The image is saved to your project and tracked in the CodeFire database.

Best Practices

1. Start Every Session with Context

Always begin by asking the agent to:
  • Check the current project (get_current_project)
  • List in-progress tasks (list_tasks({ status: "in_progress" }))
  • Read any pinned notes (list_notes({ pinned_only: true }))
This gives the agent full awareness of what you’re working on.

2. Create Tasks, Not Just Code

Don’t just ask the agent to write code. Ask it to:
  • Create a task for the feature
  • Add notes to the task as it works
  • Mark the task as done when complete
This creates a traceable record of what was built and why. Example:
You: Implement password reset functionality. Create a task for it, add a note explaining your implementation approach, and mark it done when you're finished.

Agent:
- Calls: create_task({ title: "Implement password reset" })
- Writes code
- Calls: add_task_note({ task_id: 48, content: "Implemented using email verification tokens with 1-hour expiry" })
- Calls: update_task({ task_id: 48, status: "done" })

3. Use Notes for Long-Lived Context

Task notes are for progress updates. Project notes are for architectural context that persists beyond a single task.
Use CaseTool
”I fixed the bug by changing the middleware”add_task_note
”Our database schema uses soft deletes”create_note
”Progress update: 50% done, blocked on API keys”add_task_note
”We use JWT for auth with 7-day expiry”create_note

4. Pin Important Notes

Pin notes that you reference frequently:
  • Coding standards
  • Architecture diagrams
  • API design decisions
  • Deployment checklists
Pinned notes appear first in the list, making them easy for the agent to find.

5. Leverage Global Tasks for Planning

Use global tasks for work that spans multiple projects or isn’t project-specific:
Create a global task to update my resume
Create a global task to research new deployment platforms
Create a global task to review invoices
These appear on the CodeFire home board, separate from project-specific work.

6. Use Browser Tools for Visual Debugging

Don’t just read error logs. Use browser tools to:
  • Take screenshots before and after changes
  • Inspect network requests to debug API calls
  • Read console logs to see runtime errors
  • Test interactions (clicking buttons, filling forms)
Example:
You: The login form isn't working. Navigate to the login page, check the console for errors, and inspect the network requests when I submit the form.

Agent:
- Calls: browser_navigate({ url: "http://localhost:3000/login" })
- Calls: browser_console_logs({ level: "error" })
- Calls: browser_type({ ref: "e5", text: "[email protected]" })
- Calls: browser_type({ ref: "e7", text: "password123" })
- Calls: browser_click({ ref: "e9" }) // Submit button
- Calls: browser_wait({ timeout: 3 })
- Calls: get_network_requests({ domain: "localhost" })

Output:
Console error: "Uncaught TypeError: Cannot read property 'token' of undefined"
Network request to /api/login returned 500 Internal Server Error
Now you know exactly what’s failing.

7. Search Before Creating

Before creating a new note, search to see if one already exists:
You: Search notes for "deployment" to see if we have existing documentation.

Agent:
- Calls: search_notes({ query: "deployment" })

Output:
Found note #15: Deployment Checklist

You: Great, update note #15 with the new Vercel configuration steps.

Agent:
- Calls: get_note({ note_id: 15 })
- Calls: update_note({ note_id: 15, content: "...updated content..." })

Workflow Patterns

Pattern 1: Feature Development

1. Create a task for the feature
2. Ask the agent to implement it
3. Add task notes documenting decisions
4. Use git tools to stage and commit changes
5. Mark the task as done
6. Create a project note if the feature introduced new patterns
Example:
You: Implement user profile editing. Create a task, build it, commit the changes, and mark it done.

Agent:
- create_task({ title: "Implement user profile editing", priority: 2 })
- [writes code]
- add_task_note({ content: "Used form validation library Zod for type-safe schema validation" })
- git_stage()
- git_commit({ message: "Add user profile editing with Zod validation" })
- update_task({ status: "done" })

Pattern 2: Bug Investigation

1. Create a bug task
2. Search codebase for relevant functions (context_search)
3. Add notes to the task explaining findings
4. Fix the bug
5. Add a final note explaining the solution
6. Mark the task as done
Example:
You: There's a bug where users can submit the form twice. Investigate and fix it.

Agent:
- create_task({ title: "Fix double form submission bug", priority: 3, labels: ["bug"] })
- context_search({ query: "form submission" })
- add_task_note({ content: "Found the issue in src/components/Form.tsx - no disabled state on submit" })
- [fixes code]
- add_task_note({ content: "Fixed by adding loading state and disabling button during submission" })
- git_commit({ message: "Fix double form submission by disabling button" })
- update_task({ status: "done" })

Pattern 3: Research & Documentation

1. Search notes for existing documentation
2. If none exists, research the topic
3. Create a pinned note with findings
4. Reference this note in future sessions
Example:
You: Research best practices for API rate limiting and document them.

Agent:
- search_notes({ query: "rate limiting" })
  → No results found
- [researches topic]
- create_note({
    title: "API Rate Limiting Best Practices",
    content: "1. Use token bucket algorithm\n2. Return 429 status with Retry-After header\n3. Implement per-user and per-IP limits...",
    pinned: true
  })

You (next session): How should I implement rate limiting?

Agent:
- search_notes({ query: "rate limiting" })
  → Found note #23: API Rate Limiting Best Practices
- [reads note and provides answer based on documented practices]

Troubleshooting

”No project detected” Error

Cause: Your working directory doesn’t match any project in CodeFire. Solution:
  1. Check which projects exist:
    Use list_projects to show all CodeFire projects
    
  2. Verify the path matches:
    pwd  # Check your current directory
    
  3. Either:
    • cd into a tracked project directory
    • Add the current directory to CodeFire
    • Pass project_id explicitly to each tool

”CodeFire database not found” Error

Cause: The CodeFire app hasn’t been launched yet, so the database doesn’t exist. Solution: Open the CodeFire app at least once to initialize the database.

MCP Tools Not Available

Cause: The MCP server isn’t configured for your AI CLI tool. Solution: Follow the Setup Guide to configure the MCP server.

Browser Tools Failing

Cause: CodeFire app isn’t running, or the browser tab was closed. Solution:
  1. Launch the CodeFire app
  2. Open the built-in browser
  3. Ensure at least one tab is open

Next Steps

Tools Reference

Browse all available MCP tools

API Reference

Detailed API schemas and examples

Build docs developers (and LLMs) love