Using Claude.ai with your Database (Part 2: MCP)

In an earlier post I talked about how to educate Claude about your ERP system or any other database so that Claude is able to accurately generate SQL queries for you based on your plain English input. 

Having SQL knowledge is not necessary, Claude has your back. 

I also talked about additional advantages this can give you such as having Claude explain how a particular part of your database works, for example Stock Control, and also asking Claude to generate interactive dashboards or documentation based around the structure of your database.

I then did a follow up to this post where I discussed and made available the documentation for a script that extracts the schema information from your database and makes it available to Claude as a basic text or markdown file. This is the basis for educating Claude about your database.

At the end of the first article I mentioned that we are able to take this a step further and connect Claude directly to the data in the database. So instead of generating the queries, which you can then execute using the SQL query tool of your choice, you can instead actually retrieve the data output directly into your Claude chat session, making the use of a separate query tool unnecessary.

An additional advantage of doing this is that what Claude cannot infer from the database schema, it will try to infer or verify from the data values in the database in order to further increase its understanding, which in turn increases the quality of its output.

The key to this ability is down to something called an MCP server. Model Context Protocol is an open standard, introduced by Anthropic in late 2024, that provides a universal, standardised way for AI models to connect with external tools, applications, and other data sources. It’s a common language that allows an AI system to communicate consistently with a range of external services, regardless of who built them or how they work behind the scenes.

An MCP Server is essentially a simple, lightweight application that provides the pipe (adaptor) that connects Claude to something else, in this case, your database.

Installing and configuring MCP is beyond the scope of this article, however a few minutes with Google and the ability to execute a couple of commands in the Terminal followed by editing the Claude JSON (claude_desktop_config.json) file and the connection is made. You will of course also need to know an appropriate database logon and password and of course the hostname, database and port of your database server. 

After setting up the MCP server, restart Claude and hopefully your configuration file changes are picked up and executed successfully by Claude. Backup your claude_desktop_config.json file before editing as if your changes are unsuccessful Claude will reset it to a default state, ie: you will lose any other changes you may have made.

Note that if setting up MCP for your users or colleagues, the database logon name and password you use should only allow access to the information within the database that is appropriate for those individuals. This can be configured within the database itself in the traditional way.

Assuming you have opened Claude after you’ve made the changes and Claude hasn’t complained, go to the Settings > Developer section of the Claude desktop application and hopefully you will see something like this:

So now that Claude is successfully connected to your database, give it a whirl. 🙂

Open a new chat and input something like this:


Claude will ask for your permission to use the tools it needs. Select ‘Always allow’ or ‘Allow once’ and Claude will proceed to give you some feedback as it generates an appropriate query and retrieves the data. 

As always with any AI model, verify the results.

As you can see if you aren’t already doing this, it can be game changing for your business. Simple and fast answers to questions you have about your data using plain English instructions rather than SQL queries. 

This doesn’t mean there is no longer a need for people who have that understanding or other programming or technical abilities. In fact those are the very people who are best placed to take the most advantage from the new tools that AI has made available.

Using AI and/or MCP in combination with a programming language is one of the best ways you can seamlessly introduce the power of AI into new or existing business applications. That way you can bring the benefits of AI to your users even if they don’t have access to an AI chatbot within their work environment, giving the Head of IT the ability to control what is sent to, and received from, AI. This level of control isn’t easily available using the standard chatbots. 

If you want a high level of auditing and control over your AI and haven’t got the technical abilities in house to create your own software around AI, or if you don’t wish to go that route, and require additional security guarantees, Copilot from Microsoft can provide this level of control as well as full access to both sides of an AI conversation. Setting up a Copilot solution is something you can choose to do yourself or alternatively you can farm it out to an MSP. MS Copilot can now use Claude as well as OpenAI, however if you are choosing Copilot for its security and wish to use Claude, it’s worth getting up-to-date information on this as Claude can still process your information outside of UK/EU boundaries. Depending on the nature of your business this may or may not matter to you. The latest article I could find (a couple of days ago) is here.

