> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Demo Using an MCP Server

> Guide to registering, running, and querying a local MCP flight booking server with RooCode, exploring resources, transports, and example responses.

In this lesson we'll connect to and use an existing MCP (Model Context Protocol) server. You'll learn how to locate the server code in the workspace, register it with the RooCode MCP plugin, and run a simple query (searching flights) through the chat assistant.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/nYh5ESbtPa0_kgi9/images/Crash-Course-MCP-For-Beginners/Model-Context-Protocol-MCP/Demo-Using-an-MCP-Server/split-screen-mcp-flight-booking-vscode.jpg?fit=max&auto=format&n=nYh5ESbtPa0_kgi9&q=85&s=c7a652a4760ceb83a4e3480c6d3ecab1" alt="A split-screen developer workspace: the left panel shows a lab task titled &#x22;MCP Server Exploration – Flight Booking System&#x22; with instructions, and the right panel displays Visual Studio Code open to a README welcoming users to KodeKloud OpenAI Labs." width="1920" height="1080" data-path="images/Crash-Course-MCP-For-Beginners/Model-Context-Protocol-MCP/Demo-Using-an-MCP-Server/split-screen-mcp-flight-booking-vscode.jpg" />
</Frame>

Quick orientation question:
What transport modes does MCP support?

| Option | Notes |
| - | - |
| WebSocket and REST | Not used by MCP in this example |
| HTTP and STDIO | Correct — MCP supports `HTTP` and `STDIO` transports |
| TCP and UDP | Not applicable here |
| FTP and SSH | Not applicable |

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/nYh5ESbtPa0_kgi9/images/Crash-Course-MCP-For-Beginners/Model-Context-Protocol-MCP/Demo-Using-an-MCP-Server/quiz-http-stdio-flight-booking-editor.jpg?fit=max&auto=format&n=nYh5ESbtPa0_kgi9&q=85&s=788e74834142ea469a2e1f8973dd60dc" alt="A dark-mode quiz screen asks &#x22;What are the transport modes supported in MCP?&#x22; with four answer buttons (WebSocket and REST; HTTP and STDIO; TCP and UDP; FTP and SSH) and a pointing-hand emoji selecting &#x22;HTTP and STDIO.&#x22; A code editor/Explorer pane (showing a flight-booking-server folder) is visible on the right." width="1920" height="1080" data-path="images/Crash-Course-MCP-For-Beginners/Model-Context-Protocol-MCP/Demo-Using-an-MCP-Server/quiz-http-stdio-flight-booking-editor.jpg" />
</Frame>

Repository inspection
Open the workspace file explorer and locate the `flight-booking-server` folder. A typical listing in the workspace looks like this:

```bash theme={null}
EXPLORER
LAB-USER
.roo-coder
code
flight-booking-server
.venv
.gitignore
.python-version
main.py
pyproject.toml
README.md
server.py
uv.lock
venv
.bash_logout
.bash_profile
.wget-hsts
README.md
```

The multiple-choice task asks which files are present inside `flight-booking-server`. The important files for this lesson are `server.py` (the MCP server code) and `pyproject.toml` (dependency and project metadata).

Open `server.py` to inspect how resources and tools are exposed via MCP. You’ll see resource decorators similar to these:

```python theme={null}
@mcp.resource("file://airports")
def get_airports():
    """Get list of available airports"""
    return {
        "LAX": {"name": "Los Angeles International", "city": "Los Angeles", "country": "US"},
        "JFK": {"name": "John F. Kennedy International", "city": "New York", "country": "US"},
        "LHR": {"name": "London Heathrow", "city": "London", "country": "UK"},
    }

@mcp.resource("file://airlines")
def get_airlines():
    """Get list of available airlines and their information"""
    return {
        "AA": {"name": "American Airlines", "country": "US"},
        "BA": {"name": "British Airways", "country": "UK"},
        "DL": {"name": "Delta Air Lines", "country": "US"},
        "UA": {"name": "United Airlines", "country": "US"},
    }
```

<Callout icon="lightbulb" color="#1CB2FE">
  You don't need to memorize every line in `server.py` right now — the focus here is registering and using the MCP server. We'll look at relevant functions as needed when you query the server.
</Callout>

Minimal server setup
For context, the server in this project uses FastMCP to register resource endpoints. A condensed version of the setup looks like this:

```python theme={null}
from mcp.server.fastmcp import FastMCP

# Create an MCP server instance
mcp = FastMCP("Flight Booking Server")

@mcp.resource("file://airports")
def get_airports():
    """Get list of available airports"""
    return {
        "LAX": {"name": "Los Angeles International", "city": "Los Angeles", "country": "US"},
        "JFK": {"name": "John F. Kennedy International", "city": "New York", "country": "US"},
        "LHR": {"name": "London Heathrow", "city": "London", "country": "UK"},
    }

@mcp.resource("file://airlines")
def get_airlines():
    """Get list of available airlines"""
    return {
        "AA": {"name": "American Airlines", "country": "US"},
        "BA": {"name": "British Airways", "country": "UK"},
        "DL": {"name": "Delta Air Lines", "country": "US"},
    }

# ...rest of server startup code (e.g., mcp.serve())...
```

Registering the MCP server with RooCode
To let the RooCode assistant discover and call the local server, you add an MCP server entry in the RooCode MCP configuration. The configuration maps a friendly name to the command used to start the server and its working directory. In this lab the configuration is:

```json theme={null}
{
  "mcpServers": {
    "flight-booking": {
      "command": "uv",
      "args": ["run", "python", "server.py"],
      "cwd": "/home/lab-user/flight-booking-server"
    }
  }
}
```

Explanation:

* `command`: the program RooCode will invoke (`uv` in this environment).
* `args`: the arguments to run the Python server (here, `run python server.py`).
* `cwd`: the working directory where `server.py` is located.

Steps to connect the server in RooCode

1. Open the RooCode extension/plugin in your workspace.
2. Go to the "MCP servers" section and choose "Add Project MCP".
3. Paste the JSON configuration (above) into the configuration field and save.
4. Refresh the MCP Servers list. The "flight-booking" entry should appear and show a green/success status when detected.
5. Expand the server entry to view tools and resources discovered from `server.py`.

Security reminder

<Callout icon="warning" color="#FF6B6B">
  When the assistant requests to use an MCP server you must approve the access. Only approve servers and configurations from trusted projects — the assistant will run server-side code on your behalf.
</Callout>

Querying the MCP server from RooCode
Once the MCP server is registered and running, you can ask RooCode to perform actions that use server-side resources. For example, in the chat input send:

Search for flights from LAX to JFK using the flight-booking server.

RooCode will detect the configured MCP server, ask for your permission to use it, then execute the relevant resource/tool handlers and return the server-generated result.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/nYh5ESbtPa0_kgi9/images/Crash-Course-MCP-For-Beginners/Model-Context-Protocol-MCP/Demo-Using-an-MCP-Server/dark-api-flight-search-lax-jfk.jpg?fit=max&auto=format&n=nYh5ESbtPa0_kgi9&q=85&s=251b0b355639f2fbdf4bc26831b405f2" alt="A screenshot of a dark-themed developer interface showing a chat/API request panel with the text &#x22;Search for flights from LAX to JFK using the flight-booking server,&#x22; an API Request section, and a message input box. The left edge shows part of a code editor/sidebar and line numbers." width="1920" height="1080" data-path="images/Crash-Course-MCP-For-Beginners/Model-Context-Protocol-MCP/Demo-Using-an-MCP-Server/dark-api-flight-search-lax-jfk.jpg" />
</Frame>

Example server response
After you approve access and RooCode calls the server, a typical JSON response might look like:

```json theme={null}
{
  "origin": "LAX",
  "destination": "JFK",
  "result": [
    {"flight": "FL123", "price": 299},
    {"flight": "FL456", "price": 399}
  ]
}
```

This indicates the MCP server is reachable and returning structured data for the requested query.

Next steps and exploration ideas

* Inspect `server.py` to see how resources, tools, and handlers are implemented and how MCP exposes them.
* Modify or extend resource handlers (e.g., add booking, availability checks) and then reload the MCP entry in RooCode to test changes.
* Use `pyproject.toml` to manage dependencies and ensure the environment can run the server.
* Experiment with `HTTP` and `STDIO` modes if you adapt MCP transport options for other integrations.

References

* Python documentation: [https://www.python.org/doc/](https://www.python.org/doc/)
* If you're using project tooling (like `uv`/`uvicorn`), check the respective tool docs for command syntax and options.

<CardGroup>
  <Card title="Watch Video" icon="video" cta="Learn more" href="https://learn.kodekloud.com/user/courses/crash-course-mcp-for-beginners/module/f1e44479-23c8-46ec-b1b9-d9e90146921b/lesson/2243ff85-6731-47e6-ae41-28c7385c19aa" />

  <Card title="Practice Lab" icon="flask-conical" cta="Learn more" href="https://learn.kodekloud.com/user/courses/crash-course-mcp-for-beginners/module/f1e44479-23c8-46ec-b1b9-d9e90146921b/lesson/f23c49ef-12f2-45e2-9237-e054800f4ccc" />
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.