Whether you are using Windows, macOS or Linux on your desktop you can setup MCP and gain the advantages I’ve talked about in this article. If any of the above even slightly interests you then have a go, as long as you start by setting up your database logon with Read Only permissions, you cannot do any harm and you never know, you might be impressed 👍

Future Articles

A forthcoming article will take this a step further and demonstrate how to get great quality, professional looking, downloadable, HTML dashboards instead of seeing the data output as text in the chatbot interface. I’ll demonstrate the techniques you can use to force the output into a design of your choice with appropriate headers and footers as well as your preferred type of charts, fonts etc. I’ll also give some tips on caching, images, models etc. in order to minimise the cost by reducing the amount of tokens used.

Another article will demonstrate some of the tools and techniques you can use to create a cross-platform compiled executable desktop application that leverages a cross-platform scripting language behind the scenes to interact with the AI. All the user sees is an app with a nice GUI.

If there is interest I will also write about how sometimes you can be inspired to create something with AI, but after a couple of hours you decide to do it all from code instead – a cheaper (to run) and sometimes better option.

Using Claude.ai with your Database (Part 1.1)

For those who messaged me asking for further information on the script that I used to create the database schema extract, I’ve made available below the documentation for that script. For those that are interested, AI was involved both in building the original script and in producing the documentation.

Using Claude.ai with your Database (Part 1)

AI can answer a lot of questions with varying levels of accuracy, it is even pretty good at creating SQL queries, but if it doesn’t know your database then it’s a very detached and incomplete experience. In this post I’ll discuss how I overcame this and set Claude.ai up so that it understands my database and can easily create SQL queries that you can immediately try for yourself.

This has another set of advantages as well which I will talk about later in this document.

As with any AI the way to success is all about context. You need to find a way of telling the AI as much as you can about your database or in my case, our ERP system. 

You can of course construct a document that contains this information, which is a good idea and you can reuse the same document over again for future similar queries. This however becomes unwieldy if you want to ask for queries that you have not previously documented as context for the AI.

The database itself contains all the information about tables, views, indexes, foreign keys, constraints etc. that Claude will need so that it can write accurate queries for you.

Our ERP system has 1000+ tables and eleventy million other objects, there way no way I was going to even attempt to do anything manually. So I wrote a Python script and ran it against the database and the script generates a schema file containing everything the database knows about itself.

The image shows a small section of the schema file. Obviously for often used queries you can extract just the necessary information from this file and save it as a much smaller specific schema.

Now I’ve got this I just need to upload the schema file to Claude and ask it to generate a SQL query for me.

‘using the uploaded schema generate me a sql query to show me top customers by order value in 2026’

It will then give you some feedback before building the required query.

This is the query that was built by Claude:

It also added some notes:

This query was accurate and pasted into SSMS it ran first time.

I mentioned that there are other advantages of showing Claude a complete picture of your database. Once Claude has that picture you can then ask it to explain how part of the database works, or ask it to create reference documents for you to use.

Below are a three screenshots of interactive HTML tools I asked Claude to generate from the uploaded schema:

Claude will not always be 100% accurate with SQL queries that it generates and it may make assumptions about things which are not obvious from the schema file and ideally needs access to the data itself.

I’ll go through this in the next post.

AI: Is Society Ready?

It’s interesting that despite the many differences of opinion regarding AI, few people acknowledge the fact that potentially it will turn society on its head, and we are not ready for it. 

I’m not talking about AGI and the dystopian future predicted by many, although I admit that is a possibility. I’m talking about the inevitable shift in jobs and society caused by the use of AI and AI Agents.

For many decades much of the traditional manual work has been taken over by machinery and automation, think car plants and their robot assembly lines. We were told that the way to get on in life and achieve long term job security was to become a knowledge worker. 

Knowledge workers don’t need overalls and hard hats, we need a computer keyboard and a mouse.

Some of these roles include:

  • Personal Assistant
  • Graphic Designer
  • Architect
  • Computer Programmer
  • Accountant
  • Marketing Person
  • Data Entry Clerk
  • Travel Agent
  • Customer Services Person
  • Call Centre Operative

AI is waiting in the wings to replace many of those jobs. Not totally, at least not initially, but in the near future the need for humans in those roles will be vastly decreased. A Customer Services Manager may find themselves in charge of 20 AI agents, rather than 8 humans.

Look at the current capability of human type robots. If you are an Electrician, a Gardener, a Plumber or a Builder then you will be safe for many years as robotics companies are finding it extremely difficult to create a robot that has the capability and dexterity to perform those roles. 

The tide has turned. Knowledge workers are the those ones that now have their jobs threatened by technology and the skilled manual workers are sitting pretty, for a while at least.

For those not convinced, remember that AI doesn’t need to be able to replace you, it just needs to convince your boss that it can …

Adventures with Guitar Gear: Part 1

So yesterday I dug out my Boss RC1 Looper pedal and my Morley Bad Horsie Wah pedal. I’ve connected them up and had some fun with them 🙂 The Boss ME90 already has a Looper and Wah but I want to play with looping and I have a dedicated pedal so better to be used than stuck in a box, and the Wah on the ME90 is engaged by pushing hard on the pedal (as are most Wahs, Cry Baby, Vox etc.) the problem is I struggle doing that due to nerve damage in my hands and feet caused by Chemo. The Morley Wah is brilliant as it is engaged just by using the pedal and disengaged as soon as it runs to its rest position.

On a side note, this Morley Wah is my third identical one, the previous ones were sold when I decided I didn’t want them, only to be bought again a few months later when I changed my mind. Like an idiot, I did this twice lol. Suffice to say, I now sell very little and the boxes in the garage and spare room are testament to that 🙂

I’ve put the Looper in the Send / Return (more on that later) on the ME90 and I had to find the setting on the ME90 that allows you to set the S / R to either Pre or Post. Post was the option I needed as I wanted the Looper to retain it’s recorded settings and not change them when I changed to a different patch on my ME90. This means that I can play a rhythm with a low gain setting and then change to a lead patch with Delay, Reverb etc. to play over the top of it. Luckily the ME90 allows you to do this via either your computer or phone using a USB cable or Bluetooth respectively.

Coming back to the Send / Return, instead of connecting the Return back to the ME90 i’ve cabled it into a free channel on my mixer which gives me better control over the volume of the recorded track on the Looper. I am now down to one free input on my mixer, i’ve already been looking at 12 channel mixers instead of the 8 I currently have.

One of the good things about the ME90 is that it only needs a standard 9V power supply so I was able to utilise (rescue from the garage!) my 10 way 9V PSU to power the ME90, the Wah and the Looper. Works well, the PSU sits out of site under the futon in my Office / Mancave / Studio making quite a neat setup.

I have ordered a couple of new patch cables for the Wah and Looper as I want them a metre or so long, right angled at one end and straight at the other end. Yeh, I know, did I mention I’m a bit OCD about some things?

Something else I found in the garage which i’d forgotten i’d got, some long guitar cables with magnetic ends, so you can choose between right angle or straight and the end just snaps on. Also good I suppose if playing on stage and the cable gets caught, better to break away (like the Magsafe connectors on a MacBook) than yank you or the instrument, potentially being a nasty or expensive experience.

Guitar Practice Tools (New App)

I’ve had the idea of working on an application that would help me with my guitar learning journey by centralising some of the tools I think I need and information I want to keep track of.

I am a developer by trade but no longer program for fun, however this was something I really did want to do.

When I got up this morning I wrote the gpTools (Guitar Practice Tools) application (Windows and macOS) with three basic functions that I will find useful:

Timers:

A Session timer and an Exercise timer. The idea being I would start the Session timer when I sit down to practise and leave that running, and then use the Exercise timer to see how long I spent on a particular exercise. I can reset that at the beginning of each exercise. I did buy a kitchen timer but its small and fiddly and makes my desk more cluttered, so I will use this function daily.

Clapboard:

This is another timer, but the idea here is that if you are recording yourself and want to leave the recording going so you don’t have to sort through it later to find the good bits, bad bits, cool riffs etc. you start the Clapboard timer. Every time you do something that you may want to reference later, you click the button and the current timer value is written to a list, latest entries at the top. You can edit the list if you like to document the reason for the entry. Once you have finished recording you can save the export file with the recording if you like and then in future you have a reference of where in the file is the bit you want. Again, it’s basic but it’s going to work for me.

Numbers:

This simply shows two random numbers on the window every three seconds or so. The first number is between 1 and 12 and the second number is between 1 and 5. This useful if jamming to a blues backing track for example, the idea being that the next phrase you play has the amount of notes shown on the screen, and is played in the position shown. It just helps keep your jamming practice from becoming repetitive by playing the same licks and shapes over and over again.

Obviously this is just the start, features I will add in future include:

Stopwatch

Practise Log

Chords Learned List

Practice Schedule

Ultimate Song List

Randomised Practice Sessions

If anyone is interested you can see the quick demo video on Youtube at this address: 

This application is designed purely for my own use and as such it’s not pretty, but it works and will provide a basis on which to build something more significant.

Why Xojo?

People sometimes ask what language I use for software development. For many years now my preferred language has been Xojo. The response to this is normally ‘What’s Xojo?’ and ‘Why use a language nobody has ever heard of?’

Xojo has been around since 1996. It has allowed me to develop applications that run on Windows, macOS, Linux, Android, iOS and the Web. You can even develop applications for Raspberry Pi, although I haven’t done so yet.

Xojo and the essential MBS plugins have helped me earn a living for many years and has it remained relevant and contemporary throughout that time. I also find that I can develop much faster in Xojo and provide a solution quicker, which equates to less expense for the customer.

There is a learning curve, but far less than for many other languages, and for me the ability to develop applications that can be compiled for other platforms with minimum changes to the source code, is fantastic.

Most of my users over the years have been running Windows, but I almost always develop on a Mac, a significant plus for me as I don’t enjoy using Windows on my main computers.

Xojo also makes it easy to get into programming, offering a range of purchase options that should suit programmers or hobbyists of any level, as well as providing both student and teacher editions of an ‘Introduction to Xojo Programming‘ textbook.

Hybrid Working

Hybrid working is a form of flexible working where workers spend some of their time working remotely and some in the employer’s workspace. As a senior leader, you might consider the benefits of hybrid working from different perspectives, such as:

Employee Satisfaction: Hybrid working can help increase employee satisfaction, which can help businesses maintain their most valuable talent and lower their hiring and onboarding costs. Employees can enjoy greater flexibility, better work-life balance, less commuting, and more autonomy over their workload.

Organisational Performance: Hybrid working can also improve organisational performance by empowering employees to work to their strengths, fostering a culture of trust and accountability, and enabling faster and more agile decision-making. Hybrid working can also enhance creativity and collaboration by retaining the benefits of in-office contact while allowing for more diverse and cross-functional teams.

Cost Efficiency: Hybrid working can help reduce operational costs by optimising the use of office space and resources, as well as lowering travel and relocation expenses. Hybrid working can also enable access to a wider and more diverse talent pool, which can improve the quality and diversity of recruitment and retention.

Social and Environmental Impact: Hybrid working can also have positive social and environmental impacts by reducing carbon emissions, traffic congestion, and air pollution from commuting. Hybrid working can also promote greater inclusion and fairness by offering more opportunities for workers with different needs, preferences, and circumstances, such as those with disabilities, caring responsibilities, or living in remote areas.

Of course, hybrid working also comes with some challenges and risks, such as maintaining effective communication, collaboration, and coordination across hybrid teams, ensuring the wellbeing and engagement of remote workers, managing performance and productivity, and ensuring legal compliance and data security, more details on the challenges later in this document.

Therefore, you might want to consider how to plan and implement hybrid working policies and practices that suit your organisation’s goals, culture, and context, as well as the needs and expectations of your employees. You might also want to consult with your HR, IT, and legal teams, as well as your employees and stakeholders, to ensure a smooth and successful transition to hybrid working.

The Challenges

Some of the common challenges of hybrid working are:

Communication: Hybrid working can make communication more difficult, especially when some team members are in the office and some are not. It can create information gaps, misunderstandings, and conflicts, as well as reduce the frequency and quality of feedback. To overcome this challenge, hybrid workers need to use clear, concise, and consistent communication methods, such as video calls, instant messaging, and shared documents, and establish regular check-ins and updates with their managers and colleagues.

Coordination: Hybrid working can also affect coordination, which is the ability to align tasks, goals, and resources across different locations and time zones. It can create challenges for scheduling, planning, and delegating work, as well as for monitoring and evaluating performance. To overcome this challenge, hybrid workers need to use effective coordination tools, such as calendars, project management software, and dashboards, and establish clear roles, responsibilities, and expectations for each team member.

Connection: Hybrid working can also impact connection, which is the sense of belonging and trust among team members and with the organisation. It can reduce the opportunities for social and informal interactions, which are important for building and maintaining relationships, as well as for fostering a culture of collaboration and innovation. To overcome this challenge, hybrid workers need to create and participate in virtual and physical activities that promote connection, such as team-building exercises, social events, and mentoring programs, and express appreciation and recognition for each other’s contributions.

Creativity: Hybrid working can also influence creativity, which is the ability to generate and implement new and useful ideas. It can limit the exposure to diverse perspectives, experiences, and stimuli, as well as the serendipitous encounters that can spark creativity. To overcome this challenge, hybrid workers need to seek and share inspiration from various sources, such as online platforms, podcasts, and books, and engage in brainstorming and prototyping sessions with their team members, using both synchronous and asynchronous methods.

Culture: Hybrid working can also affect culture, which is the shared values, norms, and practices that shape the identity and behaviour of the organisation. It can create inconsistencies and inequalities in the experiences and opportunities of different groups of workers, such as those who work more remotely or more in the office, as well as those who have different preferences, needs, and circumstances. To overcome this challenge, hybrid workers need to embrace and celebrate diversity, inclusion, and equity, and ensure that everyone has access to the resources, support, and development they need to succeed and thrive.

These are some of the main challenges of hybrid working, but they are not insurmountable. With the right strategies, tools, and mindsets, hybrid workers can overcome these challenges and enjoy the benefits of hybrid working.

Note: This post contains some AI generated content.

Ideas and Innovations Committee

I believe the creation of an ‘Ideas and Innovation Committee’ would be of great benefit to any company and its staff members.

The purpose of the meetings is ideas, not whines or whinges. Basically we are asking our senior personnel for ideas on how we can make the company more efficient, more profitable or maybe just a better place to work.

If we are not improving then entropy guarantees we are getting worse. Companies needs innovation and the more minds that focus on this the better the chances of making it happen.

My proposal is that the Ideas Committee meets monthly and consists of managers and possibly senior supervisors.

The meeting will be organised by a Chairman. The Chairman will ask around the table for ideas, each individual will have a maximum of 5 minutes to present their idea, only one idea per individual, per meeting will be accepted.

Stage 1

Once an idea has been presented there will be a short period to allow for discussion and questions. At the end of this period the presenter will ask for support for their idea. If at least one other person will second and support the idea then the idea is classed as Stage 1.

Once an idea is accepted as Stage 1, the presenter will be asked to come to the next meeting with the idea written out to be properly presented to the group. This is Stage 2.

Stage 2

Following the Stage 2 presentation the idea will need majority support to become Stage 3.

Stage 3

To reach Stage 4 a Stage 3 idea needs to gain an Executive Sponsor who will support the idea and present it to the board for approval.

Each idea, who presented it and what stage it reached will be documented and sent out as minutes to each committee member following the meeting.

I’d expect each manager to involve their team to help come up with new ideas. To provide further incentive maybe we could have an annual ‘Most Innovative Department’ award, maybe a wall plaque or similar. Not only does this show our employees we listen and are invested in the future but it also demonstrates the same to our customers.

For companies to go forward and succeed I think new ideas and better communications are essential. The time to implement something like this is now. There is never a better time to implement change and improve our culture than right now.